This repository is a guided getting started example for Neon Authorize + Stack Auth.
- Create a Neon project
- Sign Up for Stack Auth and create a new project
- Once in the Stack Auth's Dashboard, create a new project.
- Head to the Neon Console, and find "Authorize"
- Inside Authorize, click "Add Authentication Provider", choose Stack Auth and paste in the following URL (replacing your Stack Auth's Project ID):
https://api.stack-auth.com/api/v1/projects/<project-id>/.well-known/jwks.json
(If you have an older Stack Auth project, you'll have to disable legacy JWKS in the Stack Auth's project settings)
- 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:
NEXT_PUBLIC_STACK_PROJECT_ID=
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=
STACK_SECRET_SERVER_KEY=
# For the `neondb_owner` role.
DATABASE_URL=
# For the `authenticated`, passwordless role.
DATABASE_AUTHENTICATED_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!