{"id":30712276,"url":"https://github.com/thiagocrux/jstack-jwt-auth","last_synced_at":"2026-04-11T04:32:23.579Z","repository":{"id":270652333,"uuid":"910965826","full_name":"thiagocrux/jstack-jwt-auth","owner":"thiagocrux","description":" Implementation of JWT authentication with RBAC (Role-Based Access Control) and refresh token in a Node.js API.","archived":false,"fork":false,"pushed_at":"2025-08-30T23:24:44.000Z","size":132,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-31T01:12:30.192Z","etag":null,"topics":["express","jsonwebtoken","jwt","nodejs","postgresql","prisma","rbac","refresh-token","typescript","zod"],"latest_commit_sha":null,"homepage":"","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/thiagocrux.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-01T23:29:04.000Z","updated_at":"2025-08-30T23:24:47.000Z","dependencies_parsed_at":"2025-05-11T22:38:11.387Z","dependency_job_id":null,"html_url":"https://github.com/thiagocrux/jstack-jwt-auth","commit_stats":null,"previous_names":["thiagocrux/jstack-live-006","thiagocrux/node-auth","thiagocrux/jstack-jwt-auth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thiagocrux/jstack-jwt-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagocrux%2Fjstack-jwt-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagocrux%2Fjstack-jwt-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagocrux%2Fjstack-jwt-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagocrux%2Fjstack-jwt-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thiagocrux","download_url":"https://codeload.github.com/thiagocrux/jstack-jwt-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thiagocrux%2Fjstack-jwt-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31669114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"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":["express","jsonwebtoken","jwt","nodejs","postgresql","prisma","rbac","refresh-token","typescript","zod"],"created_at":"2025-09-03T02:50:35.133Z","updated_at":"2026-04-11T04:32:23.568Z","avatar_url":"https://github.com/thiagocrux.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js Authentication\n\nImplementation of JWT authentication with RBAC (Role-Based Access Control) in a Node.js API.\n\n## Technologies\n\nThese are some of the tecnologies used in this project:\n\n- `bcrypt`: A library for hashing and comparing passwords securely in Node.js.\n- `commitlint`: A tool that checks your commits and ensures consistency in version control.\n- `dotenv`: A module that loads a `.env` file into `process.env`.\n- `eslint`: A linting tool for JavaScript/TypeScript code.\n- `express`: A Node.js minimalist framework.\n- `husky`: A tool for adding Git hooks to automate tasks like linting, testing, or commits in JavaScript/Node.js projects.\n- `jsonwebtoken`: A library for creating and verifying JSON Web Tokens (JWT) in Node.js.\n- `lint-staged`: Runs linters on Git staged files.\n- `node`: JavaScript runtime built on Chrome's V8 engine, used for building fast and scalable server-side applications.\n- `prettier`: A code formatter.\n- `prisma`: A modern, type-safe database toolkit and ORM for Node.js and TypeScript.\n- `tsx`: A command-line tool and Node.js enhancement that allows you to execute TypeScript files directly without needing to explicitly compile them to JavaScript first.\n- `typescript`: Strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.\n\n_For more information about other dependencies, see the `package.json` file._\n\n## Installation\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/thiagocrux/jstack-jwt-auth.git\n```\n\n2. Browse to the project folder:\n\n```bash\ncd jstack-jwt-auth\n```\n\n3. Install dependencies:\n\n```bash\npnpm install\n```\n\n4. Create a `.env` file in the root of the project and set the environment variables as described below:\n\n```bash\n# DATABASE_URL: The connection string for your PostgreSQL database.\n# Update \u003cuser\u003e, \u003cpassword\u003e, and \u003cdatabase_name\u003e as needed.\n# You may also need to change \u003chost\u003e (default: localhost) and \u003cport\u003e (default: 5432) if your PostgreSQL setup is different.\nDATABASE_URL=\"postgresql://\u003cuser\u003e:\u003cpassword\u003e@\u003chost\u003e:\u003cport\u003e/\u003cdatabase_name\u003e?schema=public\"\n\n# JWT_SECRET: Secret key used for signing JWT tokens.\nJWT_SECRET=\"\"\n```\n\n5. Create the database, the tables and generate the Prisma client\n\n```bash\nnpx prisma migrate dev\n```\n\n## Available scripts\n\nThis section describes the available scripts in the `package.json` file and their functionalities.\n\n### Development\n\n- #### `dev`\n\n  Starts the server in development mode using `pnpm dev`, enabling faster builds and live-reloading.\n\n  ```bash\n  pnpm dev\n  ```\n\n### Production\n\n- #### `build`\n\n  Compiles the application for production.\n\n  ```bash\n  pnpm build\n  ```\n\n- #### `start`\n\n  Start the server for production from the compiled files.\n\n  ```bash\n  pnpm start\n  ```\n\n### Git hooks\n\n- #### `prepare`\n\n  Automatically configures Git hooks (via `husky`) before each commit.\n\n  ```bash\n  pnpm prepare\n  ```\n\n### Prisma\n\n- #### `prisma:generate`\n\n  Generates the Prisma client based on the data model defined in the `schema.prisma` file.\n\n  ```bash\n  pnpm prisma:generate\n  ```\n\n- #### `prisma:migrate`\n\n  Creates and applies a new database migration based on your Prisma schema changes, resets the database (if needed), and generates Prisma Client. It's used during development to sync your schema with the database.\n\n  ```bash\n  pnpm prisma:migrate\n  ```\n\n- #### `prisma:studio`\n\n  Opens an interactive web-based GUI (at localhost:5555) to view and edit your database tables directly. It helps you explore and manage data visually.\n\n  ```bash\n  pnpm prisma:studio\n  ```\n\n## Related links\n\n- [Live #006 - Autenticação JWT em APIs Node.js](https://app.jstack.com.br/classroom/lives/autenticacao-jwt-em-apis-node-js)\n- [Live #007 - Autorização baseada em cargos RBAC em APIs Node.js](https://app.jstack.com.br/classroom/lives/autorizacao-baseada-em-cargos-rbac-em-apis-node-js/)\n- [Live #008 - RBAC: Criando um sistema de controle de acesso gerenciável ](https://app.jstack.com.br/classroom/lives/rbac-criando-um-sistema-de-controle-de-acesso-gerenciavel/)\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagocrux%2Fjstack-jwt-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthiagocrux%2Fjstack-jwt-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthiagocrux%2Fjstack-jwt-auth/lists"}