This project facilitates a robust Multi-Tenant Role-Based Access Control system using Express and TypeScript. Here's a breakdown of its key functionalities:
-
User Registration to Tenants: Users can register to a tenant, which can represent various entities such as a store, a merchant, or any other applicable entity.
-
Tenant Owner Privileges: Owners of a tenant have the authority to invite other users to join their tenant.
-
Role and Permission Assignment: Tenant owners possess the ability to assign roles and permissions, including specific scopes, to users within their tenant.
-
Flexible User Role Configuration: Users can be assigned multiple roles and permissions within a tenant, granting them varying degrees of access to different modules and resources.
-
Scalability and Customization: The codebase is designed to be easily extendable, allowing for the creation of custom modules tailored to specific project business requirements.
To set up the environment for this project, follow these steps:
-
Clone the repository to your local machine.
-
Create a
.env.prod
file based on the provided.env.example
. This file contains essential configurations for setting up local services. -
Ensure that the environment variables are correctly configured, as there is a validation layer in place. Incorrect configurations may lead to application crashes.
-
Start the production-ready application by running the following command:
- production
docker-compose -f docker-compose.prod.yml up --build
- development:
For a development environment, create a
.env.dev
file and run:docker-compose -f docker-compose.dev.yml up --build
- production
5- To facilitate API testing and view API signatures, import the thundr.client.json file into the Thunder Client extension for Visual Studio Code.
This project leverages the following technologies:
- Node.js and Express.js: For server-side development.
- TypeScript: To enhance code readability and maintainability.
- PostgreSQL: As the database management system.
- Drizzle ORM: For object-relational mapping.
- JWT Authentication: For secure user authentication.
- Pino: A logging library for Node.js applications.
- Docker and Docker Compose: For containerization and orchestration.
- Zod: A TypeScript-first schema declaration and validation library.
- bcryptjs: For password hashing.
- Prettier and ESLint: For code formatting and linting.
- Lefthook: A Git hooks manager.
For more detailed documentation, refer to the Project Documentation.
The documentation provides detailed insights into the architecture, modules, and instructions on extending the project based on your specific project requirements.