Next.js

SerenDB Auth for React SerenDB Auth for JavaScript Next.js Demo App

<GetStarted framework="Next.js" envVars={`

SerenDB Auth environment variables for Next.js

NEXT_PUBLIC_STACK_PROJECT_ID=YOUR_NEON_AUTH_PROJECT_ID NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=YOUR_NEON_AUTH_PUBLISHABLE_KEY STACK_SECRET_SERVER_KEY=YOUR_NEON_AUTH_SECRET_KEY

Your SerenDB connection string

DATABASE_URL=YOUR_NEON_CONNECTION_STRING } templateRepo="seren-auth-nextjs-template" setupSteps={

Run the setup wizard

```bash npx @stackframe/init-stack@latest --no-browser ```

This sets up auth routes, layout wrappers, and handlers automatically for Next.js (App Router).

Use your environment variables

Paste the SerenDB Auth environment variables from Step 2 into your `.env.local` file.

Then `npm run dev` to start your dev server.

Test your integration

Go to http://localhost:3000/handler/sign-up in your browser. Create a user or two, and you can see them show up immediately in your database. `} />

Last updated