A comprehensive task management REST API built with NestJS, featuring authentication, real-time notifications, caching, and production-ready deployment configuration.
# Clone the repository
git clone https://github.com/ayevbeosa/task-management-api.git
cd task-management-api
# Copy environment file
cp .env.example .env
# Start all services (PostgreSQL + Redis + API)
docker-compose up -d
# Check status
docker-compose ps
# View logs
docker-compose logs -f appThat's it! 🎉
- API: http://localhost:3000
- Docs: http://localhost:3000/api/docs
- Health: http://localhost:3000/api/v1/health
- Authentication & Authorization: JWT-based auth with role-based access control
- Real-Time Updates: WebSocket notifications for live collaboration
- Database: PostgreSQL with TypeORM for robust data management
- Caching: Redis integration for improved performance
- Documentation: Auto-generated Swagger/OpenAPI docs
- Testing: Unit and E2E test setup
- Docker: Production-ready containerization
- CI/CD: GitHub Actions pipeline included
Option 1: Docker (Recommended)
- Docker 20.10+
- Docker Compose 2.0+
Option 2: Local Development
- Node.js 18+
- PostgreSQL 14+
- Redis 6+
# Development mode with hot reload
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
# Production mode
docker-compose up -d
# With Make commands
make dev # Development
make prod # Production
make logs # View logs# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Start development server
npm run start:dev# Start all services
docker-compose up -d
# Stop all services
docker-compose down
# View logs
docker-compose logs -f
# Rebuild after changes
docker-compose up -d --build
# Access database
docker-compose exec postgres psql -U postgres -d task_management
# Run tests in container
docker-compose exec app npm testSee DEPLOYMENT_GUIDE.md for detailed deployment instructions.
Create a .env file with the following variables:
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE=task_management
JWT_SECRET=your-super-secret-jwt-key
JWT_EXPIRATION=7d
REDIS_HOST=localhost
REDIS_PORT=6379
PORT=3000
NODE_ENV=development# Development mode
npm run start:dev
# Production mode
npm run build
npm run start:prodThe API will be available at http://localhost:3000/api/v1
Once the application is running, visit:
- Swagger UI:
http://localhost:3000/api/docs
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:covsrc/
├── auth/ # Authentication module
├── users/ # User management
├── tasks/ # Task CRUD operations
├── comments/ # Task comments
├── notifications/ # WebSocket gateway
├── common/ # Shared utilities
│ ├── decorators/ # Custom decorators
│ ├── guards/ # Auth & role guards
│ ├── filters/ # Exception filters
│ ├── interceptors/ # Response transformers
│ └── dto/ # Common DTOs
└── health/ # Health check
All protected endpoints require a Bearer token:
Authorization: Bearer <your-jwt-token>
- ADMIN: Full system access
- MANAGER: Can manage teams and assign tasks
- USER: Can create and manage own tasks
See Docker section below for containerized deployment.
# Build and run with Docker Compose
docker-compose up -dMIT