A Next.js 13 application with authentication and payments, built with PlanetScale, Drizzle ORM, Lucia, Tailwind and LemonSqueezy
https://github.com/amosbastian/template/assets/9199433/ec672969-dd51-42ee-9dc6-4c3b69877e35
I 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
If you encounter something that's broken, you can message me @amosbastian or create an issue here. Contributions are also very much welcome! 😁
A list of things not working or implemented right now:
/pages
directorynpm install
.env.example
to .env
and update the variablescp .env.example .env
npx nx serve web
mysql -u root
CREATE DATABASE template;
npx drizzle-kit mysql:push
You don't have to use a local database and use PlanetScale as your only database if you want
TODO:
To set up GitHub OAuth you need to
Click "New OAuth App"
Add your authorisation callback URL: http://localhost:4200/api/oauth/github
You can run Mailing to get a preview of the email in development mode instead of actually sending an email
npx mailing
In production it will use Resend, so you will need to get an API key and verify your domain.
We 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:
npx ngrok http 4200
And then add the webhook URL (e.g. https://abc.eu.ngrok.io/api/lemonsqueezy
) to your webhook settings in LemonSqueezy
To generate assets (favicon etc.) with your own logo you can replace logo-mark.svg
with your and then use the following command
npm run asset-generator
Licensed under the MIT license.