Skip to content

Neon.Role reference

Source: packages/neon/src/Role.ts

A Postgres role on a Neon branch. Neon makes every role it creates a member of neon_superuser: it can read and write all data, create databases and roles, and bypass row-level security. Use roles for separate logins and passwords, not to restrict access.

A login role on a branch

const app = yield* Neon.Role("App", { branch });
// app.roleName and app.password (Redacted) connect to branch.origin.host

A role on the project’s default branch

const migrator = yield* Neon.Role("Migrator", { project, name: "migrator" });
const owner = yield* Neon.Role("Owner", { branch, name: "app_owner", noLogin: true });

Role.lookup references a role Alchemy doesn’t manage (created in the Neon Console or by another stack). It is read during plan/deploy, never created, updated or deleted. password is the one Neon has stored, or undefined when it has none; a lookup never resets it.

const app = Neon.Role.lookup({ projectId: "plain-wave-12345678", roleName: "app" });