A modern Task Management API built with Node.js, Express, MySQL, and containerized with Podman.
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Client App │───▶│ TaskTracker API │───▶│ MySQL Database │
│ (Frontend/ │ │ (Node.js/Express│ │ (Containerized) │
│ Mobile App) │ │ Containerized) │ │ │
└─────────────────┘ └──────────────────┘ └─────────────────┘
- ✅ MVC Architecture - Clean separation of concerns
- ✅ JWT Authentication - Stateless, secure authentication
- ✅ RESTful API - Standard HTTP methods and status codes
- ✅ Podman Containerization - Rootless, secure containers
- ✅ MySQL Database - Reliable data persistence
- ✅ Health Checks - Container and application monitoring
- ✅ Environment Configuration - 12-factor app principles
- Podman and Podman-compose installed
- Node.js 18+ (for local development)
- Git
- Clone and setup project:
git clone <your-repo-url>
cd task-tracker-api
npm install
- Configure environment:
cp .env.example .env
# Edit .env with your settings (default password: GMX@432)
- Start with Podman:
./scripts/deploy.sh up
- Test the API:
./scripts/test-api.sh
POST /api/auth/register
- Register new userPOST /api/auth/login
- User loginGET /api/auth/profile
- Get user profile (authenticated)PUT /api/auth/profile
- Update profile (authenticated)POST /api/auth/change-password
- Change password (authenticated)
GET /api/tasks
- List tasks (authenticated)POST /api/tasks
- Create task (authenticated)GET /api/tasks/:id
- Get specific task (authenticated)PUT /api/tasks/:id
- Update task (authenticated)DELETE /api/tasks/:id
- Delete task (authenticated)PATCH /api/tasks/:id/complete
- Mark task complete (authenticated)GET /api/tasks/stats
- Get task statistics (authenticated)GET /api/tasks/search?q=term
- Search tasks (authenticated)
GET /api/health
- Health checkGET /api
- API documentation
./scripts/deploy.sh up # Start all services
./scripts/deploy.sh down # Stop all services
./scripts/deploy.sh logs # View logs
./scripts/deploy.sh ps # Check status
./scripts/deploy.sh test # Run tests
./scripts/deploy.sh clean # Remove everything
# Start services
podman-compose -f containers/compose.yml up -d
# View logs
podman-compose -f containers/compose.yml logs -f api
# Stop services
podman-compose -f containers/compose.yml down
# Check container status
podman ps
The project includes comprehensive API tests:
# Run all tests
./scripts/test-api.sh
# Manual testing with curl
curl http://localhost:3008/api/health
curl -X POST http://localhost:3008/api/auth/register \
-H "Content-Type: application/json" \
-d '{"username":"testuser","email":"test@example.com","password":"password123"}'
- users - User accounts and authentication
- tasks - Task management with priorities and statuses
- categories - Task categorization (optional)
- task_categories - Many-to-many relationship
- Host: mysql (container name)
- Port: 3306
- Database: tasktracker
- User: taskuser
- Password: GMX@432 (configurable in .env)
# Install dependencies
npm install
# Start MySQL locally or use container
podman run -d --name mysql \
-e MYSQL_ROOT_PASSWORD=GMX@432 \
-e MYSQL_DATABASE=tasktracker \
-e MYSQL_USER=taskuser \
-e MYSQL_PASSWORD=GMX@432 \
-p 3306:3306 mysql:8.0
# Update .env for local development
# DB_HOST=localhost
# Start development server
npm run dev
task-tracker-api/
├── src/
│ ├── config/ # Database and app configuration
│ ├── controllers/ # Business logic (MVC)
│ ├── models/ # Data models (MVC)
│ ├── routes/ # API routes
│ ├── middleware/ # Authentication, validation
│ ├── views/ # Response helpers
│ ├── app.js # Express application setup
│ └── server.js # Server startup
├── database/
│ ├── init.sql # Database schema
│ └── seed.sql # Sample data
├── containers/
│ ├── Containerfile # Container image definition
│ ├── compose.yml # Multi-container orchestration
│ ├── mysql.cnf # MySQL configuration
│ └── nginx.conf # Reverse proxy config
├── scripts/
│ ├── deploy.sh # Deployment automation
│ ├── test-api.sh # API testing
│ └── wait-for-db.sh # Database readiness check
└── package.json # Node.js dependencies and scripts
- JWT Authentication - Secure, stateless tokens
- Password Hashing - bcrypt with configurable rounds
- Input Validation - Request sanitization and validation
- SQL Injection Prevention - Parameterized queries
- Security Headers - Helmet.js middleware
- Rootless Containers - Enhanced container security
- Environment Variables - Sensitive data protection
./scripts/deploy.sh up
- Update environment variables in .env
- Change Containerfile target to 'production'
- Enable nginx proxy in compose.yml
- Set up SSL/TLS certificates
- Configure monitoring and logging
Port already in use:
# Change port in .env file
PORT=3009
Database connection failed:
# Check MySQL container status
podman logs task-tracker-mysql
# Restart database
podman-compose -f containers/compose.yml restart mysql
API not responding:
# Check API logs
podman logs task-tracker-api
# Restart API
podman-compose -f containers/compose.yml restart api
# All service logs
podman-compose -f containers/compose.yml logs -f
# Specific service logs
podman logs task-tracker-api
podman logs task-tracker-mysql
# Enter container for debugging
podman exec -it task-tracker-api sh
- Connection pooling for database efficiency
- Request/response compression
- Proper indexing on database queries
- Health checks for container monitoring
- Graceful shutdown handling
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature
) - Commit changes (
git commit -m 'Add amazing feature'
) - Push to branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with modern containerization practices
- Follows 12-factor app methodology
- Implements RESTful API standards
- Uses secure authentication patterns