A modern task management app that uses a Kanban-style board to help users organize and track their tasks. Built with Next.js, it offers drag-and-drop functionality for an intuitive user experience.
- Create, Edit, Delete Todos: Add tasks, edit them as needed, and remove completed or obsolete tasks.
- Drag-and-Drop Kanban Board: Seamlessly move tasks between columns like "To Do", "In Progress", and "Done" using DnD Kit.
- Real-Time Updates: Task statuses are updated dynamically across the UI.
- Responsive Design: Optimized for mobile and desktop views using Tailwind CSS.
- Dialog Components: Easy form interactions with dialog boxes built using ShadCN.
- Authentication: Secure login with JWT and bcrypt.
- Next.js 14: Latest features for server-side rendering and dynamic routing.
- Tailwind CSS: For responsive and customizable UI.
- DnD Kit: Drag-and-drop library for smooth task movement.
- ShadCN: UI components for dialogs, notifications, and more.
- Redux: State management for storing todos across user sessions.
- Node.js: Backend runtime environment.
- Express: Web framework for Node.js.
- MongoDB: NoSQL database for storing users and tasks.
- Mongoose: Object Data Modeling (ODM) library for MongoDB.
- JWT: For authentication and securing API endpoints.
- Zod: Schema validation for user input.
- bcryptjs: Password hashing.
-
Clone the repository:
git clone https://github.com/10kumaranurag01/todo-done.git
-
Navigate to the project directory:
cd todo-done
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open the app in your browser:
http://localhost:3000
- Create a Todo: Click on the "Add Task" button to create a new task.
- Edit or Delete: Use the task options to edit or delete existing tasks.
- Drag and Drop: Move tasks between columns using drag-and-drop functionality.
- Authentication: Log in securely (if implemented) to access personalized todos.
To run this project, you need to set the following environment variables in a .env.local
file:
NEXT_PUBLIC_BASE_URL=YOUR_BACKEND_API_URL
To test this project, you can enter the following test credentials:
username=testuser1
password=123456
Method | Endpoint | Description |
---|---|---|
GET | /api/todos |
Fetch all todos |
POST | /api/todos |
Add a new todo |
PUT | /api/todos/:id |
Update an existing todo |
DELETE | /api/todos/:id |
Delete a todo |
This is the backend API for a Task Management Dashboard that includes user authentication, task management (CRUD operations), and a Kanban board feature. The backend is built using Express, connected to a MongoDB database, and uses JWT for user authentication. The frontend is built with Next.js, and the backend is designed to integrate seamlessly with it.
- User Authentication (Register/Login) using JWT.
- Protected routes to allow only authenticated users to access tasks.
- Create, Read, Update, and Delete tasks.
- Tasks can be filtered and sorted by status, priority, and due date.
- Tasks have a Kanban-style status with drag-and-drop functionality on the frontend.
- User password encryption with
bcryptjs
. - Input validation using
Zod
.
task-manager-backend/
βββ config/
β βββ db.js # Database connection setup
βββ controllers/
β βββ authController.js # Handles authentication logic
β βββ taskController.js # Handles task CRUD logic
βββ middlewares/
β βββ authMiddleware.js # Authentication middleware to protect routes
βββ models/
β βββ Task.js # Task model schema
β βββ User.js # User model schema
βββ routes/
β βββ authRoutes.js # Routes for user authentication (login/register)
β βββ taskRoutes.js # Routes for task operations (CRUD)
βββ utils/
β βββ validate.js # Zod validation schemas for input validation
βββ .env # Environment variables (not included in version control)
βββ app.js # Main application file
βββ package.json # NPM dependencies and scripts
βββ README.md # Project documentation
Before starting, ensure you have:
- Node.js (version 14 or higher)
- MongoDB (local or MongoDB Atlas)
-
Clone the repository:
git clone https://github.com/10kumaranurag01/todo-done-express.git cd todo-done-express
-
Install dependencies:
npm install
-
Create a
.env
file:At the root of the project, create a
.env
file with the following contents:MONGO_URI=mongodb://localhost:27017/taskmanager # Update this to your MongoDB URI JWT_SECRET=your_jwt_secret # Set a strong JWT secret
-
Run the server:
npm run dev
The server will start on http://localhost:5000.
Method | Endpoint | Description | Protected |
---|---|---|---|
POST | /api/auth/register |
Register a new user | No |
POST | /api/auth/login |
Log in an existing user | No |
Method | Endpoint | Description | Protected |
---|---|---|---|
GET | /api/tasks |
Fetch all tasks for the logged-in user | Yes |
POST | /api/tasks |
Create a new task | Yes |
PUT | /api/tasks/:id |
Update an existing task | Yes |
DELETE | /api/tasks/:id |
Delete a task | Yes |
- Endpoint:
POST /api/auth/register
- Request Body:
{ "username": "JohnDoe", "email": "john@example.com", "password": "password123" }
- Response:
{ "_id": "60d1d20d925f3b3f30fc446e", "username": "JohnDoe", "email": "john@example.com", "token": "your-jwt-token" }
- Endpoint:
POST /api/auth/login
- Request Body:
{ "username": "JohnDoe", "password": "password123" }
- Response:
{ "_id": "60d1d20d925f3b3f30fc446e", "username": "JohnDoe", "email": "john@example.com", "token": "your-jwt-token" }
- Endpoint:
GET /api/tasks
- Response:
[ { "_id": "60d1e5f9b2d3b6b5d865df36", "title": "Build the API", "description": "Finish building the backend API", "status": "In Progress", "priority": "High", "dueDate": "2023-12-01T00:00:00.000Z", "userId": "60d1d20d925f3b3f30fc446e" }, { "_id": "60d1e602b2d3b6b5d865df37", "title": "Connect to MongoDB", "description": "Connect the API to a MongoDB database", "status": "To Do", "priority": "Medium", "dueDate": null, "userId": "60d1d20d925f3b3f30fc446e" } ]
You need to define the following environment variables in your .env
file:
Variable | Description |
---|---|
MONGO_URI |
MongoDB connection string |
JWT_SECRET |
Secret key for signing JWT tokens |
To start the development server with nodemon, use:
npm run dev
This will automatically restart the server when file changes are detected.
- All request validation errors are handled using Zod.
- Invalid JWT tokens return a 401 Unauthorized response.
- MongoDB errors and other server errors return appropriate error responses.
To deploy the backend:
- Set the environment variables (
MONGO_URI
,JWT_SECRET
) on your hosting provider (e.g., Heroku, Vercel). - Deploy the app on your preferred platform.
- Ensure the frontend is correctly pointing to the deployed API.
Thanks to these amazing contributors:
Devanshukoli π |
Shivam Narkar π |
Vasu Verma π |
Shubh Agarwal π» |
Aditi π |
Kevin MuΓ±oz Rengifo π» |
This project follows the All Contributors specification. Contributions of any kind are welcome!
Check out the CONTRIBUTE.md
file for guidelines on how
to contribute to this project.
For any inquiries, please contact kumarkas1515@gmail.com.
This project is licensed under the MIT License.
https://github.com/10kumaranurag01/todo-done-express.