This repository is a guided getting started example for Neon Authorize + Clerk. It consists of a todo list application, and the frontend is directly sending SQL queries to the database. The database is enforcing authorization using Postgres RLS.
- Create a Neon project ( pg.new )
- Create a Clerk Application ( https://go.clerk.com/cHq4Ut6 )
- Head to the Clerk dashboard, and find "JWT Templates"
- Create a JWT Template ("Blank") and give it any name (e.g., "my-jwt-template")
- Copy the "JWKS Endpoint" URL and save it for later
- Head to the Neon Console, and find "Authorize"
- Inside Authorize, click "Add Authentication Provider", and paste in the JWKS Endpoint URL you copied earlier
- Follow the steps in the UI to setup the roles for Neon Authorize. You should ignore the schema related steps if you're following this guide.
- Clone this repository and run
npm install
orbun install
- Create a
.env
file in the root of this project and add the following:
# Grab from Clerk's dashboard
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
# Grab from Neon's dashboard (the "authenticated" role)
NEXT_PUBLIC_DATABASE_AUTHENTICATED_URL=
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
# This is needed for drizzle:migrate, grab from Neon's dashboard (database owner role)
DATABASE_URL=
- Run
npm run drizzle:migrate
orbun run drizzle:migrate
to apply the migrations - Run
npm run dev
orbun run dev
- Open your browser and go to
http://localhost:3000
- Login and play around!