A modern todo list application built with GraphQL, Apollo Server, Next.js, and Tailwind CSS. This application demonstrates how to build a full-stack application with GraphQL as the API layer.
Backend:
Frontend:
graphql-todo/
├── server/
│ ├── index.js # Apollo Server setup
│ ├── todos.js # Todo data
│ └── user.js # User data
├── app/
│ ├── apolloClient.js # Apollo Client provider
│ ├── page.js # Main todo list page
│ ├── layout.js # Root layout with fonts
│ └── globals.css # Global styles
├── public/
└── package.json
Clone the repository:
git clone https://github.com/yourusername/graphql-todo.git
cd graphql-todo
Install dependencies:
# Install server dependencies
cd server
npm install
# Install client dependencies
cd ..
npm install
Start the GraphQL server:
# From the server directory
npm run start
# or
node index.js
The GraphQL server will run on http://localhost:5001/graphql
Start the Next.js application:
# From the project root
npm run dev
The application will be available at http://localhost:3000
type User {
id: ID!
name: String!
username: String!
email: String!
phone: String!
website: String!
}
type Todo {
id: ID!
title: String!
completed: Boolean
user: User
userId: ID!
}
type Query {
getTodos: [Todo]
getAllUsers: [User]
getUser(id: ID!): User
}
http://localhost:5001/graphql
getTodos
: Get all todos with user informationgetAllUsers
: Get all usersgetUser(id: ID!)
: Get a specific user by IDThe main components of the application are:
Set up environment variables for production:
PORT=5001
NODE_ENV=production
Deploy to your preferred hosting service (Heroku, Vercel, AWS, etc.)
Build the application:
npm run build
Deploy to Vercel, Netlify, or your preferred hosting service.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.