A full-stack task management application built with React (frontend) and Node.js/Express (backend) with MongoDB database. Features include user authentication, CRUD operations for tasks, filtering, search, and analytics dashboard.
-
User Authentication
- User registration with email and password
- JWT token-based authentication
- Secure login/logout functionality
- Protected routes (frontend and backend)
-
Task Management
- Create, read, update, and delete tasks
- Task properties: title, description, priority (Low/Medium/High), status (Todo/In Progress/Completed), due date
- Real-time task status updates
- Task filtering by status and priority
- Search tasks by title or description
- Pagination for large task lists
-
Dashboard & Analytics
- Task statistics (total, completed, pending)
- Priority breakdown visualization
- Completion rate tracking
- Recent tasks overview
-
Backend
- RESTful API with Express.js
- MongoDB with Mongoose ODM
- JWT authentication middleware
- Input validation with express-validator
- Password hashing with bcrypt
- CORS configuration
- Error handling middleware
- Database indexing for performance
-
Frontend
- React 18 with modern hooks
- React Router for navigation
- Context API for state management
- Axios for HTTP requests
- React Hot Toast for notifications
- Responsive design (mobile-friendly)
- Form validation
- Loading states and error handling
Before running this application, make sure you have the following installed:
- Node.js (v14 or higher)
- npm (v6 or higher)
- MongoDB (v4.4 or higher)
git clone <repository-url>
cd task-management-app# Navigate to backend directory
cd backend
# Install dependencies
npm install
# Create environment file
cp .env.example .env
# Edit the .env file with your configuration
# PORT=5000
# MONGODB_URI=mongodb://localhost:27017/taskmanagement
# JWT_SECRET=your-super-secret-jwt-key-here
# JWT_EXPIRE=30d
# NODE_ENV=development
# FRONTEND_URL=http://localhost:5173# Navigate to frontend directory
cd ../frontend/frontend
# Install dependencies
npm installMake sure MongoDB is running on your system:
# For Windows (if MongoDB is installed as service)
net start MongoDB
# For macOS (if installed via Homebrew)
brew services start mongodb/brew/mongodb-community
# For Linux
sudo systemctl start mongodTerminal 1 - Backend:
cd backend
npm run devThe backend server will start on http://localhost:5000
Terminal 2 - Frontend:
cd frontend/frontend
npm run devThe frontend will start on http://localhost:5173
Backend:
cd backend
npm startFrontend:
cd frontend/frontend
npm run build
npm run preview| Method | Endpoint | Description | Body |
|---|---|---|---|
| POST | /api/auth/register |
Register new user | { name, email, password } |
| POST | /api/auth/login |
Login user | { email, password } |
| GET | /api/auth/me |
Get current user | None (requires token) |
| Method | Endpoint | Description | Query Params |
|---|---|---|---|
| GET | /api/tasks |
Get all user tasks | status, priority, search, page, limit |
| GET | /api/tasks/:id |
Get single task | None |
| POST | /api/tasks |
Create new task | Body: task object |
| PUT | /api/tasks/:id |
Update task | Body: updated fields |
| DELETE | /api/tasks/:id |
Delete task | None |
| GET | /api/tasks/stats |
Get task statistics | None |
Register User:
curl -X POST http://localhost:5000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"name":"John Doe","email":"[email protected]","password":"password123"}'Create Task:
curl -X POST http://localhost:5000/api/tasks \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{"title":"Complete project","description":"Finish the task management app","priority":"High","dueDate":"2024-12-31"}'task-management-app/
βββ backend/
β βββ config/
β β βββ db.js
β βββ controllers/
β β βββ authController.js
β β βββ taskController.js
β βββ middleware/
β β βββ auth.js
β β βββ errorHandler.js
β βββ models/
β β βββ User.js
β β βββ Task.js
β βββ routes/
β β βββ auth.js
β β βββ tasks.js
β βββ .env.example
β βββ .env
β βββ package.json
β βββ server.js
βββ frontend/frontend/
β βββ public/
β βββ src/
β β βββ components/
β β β βββ Auth/
β β β β βββ Login.jsx
β β β β βββ Register.jsx
β β β βββ Dashboard/
β β β β βββ Dashboard.jsx
β β β βββ Layout/
β β β β βββ Navbar.jsx
β β β β βββ PrivateRoute.jsx
β β β βββ Tasks/
β β β βββ TaskForm.jsx
β β β βββ TaskItem.jsx
β β β βββ TaskList.jsx
β β β βββ TaskFilters.jsx
β β βββ context/
β β β βββ AuthContext.jsx
β β βββ services/
β β β βββ api.js
β β βββ App.jsx
β β βββ App.css
β β βββ main.jsx
β βββ package.json
β βββ vite.config.js
βββ README.md
PORT=5000
MONGODB_URI=mongodb://localhost:27017/taskmanagement
JWT_SECRET=your-super-secret-jwt-key-here
JWT_EXPIRE=30d
NODE_ENV=development
FRONTEND_URL=http://localhost:5173
Important:
- Replace
JWT_SECRETwith a strong, random string - Use a different database name for production
- Change
NODE_ENVtoproductionwhen deploying
{
name: String (required, 2-50 chars),
email: String (required, unique, valid email),
password: String (required, min 6 chars, hashed),
createdAt: Date (auto-generated)
}{
title: String (required, max 100 chars),
description: String (optional, max 500 chars),
priority: String (enum: ['Low', 'Medium', 'High'], default: 'Medium'),
status: String (enum: ['Todo', 'In Progress', 'Completed'], default: 'Todo'),
dueDate: Date (optional, cannot be in past),
userId: ObjectId (ref: 'User', required),
createdAt: Date (auto-generated),
updatedAt: Date (auto-updated)
}- Password Hashing: Uses bcrypt for secure password storage
- JWT Authentication: Stateless authentication with configurable expiration
- Protected Routes: Both frontend and backend route protection
- Input Validation: Comprehensive validation using express-validator
- CORS Configuration: Configured for cross-origin requests
- Error Handling: Centralized error handling with proper HTTP status codes
The application is fully responsive and works on:
- β Desktop (1200px+)
- β Tablet (768px - 1199px)
- β Mobile (320px - 767px)
- Set up MongoDB Atlas or your preferred MongoDB hosting
- Update
MONGODB_URIin production environment - Set strong
JWT_SECRET - Deploy to platforms like Heroku, Railway, or DigitalOcean
- Update API base URL in
src/services/api.js - Build the project:
npm run build - Deploy to platforms like Vercel, Netlify, or AWS S3
Authentication:
- User can register with valid credentials
- User cannot register with invalid email/password
- User can login with correct credentials
- User cannot access protected routes without token
- User can logout successfully
Task Management:
- User can create tasks with all fields
- User can view all their tasks
- User can edit existing tasks
- User can delete tasks
- User can filter tasks by status/priority
- User can search tasks by title/description
- Pagination works for large task lists
Dashboard:
- Statistics display correctly
- Priority breakdown shows accurate data
- Recent tasks are displayed
- Empty state shows when no tasks exist
If you encounter any issues or have questions:
- Check the troubleshooting section above
- Search existing issues in the repository
- Create a new issue with detailed description
- Contact the development team
Happy Task Managing! π―