Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 5 min read How-to mediumAdept

Auth setup with Neon, Keycloak and Koyeb

Keycloak can use Neon serverless Postgres as its backing store, with the Keycloak server deployed as a container on Koyeb. The steps are: create a dedicated keycloak database and a scoped keycloak_admin role, then deploy Keycloak from a Koyeb template configured through KC_DB_URL, KC_DB_USERNAME, KC_DB_PASSWORD and KC_HOSTNAME. After that, import a sample realm and authenticate a Next.js app through NextAuth.js over OAuth. For production, build an optimized Keycloak image, configure connection pooling, and consider Neon branching and point-in-time restore for recovering Keycloak data.

Related posts

  • Next.js authentication using Clerk, Drizzle ORM, and Neon

    Neon mediumAdept

    Clerk can handle authentication for a Next.js 14 App Router app while Drizzle ORM and Neon's serverless HTTP driver store non-PII data keyed by the Clerk user ID. The walkthrough defines a Drizzle schema, generates and pushes migrations with Drizzle Kit, and protects routes with Clerk's authMiddleware and ClerkProvider/UserButton. It then implements Server Actions that use currentUser() to insert and delete a per-user row. PII stays in Clerk's compliant infrastructure, and only the user ID is referenced in Postgres.

  • How to Build a Secure Project Management Platform with Next.js, Clerk, and Neon

    Neon mediumAdept

    A security-first tutorial for building Kozi, a collaborative project management app, using Next.js, Clerk authentication and a Neon serverless Postgres database accessed through Prisma. Security rests on three layers: Clerk middleware protecting every /app route, server actions as the only path to the database so credentials never reach the client, and cross-checking the requesting user ID against record ownership on every read and write. The guide walks through the Prisma schema, the middleware configuration, sidebar and layout components, and task server actions that verify ownership before mutating data.

  • Handling Auth in a Staging Environment

    Neon mediumAdept

    Neon Auth stores users, sessions and OAuth data in a neon_auth schema inside the Postgres database, so branching the database also branches auth state via copy-on-write. Each branch gets its own auth endpoint, which lets preview and staging environments test role, permission and OAuth changes against a copy of production users without touching production or creating test accounts by hand. Deleting the branch removes all copied users. It is built on Better Auth, used through the @neondatabase/neon-js SDK, and can be provisioned per PR with a GitHub Action that outputs the branch's auth URL.

  • Build Internal Tools Using Neon, StackAuth, and Vercel

    Neon mediumAdept

    An open-source Next.js template for internal tools combines Neon serverless Postgres, Stack Auth and Vercel free tiers to provide a database, API routes, authentication, role-based access control and an admin panel. Setup takes a few steps: clone the repo, fill in the env vars, push the schema with drizzle-kit, create nested admin/user roles in Neon's Auth tab, claim admin at /setup and deploy to Vercel. Access is controlled by verified-email domain whitelisting, per-email grants for contractors and explicit blocklists, all managed from /tools/admin. New tools are added under app/tools and registered in config/app.ts.

  • Inside a Kylon room, where people and agents build apps on Neon

    Neon easyNovice

    Kylon, a shared workspace where teams and AI agents build internal apps like CRMs and invoice trackers, maps its product directly onto Neon resources: one Neon project per workspace, one database per app, and one branch per draft. Agents apply schema migrations and changes to a branch copy of real data, a person reviews the preview, and production changes only on publish. Scale-to-zero makes many mostly idle agent-built databases affordable. The Neon API, point-in-time restore and MCP let agents provision, manage and undo changes without anyone opening a console.

The quest for software engineering knowledge.

Look:
Layout: