Skip to content

Configuration

Nametag is configured entirely through environment variables, typically set in a .env file next to your docker-compose.yml. This page is the full reference. For a shorter path to a running instance, see Installation.

Nametag behaves differently depending on NODE_ENV and SAAS_MODE. Almost every self-hosted instance runs in the second mode below.

For local development and testing. Redis is optional (falls back to in-memory rate limiting), email verification is disabled, billing is hidden, and OIDC is available if configured.

This is the default mode when NODE_ENV is production or unset, and SAAS_MODE is not true. It’s what you get by following Installation.

  • Redis is optional but recommended (in-memory fallback otherwise)
  • New accounts are auto-verified, no email required
  • Billing is hidden, all features are unlimited
  • OIDC is available if configured, password login can be disabled once it is
  • Google OAuth is not available (self-hosted instances use OIDC instead)

Reserved for the hosted service at nametag.one. Redis becomes mandatory, email verification is required, billing and usage limits are enforced, and Google OAuth is enabled instead of generic OIDC. You should not set SAAS_MODE=true on a self-hosted instance.

Nametag supports two ways to point at your Postgres database.

Method 1: individual variables (recommended). Set DB_HOST, DB_PORT, DB_NAME, DB_USER, and optionally DB_PASSWORD separately. This is the friendlier option if you’re not used to connection strings.

Method 2: connection string (advanced). Set DATABASE_URL=postgresql://user:password@host:5432/database directly.

If DATABASE_URL is set, it takes precedence over the individual DB_* variables. The application requires either a complete DATABASE_URL, or all of DB_HOST, DB_PORT, DB_NAME, and DB_USER (with DB_PASSWORD optional). If neither is provided, the app refuses to start and logs a clear error.

VariableDescriptionExample
DB_HOSTPostgreSQL server hostnamedb or localhost
DB_PORTPostgreSQL server port5432
DB_NAMEPostgreSQL database namenametag_db
DB_USERPostgreSQL usernamenametag
DB_PASSWORDPostgreSQL passwordyour-secure-password
NEXTAUTH_URLApplication URL, used for auth, emails, and redirectshttps://yourdomain.com
NEXTAUTH_SECRETSecret for JWT encryption, minimum 32 charactersGenerate with openssl rand -base64 32
CRON_SECRETSecret for authenticating cron job requests, minimum 16 charactersGenerate with openssl rand -base64 16

REDIS_URL and REDIS_PASSWORD are required only in SaaS mode. For self-hosted instances they’re optional. See Redis for the full explanation of when you need it.

VariableDescriptionDefault
RESEND_API_KEYAPI key from Resend for email functionalityNot required for self-hosted
EMAIL_DOMAINVerified domain for sending emails, required if using Resend or SMTPNot required for self-hosted
SMTP_HOSTSMTP server hostname, alternative to ResendNot set
SMTP_PORTSMTP server port, 587 for STARTTLS or 465 for SSLNot set
SMTP_SECUREUse SSL/TLS, true for port 465, false for 587false
SMTP_USERSMTP username, often your email addressNot set
SMTP_PASSSMTP password or app-specific passwordNot set
SMTP_REQUIRE_TLSRequire STARTTLStrue
SMTP_FROMOverride the “from” address if your server rejects custom onesNot set
PHOTO_STORAGE_PATHCustom path for photo storage/app/data/photos
PHOTO_SIZEPhoto dimensions in pixels, square, 64 to 4096256
PHOTO_QUALITYJPEG quality for opaque photos, 1 to 10080
OIDC_ISSUER_URLOIDC provider issuer URL, enables SSO loginNot set
OIDC_CLIENT_IDOIDC client ID registered with your providerNot set
OIDC_CLIENT_SECRETOIDC client secretNot set
OIDC_DISPLAY_NAMELabel shown on the SSO login buttonSSO
DISABLE_PASSWORD_LOGINHide the password form, requires OIDC to be fully configuredfalse
DISABLE_REGISTRATIONDisable registration after the first userfalse
GEOCODER_URLNominatim-compatible geocoder used to place addresses on the maphttps://nominatim.openstreetmap.org
DISABLE_GEOCODINGDisable all address geocoding instance-widefalse
REDIS_URLRedis connection URLNot set (in-memory fallback)
REDIS_PASSWORDRedis authentication passwordNot set
NODE_ENVEnvironment mode: development, production, or testproduction
LOG_LEVELLogging verbosity: debug, info, warn, or errorinfo

Some variables are validated against a specific range or format at startup. If a value falls outside these bounds, the app falls back to the default rather than starting with an invalid value.

VariableConstraintDefault
PHOTO_SIZEInteger, 64 to 4096 (output photo dimensions in pixels, square)256
PHOTO_QUALITYInteger, 1 to 100 (JPEG compression quality)80
DB_PORTInteger, 1 to 65535None, required
LOG_LEVELOne of debug, info, warn, errorinfo
NEXTAUTH_SECRETString, minimum 32 charactersNone, required
CRON_SECRETString, minimum 16 charactersNone, required

These limits aren’t set through environment variables, they’re fixed in the application, but they’re worth knowing if you’re troubleshooting uploads or slow responses:

LimitValue
Default API request body size1 MB
Next.js proxy body size (raised for photo uploads)50 MB
Database query timeout, default10 seconds
Database query timeout, long-running queries30 seconds
External API timeout (e.g. geocoder requests)10 seconds

If you’re running Nametag behind your own reverse proxy (nginx, Caddy, Traefik), make sure its own body size limit is at least 50 MB too, otherwise photo uploads will be rejected before they even reach Nametag.

Detailed setup for each of these areas lives on its own page:

  • Email: Resend and SMTP, provider-specific notes
  • Authentication: OIDC, registration control, password login
  • Redis: when it’s needed and how to configure it
  • Map & Geocoding: geocoder configuration and privacy

NEXTAUTH_SECRET and CRON_SECRET should both be random, unique strings. Generate them with:

Terminal window
openssl rand -base64 32 # for NEXTAUTH_SECRET
openssl rand -base64 16 # for CRON_SECRET

Don’t reuse the same value for both, and don’t reuse secrets across instances.