A full-stack Todo application built with MongoDB, Express, React, and Node.js (MERN stack).
- ✅ User Authentication (Login/Register)
- ✅ JWT-based authentication with HTTP-only cookies
- ✅ Create, Read, Update, Delete Todos
- ✅ User-specific todos
- ✅ Modern UI with Tailwind CSS
- ✅ Dockerized application
- ✅ CI/CD Pipeline with GitHub Actions
- React 19
- TypeScript
- Redux Toolkit
- React Router
- Tailwind CSS
- Vite
- Axios
- Node.js
- Express
- TypeScript
- MongoDB (Mongoose)
- JWT Authentication
- Zod Validation
- Bcrypt
- Docker
- Docker Compose
- GitHub Actions
- Nginx
- Node.js (v20 or higher)
- MongoDB (or use Docker)
- Docker and Docker Compose (optional)
-
Clone the repository
git clone <repository-url> cd MernTodo
-
Install dependencies
# Server cd server npm install # Client cd ../client npm install
-
Set up environment variables
# Server - Create .env file in server directory PORT=3000 MONGO_URI=mongodb://localhost:27017/mern_todo CLIENT_URL=http://localhost:5173 JWT_SECRET=your-secret-key NODE_ENV=development # Client - Create .env file in client directory VITE_BACKEND_URL=http://localhost:3000
-
Start MongoDB (if not using Docker)
mongod
-
Start the application
# Terminal 1 - Server cd server npm run dev # Terminal 2 - Client cd client npm run dev
-
Access the application
- Frontend: http://localhost:5173
- Backend: http://localhost:3000
See DOCKER.md for detailed Docker setup instructions.
Quick start with Docker:
# Using setup script (Linux/Mac)
chmod +x scripts/setup.sh
./scripts/setup.sh
# Or using setup script (Windows)
.\scripts\setup.ps1
# Or manually
docker-compose up -dMernTodo/
├── client/ # Frontend React application
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── features/ # Redux slices
│ │ ├── hooks/ # Custom hooks
│ │ ├── pages/ # Page components
│ │ ├── services/ # API services
│ │ └── store/ # Redux store
│ └── Dockerfile
├── server/ # Backend Express application
│ ├── src/
│ │ ├── controllers/ # Route controllers
│ │ ├── models/ # MongoDB models
│ │ ├── routes/ # Express routes
│ │ ├── services/ # Business logic
│ │ ├── middlewares/ # Express middlewares
│ │ └── validator/ # Zod schemas
│ └── Dockerfile
├── docker-compose.yml # Docker Compose configuration
├── .github/
│ └── workflows/ # GitHub Actions CI/CD
└── scripts/ # Setup scripts
POST /api/users/create- Register new userPOST /api/users/login- Login userGET /api/users/profile- Get user profileGET /api/users/logout- Logout user
GET /api/todos/get-todos- Get all user todosGET /api/todos/get-todo/:id- Get single todoPOST /api/todos/create-todo- Create new todoPUT /api/todos/update-todo/:id- Update todoDELETE /api/todos/delete-todo/:id- Delete todo
PORT- Server port (default: 3000)MONGO_URI- MongoDB connection stringCLIENT_URL- Frontend URL for CORSJWT_SECRET- Secret key for JWT tokensNODE_ENV- Environment (development/production)
VITE_BACKEND_URL- Backend API URL
npm run dev- Start development servernpm run build- Build for productionnpm start- Start production server
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Lint code
The application includes a GitHub Actions workflow that:
- Lints and tests code on push/PR
- Builds Docker images
- Pushes to GitHub Container Registry
- Deploys to production (configure deployment steps)
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the ISC License.
For support, email support@example.com or open an issue in the repository.