morka17 / multi-tenant-user-role-base-app

This is a multi-tenant user-role-based application written in Node.js, TypeScript, Fastify, PostgreSQL, and JWT. It allows you to create and manage multiple tenants, users, and roles. Each tenant is isolated from the others, and users can only access the resources of the tenant to which they belong.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multi Tenant Role Based Access Control (RBAC) Authentication API

Multi-Tenant User-Role-Based Application

This is a multi-tenant user-role-based application written in Node.js, TypeScript, Fastify, PostgreSQL, and JWT. It allows you to create and manage multiple tenants, users, and roles. Each tenant is isolated from the others, and users can only access the resources of the tenant to which they belong.

Data structure

"data structure"

App structure

"app structure"

Features

  • Multi-tenancy: Each tenant has its own database schema and data.
  • User roles: Users can be assigned to different roles, each with its own permissions.
  • JWT authentication: Users are authenticated using JWT tokens.
  • Fastify: Fastify is a high-performance web framework for Node.js.
  • TypeScript: TypeScript is a superset of JavaScript that adds type safety and other features.
  • PostgreSQL: PostgreSQL is a powerful and reliable relational database management system.

Technology used

  • Dizzle ORM
  • Fastify
  • PostgresSQL
  • TypeScript

How to use

  1. Clone the repository.
  2. Install the dependencies:
    npm install
  1. Create a .env file with the following contents:
    DATABASE_CONNECTION=postgres://********:*********8*@ep-fragrant-dream-75256343-pooler.us-east-1.aws.neon.tech/neondb
    JWT_SECRET=secret
  1. Start the server:
    npm run dev

The server will be running on port 3000.

Conclusion

This multi-tenant user-role-based application is a powerful and flexible tool for managing multiple tenants, users, and roles. It is built using modern technologies and is easy to use.

About

This is a multi-tenant user-role-based application written in Node.js, TypeScript, Fastify, PostgreSQL, and JWT. It allows you to create and manage multiple tenants, users, and roles. Each tenant is isolated from the others, and users can only access the resources of the tenant to which they belong.


Languages

Language:TypeScript 97.7%Language:Makefile 2.3%