Skip to content

yogyy/fastify-postgresql

Repository files navigation

Multi Tenant Role Based Access Control (RBAC) Authentication API

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?

What you'll need

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

Code 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

Tips

  • Infer the applicationId from the JWT where possible
  • Include the applicationId in queries

About

fastify RBAC using typescript and postgresql

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published