Skip to content

Repository files navigation

Multi-Tenant Organization Workspace API

Project Overview

Multi-Tenant Organization Workspace API with RBAC supporting:

  • Roles: PLATFORM_ADMIN, ORG_ADMIN, MEMBER
  • Organizations: Platform Admin can create organizations; users scoped to org
  • Projects & Tasks: Org Admin manages projects/tasks within their org; Members see only assigned tasks
  • Business Rules: No cross-organization access; authorization enforced in services

Folder Structure

src/
 ├─ controllers/      # API routes
 ├─ services/         # Business logic & RBAC
 ├─ entities/         # TypeORM entities
 ├─ seed/             # DB seed scripts
 ├─ middlewares/      # JWT auth & error handling
 ├─ utils/            # Helpers
 ├─ constants/        # Config & env variables
 ├─ schemas/          # Request validation (Zod)
 └─ app.ts            # Express app setup
 └─ server.ts         # Entry point, DB init

Database & ER Diagram

This project uses PostgreSQL for:

  • Strong relational integrity and ACID compliance
  • Native support for UUID primary keys
  • Reliable enforcement of multi-tenant boundaries

TypeORM is used for entity mapping and migrations.

Entity Relationships

  • User → Organization (Many-to-One)
  • Project → Organization (Many-to-One)
  • Task → Project (Many-to-One)
  • Task → User (Many-to-One, assignee)

ER Diagram

ER Diagram


Authorization & Access Control

  • JWT authentication is required for all protected routes
  • Role-Based Access Control (RBAC) is enforced in the service layer, not in route files
  • Authorization rules:
    • Platform Admin: full system access
    • Organization Admin: manages users, projects, and tasks within their organization
    • Member: can only view tasks assigned to them
  • Cross-organization access is strictly blocked and returns 403 Access Denied

Postman Usage

A Postman collection is provided with:

  • Hosted API base URL (no localhost usage)
  • All endpoints pre-configured
  • JWT tokens saved for Platform Admin, Org Admin, and Member
  • Ready to test immediately after import

Recommended Test Flow:

  1. Login as Platform Admin
  2. Create Organization
  3. Create Organization Admin
  4. Create Members
  5. Create Projects
  6. Create Tasks
  7. Fetch data and verify role-based access

Submission Artifacts

Test Credentials

  • Platform Admin
    Email: admin@platform.com
    Password: Admin@123

  • Organization Admin
    Email: orgadmin@acme.com
    Password: OrgAdmin@123

  • Member
    Email: member1@acme.com
    Password: Member@123

About

A TypeScript REST API built with Express.js that enables multiple organizations to manage their users, projects, and tasks in fully isolated workspaces

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages