A backend API for task tracking and team collaboration built with Node.js, Express, MySQL, and Socket.io.
- User authentication with session management
- Task CRUD operations with filtering and search
- Team/project collaboration
- Comments and file attachments
- Real-time WebSocket notifications
- RESTful API design
- Backend: Node.js, Express.js
- Database: MySQL, Sequelize ORM
- Authentication: express-session, bcrypt
- Real-time: Socket.io
- File Upload: multer
- Validation: express-validator
- Node.js (v14+)
- MySQL (v5.7+)
- Clone and install dependencies
git clone <repository-url>
cd AirTribeModule6
npm install- Set up MySQL database
mysql -u root -p
CREATE DATABASE task_tracking_db;
exit;- Configure environment
cp env.example .envEdit .env and update:
DB_PASSWORD=your_mysql_password
SESSION_SECRET=your_random_secret_key- Start the server
# Development mode
npm run dev
# Production mode
npm startServer will run on http://localhost:3000
POST /api/auth/register- Register new userPOST /api/auth/login- LoginPOST /api/auth/logout- LogoutGET /api/auth/me- Get current user
POST /api/tasks- Create taskGET /api/tasks- Get all tasks (supports filters: status, assignedTo, teamId, search)GET /api/tasks/:id- Get task by IDPUT /api/tasks/:id- Update taskDELETE /api/tasks/:id- Delete taskPATCH /api/tasks/:id/complete- Mark as completedPATCH /api/tasks/:id/assign- Assign to user
POST /api/teams- Create teamGET /api/teams- Get all teamsGET /api/teams/:id- Get team detailsPUT /api/teams/:id- Update teamDELETE /api/teams/:id- Delete teamPOST /api/teams/:id/members- Add memberDELETE /api/teams/:id/members/:userId- Remove memberGET /api/teams/:id/tasks- Get team tasks
POST /api/tasks/:taskId/comments- Add commentGET /api/tasks/:taskId/comments- Get commentsDELETE /api/tasks/:taskId/comments/:commentId- Delete commentPOST /api/tasks/:taskId/attachments- Upload fileGET /api/tasks/:taskId/attachments- Get attachmentsGET /api/tasks/:taskId/attachments/:id/download- Download fileDELETE /api/tasks/:taskId/attachments/:id- Delete attachment
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "password123",
"firstName": "John",
"lastName": "Doe"
}'curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-c cookies.txt \
-d '{
"email": "user@example.com",
"password": "password123"
}'curl -X POST http://localhost:3000/api/tasks \
-H "Content-Type: application/json" \
-b cookies.txt \
-d '{
"title": "Implement feature",
"description": "Build new feature",
"priority": "high",
"dueDate": "2024-12-31"
}'curl -X GET "http://localhost:3000/api/tasks?status=open&search=feature" \
-b cookies.txtconst socket = io('http://localhost:3000');
// Register user for notifications
socket.emit('register', userId);
// Listen for notifications
socket.on('notification', (data) => {
console.log('Notification:', data);
});├── config/ # Database & session config
├── controllers/ # Business logic
├── middleware/ # Auth, validation, errors
├── models/ # Sequelize models
├── routes/ # API routes
├── utils/ # Helper functions
├── uploads/ # File storage
└── server.js # Main app
PORT=3000
NODE_ENV=development
DB_HOST=localhost
DB_PORT=3306
DB_NAME=task_tracking_db
DB_USER=root
DB_PASSWORD=your_password
SESSION_SECRET=your_secret_key
SESSION_MAX_AGE=86400000
MAX_FILE_SIZE=10485760
UPLOAD_DIR=uploads
CORS_ORIGIN=http://localhost:3000ISC