https://github.com/TomDoesTech/user-api
https://github.com/TomDoesTech/user-api
drizzle-orm multitenancy nodejs typescript
Last synced: 13 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/TomDoesTech/user-api
- Owner: TomDoesTech
- Created: 2023-05-20T21:25:07.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-28T22:51:40.000Z (almost 2 years ago)
- Last Synced: 2025-03-22T12:32:36.475Z (23 days ago)
- Topics: drizzle-orm, multitenancy, nodejs, typescript
- Language: TypeScript
- Homepage: https://youtu.be/b6VhN_HHDiQ
- Size: 117 KB
- Stars: 71
- Watchers: 3
- Forks: 23
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - TomDoesTech/user-api - (TypeScript)
README
# Multi Tenant Role Based Access Control (RBAC) Authentication API
## Sponsor
Thank you to [Neon](https://bit.ly/tomdoestech) for sponsoring this video!
## Features
* Create an application
* Register a user for an application
* Login
* Create a role
* Assign a role to a user* Check user permissions with a guard
## What are we using?
* [Drizzle ORM](https://github.com/drizzle-team/drizzle-orm)
* [Fastify](https://www.fastify.io/)
* [PostgreSQL](https://www.postgresql.org/)
* [TypeScript](https://www.typescriptlang.org/)## What you'll need
* Editor - [VS Code](https://code.visualstudio.com/download)
* Node.js - [Download](https://nodejs.org/en/download/)
* A database - [PostgreSQL by Neon](https://bit.ly/tomdoestech)
* A REST client - [Thunder Client](https://marketplace.visualstudio.com/items?itemName=rangav.vscode-thunder-client)## What you will learn
* How to create a multi tenant application
* How to create a role based access control system
* Some basic relational database concepts
* A nice and neat file structure for backend services
* TypeScript
* Fastify
* RESTful API design
* How to use Drizzle ORM## Data structure
## Data flow
## Video structure
1. Setup the initial application
2. Create a database with Neon
3. Create database schemas
4. Run migrations
5. Register an application
6. Register a user
7. Login
8. Create a role
9. Assign a role to a user
10. Check user permissions with a guard## Helpful files
* CMD - Commands used in the video
* api.json - Thunder Client collection## Tips
* Infer the applicationId from the JWT where possible
* Include the applicationId in queries