Skip to content

A comprehensive task management REST API built with NestJS, featuring authentication, real-time notifications, caching, and production-ready deployment configuration.

Notifications You must be signed in to change notification settings

ayevbeosa/task-management-api

Repository files navigation

Task Management API

A comprehensive task management REST API built with NestJS, featuring authentication, real-time notifications, caching, and production-ready deployment configuration.

🚀 Quick Start with Docker

# 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 app

That's it! 🎉

🚀 Features

  • 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

📋 Prerequisites

Option 1: Docker (Recommended)

  • Docker 20.10+
  • Docker Compose 2.0+

Option 2: Local Development

  • Node.js 18+
  • PostgreSQL 14+
  • Redis 6+

🛠️ Installation

Using Docker (Recommended)

# 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

Local Development

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env
# Edit .env with your configuration

# Start development server
npm run start:dev

🐳 Docker Commands

# 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 test

See DEPLOYMENT_GUIDE.md for detailed deployment instructions.


🔧 Configuration

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

🏃 Running the Application

# Development mode
npm run start:dev

# Production mode
npm run build
npm run start:prod

The API will be available at http://localhost:3000/api/v1

📚 API Documentation

Once the application is running, visit:

  • Swagger UI: http://localhost:3000/api/docs

🧪 Testing

# Unit tests
npm run test

# E2E tests
npm run test:e2e

# Test coverage
npm run test:cov

📦 Project Structure

src/
├── 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

🔐 Authentication

All protected endpoints require a Bearer token:

Authorization: Bearer <your-jwt-token>

👥 User Roles

  • ADMIN: Full system access
  • MANAGER: Can manage teams and assign tasks
  • USER: Can create and manage own tasks

🚢 Deployment

See Docker section below for containerized deployment.

🐳 Docker Support

# Build and run with Docker Compose
docker-compose up -d

📝 License

MIT

👨‍💻 Author

Ayevbeosa Iyamu

About

A comprehensive task management REST API built with NestJS, featuring authentication, real-time notifications, caching, and production-ready deployment configuration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published