This guide will help you set up and run the enhanced Task Manager application with full-stack features.
Before you begin, ensure you have the following installed:
- Node.js (v16 or higher) - Download
- MongoDB - Download or use MongoDB Atlas (cloud)
- npm or yarn - Package manager (comes with Node.js)
- Git (optional) - For version control
# macOS (using Homebrew)
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
# Ubuntu/Debian
sudo apt-get install mongodb
sudo systemctl start mongodb
# Windows
# Download installer from https://www.mongodb.com/try/download/community
# Follow the installation wizard- Go to MongoDB Atlas
- Create a free account
- Create a new cluster
- Get your connection string
- Update
backend/.envwith your connection string
# Navigate to backend directory
cd task-manager/backend
# Install dependencies
npm install
# Configure environment variables
# Copy .env.example to .env
cp .env.example .env
# Edit .env file with your settings
# (If using MongoDB Atlas, update MONGO_URI)
# Start the backend server
npm run devThe backend server will start on http://localhost:5000
You should see:
Server running in development mode on port 5000
MongoDB Connected: localhost
# Navigate to project root
cd task-manager
# Install dependencies
npm install
# Configure environment variables
# Copy .env.example to .env
cp .env.example .env
# Start the frontend development server
npm run devThe frontend will start on http://localhost:5173
# Server Configuration
PORT=5000
NODE_ENV=development
# Database (Local)
MONGO_URI=mongodb://localhost:27017/task-manager
# Database (MongoDB Atlas - Example)
# MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/task-manager
# JWT Secret (Change this in production!)
JWT_SECRET=task_manager_secret_key_2025_dev
JWT_EXPIRE=7d
# File Upload
MAX_FILE_SIZE=5242880
UPLOAD_PATH=./uploads
# CORS
CLIENT_URL=http://localhost:5173VITE_API_URL=http://localhost:5000/api
VITE_SOCKET_URL=http://localhost:5000task-manager/
├── backend/ # Backend API
│ ├── src/
│ │ ├── config/ # Database configuration
│ │ ├── controllers/ # Route controllers
│ │ ├── middleware/ # Auth & upload middleware
│ │ ├── models/ # Mongoose models
│ │ ├── routes/ # API routes
│ │ ├── utils/ # Utility functions
│ │ └── server.ts # Main server file
│ ├── uploads/ # File uploads (auto-created)
│ ├── .env # Environment variables
│ ├── .env.example # Environment template
│ ├── package.json
│ ├── tsconfig.json
│ └── README.md
│
├── src/ # Frontend source
│ ├── components/ # React components
│ ├── contexts/ # React contexts
│ ├── pages/ # Page components
│ ├── services/ # API & Socket services
│ │ ├── api.ts # REST API client
│ │ └── socket.ts # WebSocket client
│ ├── types/ # TypeScript types
│ ├── utils/ # Utility functions
│ └── App.tsx
│
├── .env # Frontend environment variables
├── .env.example # Environment template
├── package.json
├── vite.config.ts
├── IMPLEMENTATION_STATUS.md # Development progress
└── SETUP_GUIDE.md # This file
Open a browser or use curl/Postman:
# Health check
curl http://localhost:5000/api/health
# Expected response:
# {"success":true,"message":"Server is running"}Open browser: http://localhost:5173
You should see the Task Manager login page.
- Click "Register"
- Fill in the form:
- Name: Test User
- Email: test@example.com
- Password: password123
- Click "Create Account"
Note: Currently the frontend still uses localStorage. Backend integration is in progress.
POST http://localhost:5000/api/auth/register
Content-Type: application/json
{
"name": "John Doe",
"email": "john@example.com",
"password": "password123"
}POST http://localhost:5000/api/auth/login
Content-Type: application/json
{
"email": "john@example.com",
"password": "password123"
}Save the token from the response!
GET http://localhost:5000/api/tasks
Authorization: Bearer YOUR_TOKEN_HEREEach task can now have multiple subtasks with completion tracking.
API Example:
POST http://localhost:5000/api/tasks/:taskId/subtasks
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"title": "Subtask title"
}Create and assign multiple tags to tasks for better organization.
API Example:
POST http://localhost:5000/api/tags
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"name": "Urgent",
"color": "#FF0000"
}Set tasks to repeat on a schedule (daily, weekly, monthly, yearly).
Task Creation with Recurrence:
{
"title": "Weekly Team Meeting",
"description": "Discuss progress",
"categoryId": "...",
"priorityId": "...",
"dueDate": "2025-10-21",
"status": "pending",
"recurrence": {
"frequency": "weekly",
"interval": 1,
"daysOfWeek": [1, 3, 5],
"endDate": "2025-12-31"
}
}Upload and attach files to tasks.
Upload Example:
POST http://localhost:5000/api/upload
Authorization: Bearer YOUR_TOKEN
Content-Type: multipart/form-data
file: [select file]Tasks automatically sync across all connected clients via WebSocket.
Error: MongoNetworkError: connect ECONNREFUSED
Solution:
# Check if MongoDB is running
# macOS
brew services list
# Ubuntu/Linux
sudo systemctl status mongodb
# Start MongoDB if not running
# macOS
brew services start mongodb-community
# Ubuntu/Linux
sudo systemctl start mongodbError: Port 5000 is already in use
Solution:
# Find process using port 5000
lsof -i :5000
# Kill the process
kill -9 <PID>
# Or change PORT in backend/.env
PORT=5001Error: Access to XMLHttpRequest has been blocked by CORS policy
Solution:
Check that CLIENT_URL in backend/.env matches your frontend URL:
CLIENT_URL=http://localhost:5173Solution:
# Delete node_modules and reinstall
rm -rf node_modules package-lock.json
npm installcd backend
npm run devThe server will automatically restart on file changes (using ts-node-dev).
npm run devVite will provide hot module replacement (HMR) for instant updates.
cd backend
npm run build # Compiles TypeScript to dist/
npm start # Runs production servernpm run build # Creates optimized build in dist/
npm run preview # Preview production build locally- Change JWT Secret: Always use a strong, unique JWT_SECRET in production
- Environment Variables: Never commit .env files to version control
- MongoDB: Use strong passwords and enable authentication
- CORS: Configure CLIENT_URL properly for production
- File Uploads: Validate file types and sizes on both client and server
# Install Heroku CLI
# Login to Heroku
heroku login
# Create app
heroku create task-manager-backend
# Set environment variables
heroku config:set JWT_SECRET=your_production_secret
heroku config:set MONGO_URI=your_mongodb_atlas_uri
# Deploy
git push heroku main# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Set environment variables in Vercel dashboard
# VITE_API_URL=https://your-backend.herokuapp.com/api
# VITE_SOCKET_URL=https://your-backend.herokuapp.comThis is a personal project, but feel free to:
- Report bugs
- Suggest features
- Submit pull requests
MIT License - Feel free to use this project for learning or personal use.
Check IMPLEMENTATION_STATUS.md for the current development progress and upcoming features.
The next major milestone is integrating the frontend contexts with the backend API to replace the localStorage implementation.
- Use MongoDB Compass for a GUI to view your database
- Use Postman or Thunder Client (VS Code extension) for API testing
- Check browser console and Network tab for debugging
- Monitor backend logs for server errors
- Use React DevTools for component debugging
If you encounter issues:
- Check this guide carefully
- Review
IMPLEMENTATION_STATUS.md - Check backend logs (terminal running
npm run dev) - Check browser console for frontend errors
- Verify environment variables are correct
Happy coding! 🚀