{"id":21431532,"url":"https://github.com/tomdoestech/user-api","last_synced_at":"2025-07-25T01:05:33.232Z","repository":{"id":168567302,"uuid":"643343981","full_name":"TomDoesTech/user-api","owner":"TomDoesTech","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-28T22:51:40.000Z","size":120,"stargazers_count":75,"open_issues_count":0,"forks_count":23,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-14T14:04:31.107Z","etag":null,"topics":["drizzle-orm","multitenancy","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://youtu.be/b6VhN_HHDiQ","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TomDoesTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-20T21:25:07.000Z","updated_at":"2025-06-19T00:11:03.000Z","dependencies_parsed_at":"2023-07-03T17:01:02.386Z","dependency_job_id":null,"html_url":"https://github.com/TomDoesTech/user-api","commit_stats":null,"previous_names":["tomdoestech/user-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TomDoesTech/user-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomDoesTech%2Fuser-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomDoesTech%2Fuser-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomDoesTech%2Fuser-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomDoesTech%2Fuser-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TomDoesTech","download_url":"https://codeload.github.com/TomDoesTech/user-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomDoesTech%2Fuser-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266936046,"owners_count":24009342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drizzle-orm","multitenancy","nodejs","typescript"],"created_at":"2024-11-22T23:07:58.477Z","updated_at":"2025-07-25T01:05:33.169Z","avatar_url":"https://github.com/TomDoesTech.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multi Tenant Role Based Access Control (RBAC) Authentication API\n\n## Sponsor\n\u003cimg src=\"./img/neon.svg\" /\u003e\n\nThank you to [Neon](https://bit.ly/tomdoestech) for sponsoring this video!\n\n## Features\n* Create an application\n* Register a user for an application\n* Login\n* Create a role\n* Assign a role to a user\n\n* Check user permissions with a guard\n\n## What are we using?\n* [Drizzle ORM](https://github.com/drizzle-team/drizzle-orm)\n* [Fastify](https://www.fastify.io/)\n* [PostgreSQL](https://www.postgresql.org/)\n* [TypeScript](https://www.typescriptlang.org/)\n\n## What you'll need\n* Editor - [VS Code](https://code.visualstudio.com/download)\n* Node.js - [Download](https://nodejs.org/en/download/)\n* A database - [PostgreSQL by Neon](https://bit.ly/tomdoestech)\n* A REST client - [Thunder Client](https://marketplace.visualstudio.com/items?itemName=rangav.vscode-thunder-client)\n\n## What you will learn\n* How to create a multi tenant application\n* How to create a role based access control system\n* Some basic relational database concepts\n* A nice and neat file structure for backend services\n* TypeScript\n* Fastify\n* RESTful API design\n* How to use Drizzle ORM\n\n## Data structure\n\u003cimg src =\"./img/diagram.png\" /\u003e\n\n## Data flow\n\u003cimg src =\"./img/data-flow.png\" /\u003e\n\n## Video structure\n1. Setup the initial application\n2. Create a database with Neon\n3. Create database schemas\n4. Run migrations\n5. Register an application\n6. Register a user\n7. Login\n8. Create a role\n9. Assign a role to a user\n10. Check user permissions with a guard\n\n## Helpful files\n* CMD - Commands used in the video\n* api.json - Thunder Client collection\n\n## Tips\n* Infer the applicationId from the JWT where possible\n* Include the applicationId in queries\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomdoestech%2Fuser-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomdoestech%2Fuser-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomdoestech%2Fuser-api/lists"}