Skip to content

Latest commit

 

History

History
213 lines (150 loc) · 8.61 KB

CONFIGURATION.md

File metadata and controls

213 lines (150 loc) · 8.61 KB

CONFIGURATION

This document lists SplitPro environment variables and how they are used. The authoritative list is .env.example.

Required variables

Database

  • POSTGRES_CONTAINER_NAME: Docker container name used in compose setups.
  • POSTGRES_USER: Database user.
  • POSTGRES_PASSWORD: Database password.
  • POSTGRES_DB: Database name.
  • POSTGRES_PORT: Database port.
  • DATABASE_URL: Full connection string used by the app.

POSTGRES_USER may be a regular (non-superuser) role when pg_cron is preinstalled. See docker/README.md.

External PostgreSQL prerequisites (pg_cron)

If SplitPro connects to an external/managed PostgreSQL instance, make sure your database administrator enables pg_cron on the PostgreSQL server before first startup.

  1. Set PostgreSQL server settings (same values used in docker/prod/compose.yml):

    shared_preload_libraries = 'pg_cron'
    cron.database_name = '<your_splitpro_db>'
    cron.timezone = 'UTC'

    Restart PostgreSQL after changing these settings.

  2. Connect to the SplitPro database as a superuser/admin and install + grant pg_cron access:

    CREATE EXTENSION IF NOT EXISTS pg_cron;
    GRANT USAGE ON SCHEMA cron TO <app_user>;
    GRANT SELECT, UPDATE, REFERENCES ON cron.job TO <app_user>;
    GRANT SELECT ON cron.job_run_details TO <app_user>;
    GRANT pg_read_all_settings TO <app_user>; -- read cron.timezone, which pg_cron limits to superusers
  3. Verify setup:

    SHOW shared_preload_libraries;
    SHOW cron.database_name;
    SHOW cron.timezone;
    SELECT extname FROM pg_extension WHERE extname = 'pg_cron';

SplitPro can then run with a regular (non-superuser) POSTGRES_USER. The UPDATE permission on cron.job is needed for schedule migration and the row locks used by startup reconciliation. pg_cron's row-level security scopes jobs to their owner.

If your deployment sits behind a NAT/firewall/proxy that can silently drop idle TCP connections (leaving the pool with dead sockets that hang instead of erroring), add connect_timeout and socket_timeout (seconds) to DATABASE_URL so Prisma gives up on a stale connection instead of hanging indefinitely - e.g. ?connect_timeout=5&socket_timeout=5. /api/readyz's own query timeout only bounds queries that reach Postgres; it can't help if the socket itself is dead. See docker/README.md#health-checks for /api/healthz//api/readyz details and example probe configuration.

Authentication (NextAuth)

  • NEXTAUTH_SECRET: Secret used to sign tokens. Generate with openssl rand -base64 32.
  • NEXTAUTH_URL: Canonical app URL (used for callbacks and absolute URLs).
  • NEXTAUTH_URL_INTERNAL: Optional internal URL for server-side calls when the app cannot reach NEXTAUTH_URL.

At least one provider must be configured. SplitPro does not support username/password.

App behavior

  • DEFAULT_HOMEPAGE: Sets the landing page route, e.g. /home or /balances.
  • ENABLE_USER_DISCOVERY: Default false. Show an “Other users” section in the expense participant picker, including hidden friends and users without shared expenses. Excludes yourself and deleted accounts. Enable for private instances where all users may discover each other; this does not add friends to the balance dashboard.
  • ENABLE_SENDING_INVITES: Enable email invites (requires SMTP config).
  • DISABLE_EMAIL_SIGNUP: Disable email magic-link signup for new users.
  • UPLOAD_MAX_FILE_SIZE_MB: Maximum receipt upload size in MB. Used by both client-side pre-check and server-side upload limit. This is also the max size target for image compression, so increase it if you see bad resolution/quality. Default: 10.
  • UPLOAD_DIR: Directory for uploaded receipts and avatars. Default: uploads in the app's working directory (/app/uploads in Docker). Set it when the app directory is read-only, e.g. on NixOS.
  • API_KEYS_MAX_PER_USER: Maximum number of REST API keys a user can create. Default: 10.

Optional variables

Recurring expenses (pg_cron)

See Recurring transactions for configuration and deployment instructions.

Cache cleanup (pg_cron)

  • CLEAR_CACHE_CRON_RULE: Cron rule for cache cleanup jobs in database cron.timezone (UTC by default).
  • CACHE_RETENTION_INTERVAL: Postgres interval string that defines how long cached data can remain unused.

For time-zone behavior, see Recurring transactions. Standard cron ranges, lists and steps are supported; see the pg_cron documentation.

SMTP (email provider)

