{"id":14006998,"url":"https://github.com/amosbastian/template","last_synced_at":"2026-01-16T10:27:31.960Z","repository":{"id":174721412,"uuid":"642123561","full_name":"amosbastian/template","owner":"amosbastian","description":"A Next.js 13 application with authentication and payments, built with PlanetScale, Drizzle ORM, Lucia, Tailwind and LemonSqueezy","archived":false,"fork":false,"pushed_at":"2023-06-26T16:06:21.000Z","size":2048,"stargazers_count":250,"open_issues_count":3,"forks_count":19,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-08-10T10:03:35.644Z","etag":null,"topics":["drizzle-orm","lemonsqueezy","lucia-auth","nextjs","planetscale","shadcn-ui","tailwindcss","trpc"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amosbastian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-05-17T21:54:40.000Z","updated_at":"2024-07-23T14:02:28.000Z","dependencies_parsed_at":"2024-01-23T19:20:05.029Z","dependency_job_id":null,"html_url":"https://github.com/amosbastian/template","commit_stats":null,"previous_names":["amosbastian/template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amosbastian%2Ftemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amosbastian%2Ftemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amosbastian%2Ftemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amosbastian%2Ftemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amosbastian","download_url":"https://codeload.github.com/amosbastian/template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227384067,"owners_count":17772307,"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","lemonsqueezy","lucia-auth","nextjs","planetscale","shadcn-ui","tailwindcss","trpc"],"created_at":"2024-08-10T10:01:45.397Z","updated_at":"2026-01-16T10:27:31.907Z","avatar_url":"https://github.com/amosbastian.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","tailwindcss","Boilerplates \u0026 Starters"],"sub_categories":[],"readme":"# Template\n\nA Next.js 13 application with authentication and payments, built with PlanetScale, Drizzle ORM, Lucia, Tailwind and LemonSqueezy\n\nhttps://github.com/amosbastian/template/assets/9199433/ec672969-dd51-42ee-9dc6-4c3b69877e35\n\n## About this project\n\nI used this as a way to play around with the new Next.js app directory, so it is more than likely that things aren't optimal / implemented correctly, so **keep this in mind if you decide to fork it and use it for a real app**\n\nIf you encounter something that's broken, you can message me [@amosbastian](https://twitter.com/amosbastian) or create an issue here. Contributions are also very much welcome! 😁\n\n## Features\n\n- Nearly everything included in the Next.js app directory\n- TypeScript ORM for SQL databases: [**Drizzle ORM**](https://github.com/drizzle-team/drizzle-orm)\n- Authentication using [**Lucia**](https://github.com/pilcrowOnPaper/lucia)\n- Database on [**PlanetScale**](https://planetscale.com/)\n- UI components from [**shadcn/ui**](https://github.com/shadcn/ui)\n- Blog using **MDX** and [**Contentlayer**](https://github.com/contentlayerdev/contentlayer)\n- Subscriptions using [**LemonSqueezy**](https://www.lemonsqueezy.com/)\n- Styled using **Tailwind CSS**\n- Fetching data using RSCs and [**tRPC**](https://github.com/trpc/trpc)\n- Email verification\n- Teams with team member management\n- RBAC using [**CASL**](https://github.com/stalniy/casl)\n- Emails using [**Mailing**](https://github.com/sofn-xyz/mailing) and [Resend](https://resend.com)\n\n## Known Issues\n\nA list of things not working or implemented right now:\n\n1. Sometimes MySQL will complain about too many connections: restart your Next.js app and it will go away\n2. Pricing plans currently aren't synced to the database, which would be ideal\n3. RBAC might not work as intended and I haven't tested it enough\n4. Not using tRPC in RSCs, so not sure if that works properly\n5. [Importing MJML breaks the new app router](https://github.com/vercel/next.js/issues/50042), which is why we put the email sending part in the `/pages` directory\n\n## Running Locally\n\n1. Install dependencies using npm:\n\n```sh\nnpm install\n```\n\n2. Copy `.env.example` to `.env` and update the variables\n\n```sh\ncp .env.example .env\n```\n\n3. Start the development server:\n\n```sh\nnpx nx serve web\n```\n\n### Setting up the database\n\n#### Local\n\n1. Log in to MySQL\n\n```bash\nmysql -u root\n```\n\n2. Create the database\n\n```bash\nCREATE DATABASE template;\n```\n\n3. Push your schema\n\n```bash\nnpx drizzle-kit mysql:push\n```\n\n#### PlanetScale\n\nYou don't have to use a local database and use PlanetScale as your only database if you want\n\nTODO:\n\n### Authentication\n\nTo set up GitHub OAuth you need to\n\n1. Go to https://github.com/settings/developers\n\n2. Click \"New OAuth App\"\n\n3. Add your authorisation callback URL: http://localhost:4200/api/oauth/github\n\n### Emails\n\nYou can run Mailing to get a preview of the email in development mode instead of actually sending an email\n\n```bash\nnpx mailing\n```\n\nIn production it will use [Resend](resend.com), so you will need to get an API key and verify your domain.\n\n### Payments\n\nWe are using LemonSqueezy for payments and syncing subscriptions via a webhook (`lemonsqueezy/route.ts`). If you want to test this locally, then you will need to use something like ngrok to expose the webhook:\n\n```bash\nnpx ngrok http 4200\n```\n\nAnd then add the webhook URL (e.g. `https://abc.eu.ngrok.io/api/lemonsqueezy`) to [your webhook settings in LemonSqueezy](https://app.lemonsqueezy.com/settings/webhooks)\n\n### Asset generation\n\nTo generate assets (favicon etc.) with your own logo you can replace `logo-mark.svg` with your and then use the following command\n\n```bash\nnpm run asset-generator\n```\n\n### Thanks to\n\n- [shadcn](https:twitter.com/shadcn)'s amazing example repositories and UI library\n- Copied a lot of design \u0026 emails from Vercel\n- Copied tRPC stuff from [@ploskovytskyy's repository](https://github.com/ploskovytskyy/next-app-router-trpc-drizzle-planetscale-edge)\n\n## License\n\nLicensed under the [MIT license](https://github.com/amosbastian/template/blob/main/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famosbastian%2Ftemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famosbastian%2Ftemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famosbastian%2Ftemplate/lists"}