{"id":25386175,"url":"https://github.com/risixdzn/authboilerplate","last_synced_at":"2026-04-12T13:43:19.962Z","repository":{"id":277089281,"uuid":"909198140","full_name":"risixdzn/authboilerplate","owner":"risixdzn","description":"🔒 Authentication monorepo with a Fastify API + Next.js frontend. Complete JWT control and shared Zod schemas — no magic libraries.","archived":false,"fork":false,"pushed_at":"2025-02-17T00:01:15.000Z","size":1705,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-25T03:06:49.687Z","etag":null,"topics":["drizzle-orm","fastify","jwt","nextjs","postgresql","react-email","redis","refresh-token","resend","rest","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/risixdzn.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}},"created_at":"2024-12-28T02:05:05.000Z","updated_at":"2025-03-04T18:14:06.000Z","dependencies_parsed_at":"2025-02-12T04:43:35.855Z","dependency_job_id":"4333e17a-3fb7-43bf-8daf-f9a0d151ed81","html_url":"https://github.com/risixdzn/authboilerplate","commit_stats":null,"previous_names":["risixdzn/authboilerplate"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/risixdzn/authboilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/risixdzn%2Fauthboilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/risixdzn%2Fauthboilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/risixdzn%2Fauthboilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/risixdzn%2Fauthboilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/risixdzn","download_url":"https://codeload.github.com/risixdzn/authboilerplate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/risixdzn%2Fauthboilerplate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261795318,"owners_count":23210619,"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","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","fastify","jwt","nextjs","postgresql","react-email","redis","refresh-token","resend","rest","zod"],"created_at":"2025-02-15T10:21:27.410Z","updated_at":"2026-04-12T13:43:19.897Z","avatar_url":"https://github.com/risixdzn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Authentication Boilerplate Monorepo\n\nA starting point for custom authentication without magic libraries. This monorepo provides:\n\n- A **Fastify API** using JWT refresh tokens, accepting credentials via the `Authorization` header or a `token` cookie.\n- A **Next.js 14 Frontend** with server/client authentication, middleware revalidation, and Axios interceptors.\n- Shared [Zod](https://zod.dev) schemas via the `@repo/schemas` package.\n- Turborepo for local package sharing and scripting.\n\n### Powered by:\n\n![TypeScript](https://img.shields.io/badge/TypeScript-3178C6.svg?style=for-the-badge\u0026logo=TypeScript\u0026logoColor=white)\n![Next.js](https://img.shields.io/badge/Next.js-000000.svg?style=for-the-badge\u0026logo=nextdotjs\u0026logoColor=white)\n![Node.js](https://img.shields.io/badge/Node.js-5FA04E.svg?style=for-the-badge\u0026logo=nodedotjs\u0026logoColor=white)\n![Fastify](https://img.shields.io/badge/Fastify-000000.svg?style=for-the-badge\u0026logo=Fastify\u0026logoColor=white)\n![Turborepo](https://img.shields.io/badge/Turborepo-EF4444.svg?style=for-the-badge\u0026logo=Turborepo\u0026logoColor=white)\n![React](https://img.shields.io/badge/React-61DAFB.svg?style=for-the-badge\u0026logo=React\u0026logoColor=black)\n![React Hook Form](https://img.shields.io/badge/React%20Hook%20Form-EC5990.svg?style=for-the-badge\u0026logo=React-Hook-Form\u0026logoColor=white)\n![Zod](https://img.shields.io/badge/Zod-3E67B1.svg?style=for-the-badge\u0026logo=Zod\u0026logoColor=white)\n![Axios](https://img.shields.io/badge/Axios-5A29E4.svg?style=for-the-badge\u0026logo=Axios\u0026logoColor=white)\n![Swagger](https://img.shields.io/badge/Swagger-85EA2D.svg?style=for-the-badge\u0026logo=Swagger\u0026logoColor=black)\n![Scalar](https://img.shields.io/badge/Scalar-1A1A1A.svg?style=for-the-badge\u0026logo=Scalar\u0026logoColor=white)\n![Resend](https://img.shields.io/badge/Resend-000000.svg?style=for-the-badge\u0026logo=Resend\u0026logoColor=white)\n![.ENV](https://img.shields.io/badge/.ENV-ECD53F.svg?style=for-the-badge\u0026logo=dotenv\u0026logoColor=black)\n![Drizzle](https://img.shields.io/badge/Drizzle-C5F74F.svg?style=for-the-badge\u0026logo=Drizzle\u0026logoColor=black)\n![PostgreSQL](https://img.shields.io/badge/PostgreSQL-4169E1.svg?style=for-the-badge\u0026logo=PostgreSQL\u0026logoColor=white)\n![Redis](https://img.shields.io/badge/Redis-FF4438.svg?style=for-the-badge\u0026logo=Redis\u0026logoColor=white)\n\n## API\n\nBuilt with [Fastify](https://www.fastify.io), the API handles auth using:\n\n- **Type Validation:** [Zod](https://zod.dev)\n- **ORM:** [Drizzle](https://orm.drizzle.team) with [PostgreSQL](https://www.postgresql.org)\n- **Mailing:** [Resend](https://resend.com) \u0026 [React Email](https://react.email)\n- **Encryption:** [bcrypt](https://www.npmjs.com/package/bcrypt)\n- **Caching:** [Redis](https://redis.io)\n\nDocumentation is available on the following API routes:\n\n- [Scalar UI](https://scalar-ui.com) for a modern interface at `/docs`\n- [Swagger](https://swagger.io) for the classic one at `/reference`\n\n## Frontend\n\nThe frontend leverages [Next.js 14](https://nextjs.org) for seamless server/client authentication, with revalidation in middleware and auth interceptors powered by [Axios](https://axios-http.com).\n\n## Authentication Flow\n\nUsers authenticate via JWT refresh tokens. Supported actions include:\n\n- Password reset (authenticated and \"forgot password\")\n- Email confirmation before signup\n- Account deletion\n- Display name updates\n\n![Authentication Flow](apps/server/src/public/flux.svg)\n\n## Setup\n\nBegin by configuring your environment. Rename and update the provided `.env.example` files:\n\n- **Global secrets:** [.env.example](.env.example) for DB, Redis, etc.\n- **API secrets:** [apps/server/.env.example](apps/server/.env.example) for JWT signing keys and API keys.\n- **Next.js variables:** [apps/web/.env.example](apps/web/.env.example).\n\nNext, spin up your Postgres and Redis databases with Docker Compose:\n\n```sh\ndocker compose up\n```\n\nInstall dependencies and run database migrations:\n\n```sh\nnpm install\nnpm run migrate\n```\n\nFinally, start the development server:\n\n```sh\nnpm run dev\n```\n\n## Customization\n\nEvery aspect of this boilerplate can be customized to fit your needs. For example, you can:\n\n- Customize the `APP_NAME` in [packages/constants/src/app.ts](packages/constants/src/app.ts) which will be used in mailing, docs and some UI components.\n- Change the \"Logo\" to anything you like\n    - Web logo in: [apps/web/public/logo.svg](apps/web/public/logo.svg)\n    - Server logos in: [apps/server/src/public/logo.png](apps/server/src/public/logo.png) and [apps/server/src/public/favicon.svg](apps/server/src/public/favicon.svg)\n        \u003e Logos won't load on emails on development server because email clients can't access your localhost. On the production server, they will work fine.\n- Customize every aspect of the UI Components in the [apps/web/components](apps/web/components) directory ([https://ui.shadcn.com/](shadcn/ui) btw).\n- Customize the mailing templates in the [apps/server/src/emails](apps/server/src/emails) directory using [https://react.email/](React Email).\n- Change docs theme and colors in the [apps/server/src/server.ts](apps/server/src/server.ts) file according to [https://github.com/scalar/scalar/blob/82c8f39c5f390ced5d8406bfb0b23623575fb85e/documentation/themes.md](Scalar UI themes).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frisixdzn%2Fauthboilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frisixdzn%2Fauthboilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frisixdzn%2Fauthboilerplate/lists"}