Used for magic-link login and invites.

  • FROM_EMAIL: Sender address.
  • EMAIL_SERVER_HOST: SMTP host.
  • EMAIL_SERVER_PORT: SMTP port.
  • EMAIL_SERVER_USER: SMTP user.
  • EMAIL_SERVER_PASSWORD: SMTP password.
  • EMAIL_TLS_REJECT_UNAUTHORIZED: Validates TLS certificates by default. Set it to 0 if you have a relay that needs it (Proton Bridge, Postfix, etc.)

Bank integrations

Plaid (recommended)

  • PLAID_CLIENT_ID: Plaid client id.
  • PLAID_SECRET: Plaid secret.
  • PLAID_ENVIRONMENT: sandbox, development, or production.
  • PLAID_COUNTRY_CODES: Country codes list (per Plaid docs).
  • PLAID_INTERVAL_IN_DAYS: Lookback window for fetching transactions (default 30 days).

GoCardless (deprecated)

  • GOCARDLESS_COUNTRY
  • GOCARDLESS_SECRET_ID
  • GOCARDLESS_SECRET_KEY
  • GOCARDLESS_INTERVAL_IN_DAYS

OAuth providers

Shared OAuth settings

  • OAUTH_AUTO_REDIRECT: Optional flag. When set to true, the sign-in page automatically redirects when exactly one OAuth provider is configured and no other authentication providers are enabled. This applies to Google, Authentik, Keycloak, and generic OIDC.

Google

  • GOOGLE_CLIENT_ID
  • GOOGLE_CLIENT_SECRET

Authentik

  • AUTHENTIK_ID
  • AUTHENTIK_SECRET
  • AUTHENTIK_ISSUER: Must include the application slug, no trailing slash.

Keycloak

  • KEYCLOAK_ID
  • KEYCLOAK_SECRET
  • KEYCLOAK_ISSUER: Must include the realm, e.g. https://keycloak/realms/My_Realm.

Generic OIDC

  • OIDC_NAME: Lowercase provider name (used for IDs and icons).
  • OIDC_CLIENT_ID
  • OIDC_CLIENT_SECRET
  • OIDC_WELL_KNOWN_URL: OpenID well-known discovery URL.
  • OIDC_ALLOW_DANGEROUS_EMAIL_LINKING: Optional flag to allow email-based account linking.

Web push notifications

Push notifications are disabled until VAPID keys are configured. Without them, the in-app notification toggle has no effect.

To enable push notifications:

  1. Generate a VAPID keypair, either with npx web-push generate-vapid-keys --json or the online tool at https://vapidkeys.com
  2. Set these env vars in .env:
    • WEB_PUSH_PUBLIC_KEY — generated public key
    • WEB_PUSH_PRIVATE_KEY — generated private key
    • WEB_PUSH_EMAIL — contact email as a bare address (e.g. you@example.com); the app prepends mailto: automatically
  3. Redeploy or restart your container.
  4. If you previously toggled notifications off in the PWA or system settings, re-enable them after redeploying.

Feedback email

  • FEEDBACK_EMAIL

Currency conversions

  • CURRENCY_RATE_PROVIDER: frankfurter, openexchangerates, or nbp.
  • OPEN_EXCHANGE_RATES_APP_ID: Required if using Open Exchange Rates.

Minimal examples

Email-only auth

DATABASE_URL="postgresql://postgres:strong-password@localhost:5432/splitpro"
NEXTAUTH_SECRET="<generated>"
NEXTAUTH_URL="https://splitpro.example.com"
FROM_EMAIL="SplitPro <no-reply@example.com>"
EMAIL_SERVER_HOST="smtp.example.com"
EMAIL_SERVER_PORT="587"
EMAIL_SERVER_USER="smtp-user"
EMAIL_SERVER_PASSWORD="smtp-password"

Google OAuth

DATABASE_URL="postgresql://postgres:strong-password@localhost:5432/splitpro"
NEXTAUTH_SECRET="<generated>"
NEXTAUTH_URL="https://splitpro.example.com"
GOOGLE_CLIENT_ID="<client-id>"
GOOGLE_CLIENT_SECRET="<client-secret>"

OIDC (Keycloak)

DATABASE_URL="postgresql://postgres:strong-password@localhost:5432/splitpro"
NEXTAUTH_SECRET="<generated>"
NEXTAUTH_URL="https://splitpro.example.com"
OIDC_NAME="keycloak"
OIDC_CLIENT_ID="<client-id>"
OIDC_CLIENT_SECRET="<client-secret>"
OIDC_WELL_KNOWN_URL="https://keycloak.example.com/realms/My_Realm/.well-known/openid-configuration"

Security notes

  • Rotate NEXTAUTH_SECRET if it is ever exposed.
  • Prefer _FILE suffix env vars when deploying with Docker secrets (supported for all values).
  • in order to lock down your instance, you should configure either your OAuth/ OIDC provider to only allow trusted users, or disable email signups and invites with DISABLE_EMAIL_SIGNUP=true.