Guide

Configuration

All module options and environment variables.
nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-postgrest'],
  postgrest: {
    url: 'http://localhost:3001',
    key: '',
    tokenKey: 'postgrest_token',
    generateTypes: false,
  },
})

Options

OptionDefaultDescription
url''PostgREST API URL.
key''Public anon JWT sent when no user token is available. Empty means no Authorization header, so PostgREST uses its db-anon-role.
tokenKey'postgrest_token'Session field that holds the user's PostgREST JWT. Only used when nuxt-auth-utils is installed (auto-detected) — see Authentication.
generateTypesfalseGenerate the Database type at ~~/shared/types/database.types.ts with the Supabase CLI on nuxt dev / nuxt prepare.

There's no schema option: clients default to Postgres's public schema, and createPostgrestClient takes an explicit schema for anything else (multi-tenant clients, non-default schemas).

Environment variables

Runtime values can be overridden per environment without rebuilding:

VariableScopeMaps to
NUXT_PUBLIC_POSTGREST_URLPublicurl
NUXT_PUBLIC_POSTGREST_KEYPublickey
NUXT_POSTGREST_SECRET_KEYServer onlySecret JWT for usePostgrestAdmin()
NUXT_POSTGREST_DB_URIBuild toolingDatabase URL for type generation
NUXT_POSTGREST_SECRET_KEY usually maps to a role that bypasses RLS. It is never exposed to the client, but keep it out of nuxt.config.ts and version control.
Copyright © 2026