A feature-rich, full-stack Todo application built with the MERN stack, featuring custom animations, dark/light mode toggle, and user authentication.
Live Application: https://todo-lx3c.onrender.com/
- Custom Dark/Light Mode Toggle: Animated sun/moon with twinkling stars
- Smooth Animations: Scale effects, transitions, and micro-interactions
- Responsive Design: Mobile-first approach with TailwindCSS
- Modern UI: Clean, minimalist design with proper spacing and typography
- JWT Token Management: Secure authentication with token expiration
- Password Hashing: bcrypt with salt rounds for secure password storage
- Protected Routes: User-specific todo access
- Input Validation: Server-side validation and error handling
- Real-time CRUD Operations: Create, Read, Update, Delete todos
- User-specific Todos: Each user sees only their own todos
- Persistent Theme: Dark/light mode preference saved in localStorage
- Optimistic Updates: Immediate UI feedback with proper error handling
- React 19 - Latest React with hooks
- Vite - Fast build tool and dev server
- TailwindCSS - Utility-first CSS framework
- Axios - HTTP client for API calls
- React Icons - Icon library
- Node.js - JavaScript runtime
- Express.js - Web application framework
- MongoDB - NoSQL database
- Mongoose - MongoDB object modeling
- JWT - JSON Web Tokens for authentication
- bcryptjs - Password hashing
- Render - Full-stack deployment platform
- MongoDB Atlas - Cloud database
mern-todo-app/
βββ backend/
β βββ config/
β β βββ db.js
β βββ models/
β β βββ todo.model.js
β β βββ user.model.js
β βββ routes/
β β βββ auth.route.js
β β βββ todo.route.js
β βββ server.cjs
βββ frontend/
β βββ src/
β β βββ App.jsx
β β βββ AuthModal.jsx
β β βββ DarkModeToggle.jsx
β β βββ darkmode.css
β β βββ main.jsx
β βββ package.json
β βββ vite.config.js
βββ package.json
βββ README.md
- Node.js (v16 or higher)
- MongoDB (local or MongoDB Atlas)
- npm or yarn
-
Clone the repository
git clone https://github.com/tarankumar001/Todo.git cd Todo -
Install dependencies
# Install root dependencies npm install # Install frontend dependencies cd frontend npm install cd ..
-
Environment Setup
Create a
.envfile in the backend directory:MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key PORT=5000
-
Run the application
# Development mode npm run dev # Production build npm run build npm start
POST /api/auth/register- User registrationPOST /api/auth/login- User login
GET /api/todos- Get all todos for authenticated userPOST /api/todos- Create a new todoPATCH /api/todos/:id- Update a todoDELETE /api/todos/:id- Delete a todo
The dark mode toggle features:
- Animated Sun/Moon: SVG-based icons that morph between states
- Twinkling Stars: Appear in dark mode with smooth opacity transitions
- Smooth Transitions: CSS transitions for all state changes
- Persistent State: Theme preference saved in localStorage
- Registration: Email/password with bcrypt hashing
- Login: JWT token generation with 7-day expiration
- Protected Routes: Middleware ensures user authentication
- Token Management: Automatic token refresh and logout handling
- Mobile-first: Optimized for all screen sizes
- TailwindCSS: Utility classes for consistent styling
- Flexible Layout: Adapts to different viewport sizes
The application is deployed on Render with:
- Automatic builds from GitHub repository
- Environment variables for secure configuration
- Static file serving for the React frontend
- MongoDB Atlas for database hosting
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/todo-app
JWT_SECRET=your_secure_jwt_secret
NODE_ENV=production
PORT=10000- 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.
P. Tarankumar
- GitHub: @tarankumar001
- LinkedIn: [Your LinkedIn Profile]
- React team for the amazing framework
- Vite for the fast build tool
- TailwindCSS for the utility-first CSS framework
- MongoDB for the database solution
- Render for the deployment platform
β Star this repository if you found it helpful!