A simple GraphQL application to understand how GraphQL works end-to-end. Learn GraphQL by clicking buttons and seeing real queries and mutations in action!
- 🎯 TypeScript backend with Apollo Server
- 🌐 Express server
- 💾 Mock database with sample data (featuring dog names!)
- 🖱️ Simple HTML/JS frontend (no React)
- 🔘 Interactive buttons to fetch data via GraphQL queries
- ✏️ Create mutations with form inputs
- 🎮 GraphQL Playground access for custom queries
npm installnpm run devThe server will start on http://localhost:4000
Navigate to http://localhost:4000 in your browser to use the interactive UI, or visit http://localhost:4000/graphql for the GraphQL Playground.
.
├── src/ # TypeScript server code
│ ├── server.ts # Main Express + Apollo Server
│ ├── schema.ts # GraphQL schema definition
│ ├── resolvers.ts # Query & mutation resolvers
│ └── database.ts # Mock in-memory database
├── client/ # Frontend
│ └── index.html # Interactive UI with buttons
├── dist/ # Compiled JavaScript (generated)
└── vercel.json # Vercel deployment config
users- Get all usersuser(id: ID!)- Get a specific user by IDposts- Get all posts with author informationpost(id: ID!)- Get a specific post
createUser(name: String!, email: String!)- Create a new usercreatePost(title: String!, content: String!, authorId: ID!)- Create a new post
query {
user(id: "1") {
id
name
email
posts {
id
title
content
}
}
}This project is configured for easy deployment to Vercel:
npm install -g vercel
vercelOr connect your GitHub repo to Vercel for automatic deployments.
This project demonstrates:
- ✅ GraphQL schema definition with types
- ✅ Resolvers for queries and mutations
- ✅ Nested data fetching (users with posts)
- ✅ Variables in GraphQL mutations
- ✅ Frontend integration without a GraphQL client library
MIT
