Skip to content

morel-source/Scalable-Task-Management-Api

Repository files navigation

Scalable Task Management API

A professional, scalable backend API built with Node.js, Express, TypeScript, and MongoDB. This project follows clean architecture principles and is designed for production-readiness.


Features

  • Authentication: JWT Access + Refresh token implementation.
  • Authorization: Role-Based Access Control (User vs. Admin).
  • Architecture: Clean Architecture (Controller → Service → Repository).
  • Testing: Comprehensive Unit & Integration tests using Vitest + Supertest.
  • Documentation: Auto-generated Swagger (OpenAPI 3.0) documentation.
  • Security: Rate limiting, Helmet, and centralized error handling.
  • Data: MongoDB integration with Mongoose.
  • Querying: Support for pagination, filtering, and sorting.

Tech Stack

  • Runtime: Node.js
  • Framework: Express
  • Language: TypeScript
  • Database: MongoDB + Mongoose
  • Testing: Vitest, Supertest.
  • Documentation: Swagger (OpenAPI 3.0)

Installation

Clone the repository and install the dependencies:

git clone <repository-url>
cd ScalableTaskManagementApi
npm install

Environment Variables

Create a .env file in the root directory and configure the following variables:

PORT=3333
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_access_secret
REFRESH_SECRET=your_jwt_refresh_secret

How To Run

# 1. Start the database using Docker
docker-compose up -d

# 2. Run the application in development mode
npm run dev

API Documentation

Once the server is running, you can access the interactive API documentation at:

👉 http://localhost:3333/api/docs

Swagger UI Screen


Authentication Flow

  1. Register: Send a POST request to /users/register.
  2. Login: Send a POST request to /users/login to receive accessToken and refreshToken.
  3. Authorize: Include your token in the request header for protected routes:
Authorization: Bearer <accessToken>

Roles:

  • user: Can manage own tasks.
  • admin: Full access, including deleting any task.

Notes

  • Built with a scalable DI-pattern architecture.
  • Modular design for easy maintenance and testing.
  • Ready for production deployment.

Releases

No releases published

Packages

 
 
 

Contributors