A modern, full-stack todo application built with Next.js 15, React 19, and MongoDB. Features user authentication, real-time todo management, and a beautiful responsive UI.
- User Authentication: Secure login and registration system
- Todo Management: Create, read, update, and delete todos
- Real-time Updates: Instant UI updates with React Context
- Progress Tracking: Visual progress bar showing completion status
- Responsive Design: Mobile-first design with Tailwind CSS
- Data Persistence: MongoDB integration with Mongoose ODM
- JWT Authentication: Secure token-based authentication
- Modern UI: Beautiful gradient backgrounds and smooth animations
- Next.js 15 - React framework with App Router
- React 19 - Latest React with new features
- Tailwind CSS 4 - Utility-first CSS framework
- Lucide React - Beautiful icon library
- React Toastify - Toast notifications
- Next.js API Routes - Serverless API endpoints
- MongoDB - NoSQL database
- Mongoose - MongoDB object modeling
- JWT - JSON Web Token authentication
- bcrypt - Password hashing
todo/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ │ ├── task/ # Todo CRUD endpoints
│ │ └── user/ # User authentication endpoints
│ ├── login/ # Login page
│ ├── register/ # Registration page
│ ├── layout.js # Root layout
│ ├── page.js # Home page
│ └── globals.css # Global styles
├── components/ # React components
│ ├── AddTodo.js # Add new todo form
│ ├── Card.js # Statistics card component
│ ├── EditTodo.js # Edit todo modal
│ ├── NavBar.js # Navigation bar
│ ├── ProgressBar.js # Progress visualization
│ ├── ShowTodo.js # Individual todo display
│ └── TodoList.js # Todo list container
├── context/ # React Context
│ └── TodoContext.js # Global state management
├── lib/ # Utility functions
├── models/ # Database models
│ ├── todo.model.js # Todo schema
│ └── user.model.js # User schema
├── public/ # Static assets
└── middleware.js # Next.js middleware
- Node.js 18+
- MongoDB database
- npm or yarn package manager
-
Clone the repository
git clone <repository-url> cd todo
-
Install dependencies
npm install
-
Environment Setup Create a
.env.localfile in the root directory:MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret_key
-
Run the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
- Register: Create a new account with name, email, and password
- Login: Sign in with your credentials
- Secure Routes: Protected todo management after authentication
- Add Todo: Click the "Add Todo" button to create new tasks
- Edit Todo: Click the edit icon to modify existing todos
- Delete Todo: Remove todos with the delete button
- Mark Complete: Toggle todo completion status
- Progress Tracking: Monitor your productivity with the progress bar
- Statistics Cards: View total, completed, and remaining tasks
- Progress Bar: Visual representation of completion percentage
- Todo List: Organized display of all your tasks
npm run dev- Start development server with Turbopacknpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLint for code quality
{
name: String (required, min: 3),
email: String (required, unique, min: 6),
password: String (required, hashed),
todos: [ObjectId references],
timestamps: true
}{
text: String (required, min: 5),
completed: Boolean (default: false),
userId: ObjectId (required, references User),
timestamps: true
}- Password Hashing: bcrypt for secure password storage
- JWT Tokens: Stateless authentication
- Input Validation: Mongoose schema validation
- Protected Routes: Middleware-based route protection
- Secure Headers: Next.js security middleware
- Gradient Backgrounds: Beautiful color schemes
- Responsive Grid: Mobile-first responsive design
- Smooth Animations: Enhanced user experience
- Toast Notifications: User feedback for actions
- Loading States: Better perceived performance
Happy Coding! 🎉