TaskFlow is a full-stack MERN (MongoDB, Express.js, React, Node.js) task management application that provides a comprehensive solution for organizing and tracking tasks. The application features role-based authentication, real-time task management, administrative controls, and detailed user activity logging.
- JWT-Based Authentication: Secure token-based authentication system
- Role-Based Access Control: User and Admin roles with different permissions
- Protected Routes: Authentication-first routing with automatic redirects
- Password Reset: Forgot password functionality with email verification
- Session Management: Automatic token refresh and logout handling
- CRUD Operations: Create, read, update, and delete tasks
- Task Filtering: Filter tasks by status (completed/incomplete), priority, and search by title
- Task Analytics: Visual progress tracking and completion statistics
- Due Date Management: Set and track task deadlines
- Priority Levels: High, Medium, Low priority classification
- Real-time Updates: Instant task status updates across the application
- User Management: View and manage all registered users
- Task Analytics: Comprehensive task statistics and insights
- User Activity Logs: Track user login/logout times, IP addresses, and JWT tokens
- Bulk Operations: Delete multiple user logs simultaneously
- Advanced Filtering: Filter logs by action, role, email, and date ranges
- Modern Design: Clean, responsive UI built with TailwindCSS
- Dark/Light Mode: Adaptive theme support
- Mobile Responsive: Optimized for all device sizes
- Interactive Components: Modal dialogs, notifications, and real-time feedback
- Intuitive Navigation: Sidebar navigation with role-based menu items
- React 18: Modern React with Hooks and Context API
- React Router: Client-side routing with protected routes
- TailwindCSS: Utility-first CSS framework
- React Icons: Comprehensive icon library
- React Toastify: Toast notifications
- Axios: HTTP client for API requests
- Node.js: JavaScript runtime environment
- Express.js: Web application framework
- MongoDB: NoSQL database with Mongoose ODM
- JWT: JSON Web Tokens for authentication
- bcryptjs: Password hashing and encryption
- CORS: Cross-origin resource sharing middleware
- dotenv: Environment variable management
- Node.js (v20.14.0 or higher)
- npm (v10.7.0 or higher)
- MongoDB (local installation or MongoDB Atlas)
-
Clone the repository
git clone <repository-url> cd react_node_test
-
Install frontend dependencies
npm install
-
Install backend dependencies
cd server npm install cd ..
-
Environment Configuration
Create a
.envfile in theserverdirectory:PORT=5050 MONGODB_URI=mongodb://localhost:27017/taskflow JWT_SECRET=your_super_secure_jwt_secret_here JWT_EXPIRES_IN=7d NODE_ENV=development
-
Start MongoDB
Make sure MongoDB is running on your system:
# For macOS with Homebrew brew services start mongodb-community # For Linux sudo systemctl start mongod # For Windows net start MongoDB
-
Run the application
Start the backend server:
cd server npm run devIn a new terminal, start the frontend:
npm run dev
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:5050
react_node_test/
βββ public/ # Static assets
βββ src/ # Frontend source code
β βββ components/ # Reusable React components
β β βββ admin/ # Admin-specific components
β β βββ auth/ # Authentication components
β β βββ common/ # Shared UI components
β β βββ tasks/ # Task-related components
β β βββ user/ # User-specific components
β βββ contexts/ # React Context providers
β βββ hooks/ # Custom React hooks
β βββ pages/ # Page components
β β βββ AdminPages/ # Admin dashboard pages
β β βββ UserPages/ # User dashboard pages
β βββ utils/ # Utility functions and API calls
β βββ main.jsx # Application entry point
βββ server/ # Backend source code
β βββ src/
β β βββ controller/ # Request handlers
β β βββ middleware/ # Custom middleware
β β βββ models/ # MongoDB schemas
β β βββ routes/ # API route definitions
β β βββ index.js # Server entry point
β βββ package.json # Backend dependencies
βββ README.md # Project documentation
| Method | Endpoint | Description | Body |
|---|---|---|---|
| POST | /api/auth/register |
Register new user | { email, password, firstName, lastName } |
| POST | /api/auth/login |
User login | { email, password } |
| POST | /api/auth/logout |
User logout | {} |
| POST | /api/auth/forgot-password |
Request password reset | { email } |
| POST | /api/auth/reset-password |
Reset password | { token, newPassword } |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/tasks |
Get user tasks with filters | Yes |
| GET | /api/tasks/:id |
Get specific task | Yes |
| POST | /api/tasks |
Create new task | Yes |
| PUT | /api/tasks/:id |
Update task | Yes |
| PATCH | /api/tasks/:id/status |
Update task status | Yes |
| DELETE | /api/tasks/:id |
Delete task | Yes |
| GET | /api/tasks/stats/summary |
Get task statistics | Yes |
status: Filter by completion status (completed,pending)priority: Filter by priority level (high,medium,low)search: Search tasks by titlepage: Pagination page numberlimit: Number of results per page
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/admin/users |
Get all users | Admin only |
| GET | /api/admin/tasks |
Get all tasks | Admin only |
| GET | /api/user-logs |
Get user activity logs | Admin only |
| DELETE | /api/user-logs/:id |
Delete specific log | Admin only |
| DELETE | /api/user-logs/bulk |
Delete multiple logs | Admin only |
- Registration/Login: Create an account or login with existing credentials
- Task Creation: Use the "+" button to create new tasks with title, description, priority, and due date
- Task Management: Mark tasks as complete, edit details, or delete tasks
- Filtering: Use the filter options to view tasks by status or search by title
- Profile: View and update your profile information
- Admin Dashboard: Access comprehensive analytics and user management
- User Management: View all registered users and their activity
- Task Analytics: Monitor task completion rates and user productivity
- User Logs: Track user login/logout activities, session durations, and IP addresses
- Bulk Operations: Manage multiple user logs efficiently
- Password Hashing: bcryptjs for secure password storage
- JWT Authentication: Stateless authentication with secure tokens
- CORS Protection: Configured cross-origin resource sharing
- Input Validation: Server-side validation for all inputs
- Protected Routes: Authentication middleware on sensitive endpoints
- Role-Based Access: Admin-only endpoints and features
npm run build
# Deploy to Vercel or your preferred platform# Set environment variables on your platform
# Deploy using your platform's CLI or Git integrationPORT=5050
MONGODB_URI=<your-mongodb-atlas-uri>
JWT_SECRET=<strong-random-secret>
JWT_EXPIRES_IN=7d
NODE_ENV=production- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Commit your changes:
git commit -m 'Add new feature' - Push to the branch:
git push origin feature/new-feature - Submit a pull request
- Use MongoDB Compass for database visualization
- Install React Developer Tools for debugging
- Use Postman for API testing
- Check browser console for frontend errors