A modern, production-ready task management application built with the MERN stack (MongoDB, Express.js, React, Node.js). Features secure authentication, real-time task management, and a responsive UI.
- Frontend: https://tasktracker-b06.pages.dev
- Backend API: https://tasktracker-production-fae7.up.railway.app
- Health Check: https://tasktracker-production-fae7.up.railway.app/health
Note: The application is deployed on Cloudflare Pages (frontend) and Railway (backend) with MongoDB Atlas as the database.
- 🔐 Secure Authentication - JWT-based auth with bcrypt password hashing
- ✅ Task Management - Create, read, update, and delete tasks
- 🎯 Status Tracking - Mark tasks as pending or completed
- 🔍 Smart Filtering - Filter tasks by status (all/pending/completed)
- 📱 Responsive Design - Mobile-friendly interface
- 🛡️ Input Validation - Client and server-side validation
- ⚡ Rate Limiting - API protection against abuse
- 🔒 Security Headers - Helmet.js for enhanced security
- 🌐 CORS Protection - Configurable origin whitelist
- 💾 MongoDB Atlas - Cloud database with connection pooling
- 🚀 Production Ready - Optimized for deployment
- React 18 - UI library
- React Router v6 - Client-side routing
- Axios - HTTP client with interceptors
- CSS3 - Modern styling with gradients and animations
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - NoSQL database
- Mongoose - ODM for MongoDB
- JWT - Token-based authentication
- bcryptjs - Password hashing
- Helmet - Security headers
- express-validator - Input validation
- express-rate-limit - Rate limiting
- Morgan - HTTP request logger
task-tracker/
├── client/ # React frontend
│ ├── public/
│ │ └── index.html
│ ├── src/
│ │ ├── components/
│ │ │ └── ProtectedRoute.js
│ │ ├── pages/
│ │ │ ├── Login.js
│ │ │ ├── Login.css
│ │ │ ├── Dashboard.js
│ │ │ └── Dashboard.css
│ │ ├── utils/
│ │ │ └── api.js # API client with interceptors
│ │ ├── App.js
│ │ ├── index.js
│ │ └── index.css
│ ├── package.json
│ └── .env.example
│
├── server/ # Node.js backend
│ ├── config/
│ │ └── database.js # MongoDB connection with retry logic
│ ├── middleware/
│ │ ├── auth.js # JWT authentication
│ │ ├── errorHandler.js # Global error handler
│ │ └── validators.js # Input validation rules
│ ├── models/
│ │ ├── User.js
│ │ └── Task.js
│ ├── routes/
│ │ ├── auth.js # Authentication routes
│ │ └── tasks.js # Task CRUD routes
│ ├── server.js # Main server file
│ ├── package.json
│ └── .env.example
│
├── .gitignore
├── package.json # Root package.json for scripts
├── wrangler.toml # Cloudflare Workers config
└── README.md
- Node.js (v16 or higher)
- MongoDB Atlas account (or local MongoDB)
- npm or yarn
Clone the repository
git clone https://github.com/yooniqx/TaskTracker.git cd TaskTrackerInstall all dependencies
npm run install:all
Or install separately:
# Install root dependencies npm install # Install server dependenciescd server && npm install # Install client dependenciescd ../client && npm install
Set up environment variables
Server (
server/.env):NODE_ENV=developmentPORT=5000MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/tasktracker?retryWrites=true&w=majorityJWT_SECRET=your_super_secret_jwt_key_change_this_in_productionALLOWED_ORIGINS=http://localhost:3000RATE_LIMIT_WINDOW_MS=900000RATE_LIMIT_MAX_REQUESTS=100
Client (
client/.env):REACT_APP_API_URL=http://localhost:5000/api
Start the development servers
# From root directory - runs both frontend and backend npm run devOr run separately:
# Terminal 1 - Backend (from root) npm run server # Terminal 2 - Frontend (from root) npm run client
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
- Health Check: http://localhost:5000/health
npm run install:all- Install all dependencies (root, server, client)npm run dev- Run both frontend and backend concurrentlynpm run server- Run backend onlynpm run client- Run frontend onlynpm run build- Build frontend for productionnpm run start:prod- Start backend in production mode
npm start- Start server in production modenpm run dev- Start server with nodemon (auto-reload)
npm start- Start development servernpm run build- Build for productionnpm test- Run tests
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/auth/register | Register new user | No |
| POST | /api/auth/login | Login user | No |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/tasks | Get all user tasks | Yes |
| POST | /api/tasks | Create new task | Yes |
| PUT | /api/tasks/:id | Update task | Yes |
| DELETE | /api/tasks/:id | Delete task | Yes |
| PATCH | /api/tasks/:id/toggle | Toggle task status | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /health | Health check | No |
This application is currently deployed and running in production:
- Frontend: Cloudflare Pages - https://tasktracker-b06.pages.dev
- Backend: Railway - https://tasktracker-production-fae7.up.railway.app
- Database: MongoDB Atlas (Cloud)
Fork this repository on GitHub
Go to Cloudflare Pages
- Visit https://dash.cloudflare.com
- Navigate to Workers & Pages → Create application → Pages
- Click "Connect to Git"
Configure Build Settings
- Framework preset: React (Vite) or None
- Build command:
cd client && npm install && npm run build - Build output directory:
client/build - Root directory: Leave empty
Add Environment Variable
- Variable name:
REACT_APP_API_URL - Value:
https://your-backend-url.railway.app/api
- Variable name:
Deploy - Cloudflare will build and deploy your app (takes 3-5 minutes)
Create Railway Account
- Visit https://railway.app
- Sign up with GitHub
Create New Project
- Click "New Project"
- Select "Deploy from GitHub repo"
- Choose your forked repository
Configure Environment Variables
NODE_ENV=productionPORT=8080MONGODB_URI=your_mongodb_atlas_connection_stringJWT_SECRET=your_super_secret_jwt_key_min_32_charsALLOWED_ORIGINS=https://your-frontend-url.pages.devRATE_LIMIT_WINDOW_MS=900000RATE_LIMIT_MAX_REQUESTS=100
Configure Networking
- Go to Settings → Networking
- Set port to
8080(or your PORT value) - Railway will provide a public URL
Deploy - Railway will automatically deploy on every push to main branch
- Trust Proxy: The backend includes
app.set('trust proxy', 1)for Railway deployment - CORS: Update
ALLOWED_ORIGINSwith your Cloudflare Pages URL (without/loginor any path) - MongoDB: Use MongoDB Atlas connection string with proper credentials
- JWT Secret: Use a strong, random secret (minimum 32 characters)
- Create a free cluster at https://www.mongodb.com/cloud/atlas
- Create a database user
- Whitelist your IP (or use 0.0.0.0/0 for all IPs in production)
- Get your connection string
- Replace
<username>,<password>, and<cluster>in the connection string
- ✅ JWT token authentication with 24-hour expiry
- ✅ Password hashing with bcrypt (12 rounds)
- ✅ Input validation on client and server
- ✅ Rate limiting (100 requests per 15 minutes)
- ✅ CORS protection with origin whitelist
- ✅ Security headers via Helmet.js
- ✅ MongoDB injection prevention
- ✅ XSS protection
- ✅ Request timeout handling
- ✅ Graceful error handling
Backend:
MONGODB_URI- MongoDB connection stringJWT_SECRET- Secret key for JWT signingNODE_ENV- Environment (development/production)PORT- Server port (default: 5000)ALLOWED_ORIGINS- Comma-separated list of allowed origins
Frontend:
REACT_APP_API_URL- Backend API URL
RATE_LIMIT_WINDOW_MS- Rate limit window (default: 900000ms)RATE_LIMIT_MAX_REQUESTS- Max requests per window (default: 100)
# Run frontend testscd client
npm testMongoDB Connection Error
- Verify your MongoDB URI is correct
- Check if your IP is whitelisted in MongoDB Atlas
- Ensure network connectivity
CORS Error
- Add your frontend URL to
ALLOWED_ORIGINSin backend.env - Check if backend is running
- Add your frontend URL to
Authentication Issues
- Clear browser localStorage
- Verify JWT_SECRET is set
- Check token expiry
Port Already in Use
- Change PORT in server/.env
- Kill process using the port:
npx kill-port 5000
This project is licensed under the MIT License - see the LICENSE file for details.
Debopriya Bose
- GitHub: @yooniqx
- Repository: TaskTracker
Contributions, issues, and feature requests are welcome!
- Fork the project
- 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
Give a ⭐️ if this project helped you!
For support, email dbose0906@gmail.com or open an issue in the repository.
Built with ❤️ using the MERN Stack