This repository is a guided getting started example for Neon Authorize + Stytch.
- Create a Neon project
- Create a Stytch project (choose type:
Consumer
) - In the "Frontend SDKs" page, make sure to enable the SDK
- Head to the Neon Console, and find "Authorize"
- Inside Authorize, click "Add Authentication Provider", and under JWKS URL paste in
https://test.stytch.com/v1/sessions/jwks/:project_id
(substitute your project ID in:project_id
) - 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:
# For the `neondb_owner` role.
DATABASE_URL=
# For the `authenticated`, passwordless role.
DATABASE_AUTHENTICATED_URL=
# The below values may be found in your Stytch Dashboard: https://stytch.com/dashboard/api-keys
STYTCH_PROJECT_ENV=test
STYTCH_PROJECT_ID="YOUR_STYTCH_PROJECT_ID"
NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN="YOUR_STYTCH_PUBLIC_TOKEN"
STYTCH_SECRET="YOUR_STYTCH_SECRET"
- 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!