Skip to content

Configuration

Every setting of the engine and of a project, with its default, and every command of the engine's binary.

Applies to Engine
View as Markdown
On this page
  1. The engine
  2. Sypnia Cloud’s own
  3. Several projects
  4. The engine’s commands
  5. sypnia-data serve
  6. sypnia-data health
  7. sypnia-data install
  8. sypnia-data provision
  9. sypnia-data keys rotate
  10. sypnia-data keys api-key
  11. sypnia-data users create
  12. sypnia-data registry seal
  13. sypnia-data tick
  14. The events function
  15. A project

Two kinds of settings: the engine’s, from the environment, and each project’s, kept in its database and changed with the admin API (/auth/v1/admin/settings) or the console.

The engine

VariableDefaultWhat
SYPNIA_DATA_MASTER_KEY— (required unless KMS)32 bytes, base64; encrypts signing keys and credentials
SYPNIA_DATA_MASTER_KEY_KMS—instead of the master key: the master key encrypted with AWS KMS (aws kms generate-data-key, ciphertext blob, base64); the engine decrypts it at start-up
SYPNIA_DATA_KMS_KEY_ID—the KMS key that seals each project’s database connection in the registry (Sypnia Cloud)
SYPNIA_DATA_PUBLIC_URLhttp://localhost:8080the address people reach; used in e-mail links and token iss
DATABASE_URL—one project’s database, as a user that can install
DATABASE_URL_AUTHENTICATOR, DATABASE_URL_ADMIN—instead of DATABASE_URL, after a manual install
SYPNIA_DATA_PROJECTS_FILE—projects.toml: several projects (below)
SYPNIA_DATA_LISTEN0.0.0.0:8080server mode
SYPNIA_DATA_POOL_MAX2 on Lambda, 10 otherwiseconnections per project per instance
SYPNIA_DATA_TICKexternalinternal: run e-mail retries and cleanup every minute in-process; external: run sypnia-data tick yourself, or the events function
SYPNIA_DATA_MAX_ROWS1000rows per Data API response
SYPNIA_DATA_MAILnonethe engine’s own sender: smtp, resend, postmark, ses, none
SYPNIA_DATA_SMTP_URL—smtps://user:pass@host:465
SYPNIA_DATA_RESEND_API_KEY, SYPNIA_DATA_POSTMARK_TOKEN—HTTP providers
SYPNIA_DATA_SES_REGIONthe instance’s regionSES with the instance’s AWS credentials
SYPNIA_DATA_SES_CONFIGURATION_SET—the SES configuration set whose bounces and complaints reach the events function
SYPNIA_DATA_MAIL_FROM—Name <address>; the project’s name replaces Name
SYPNIA_DATA_MAIL_DEFAULT_REFSall projectsthe projects that may send through the engine’s own sender, comma-separated (* = all). The others need their own provider. Sypnia Cloud: sypnia
SYPNIA_DATA_MAIL_DEFAULT_HOURLY_CAP0 (no cap)e-mails per hour per project through the engine’s own sender; past it, 429 rate_limited
SYPNIA_DATA_MAIL_UNCAPPED_REFS—projects exempt from that cap, comma-separated
SYPNIA_DATA_LOGinfodebug, info, warn (JSON lines on stdout)
SYPNIA_DATA_INSTALL_ON_STARTfalsetrue: serve installs or upgrades the schema in DATABASE_URL first, waiting for the database (the Docker and AWS setups use it)
<NAME>_SSM—for DATABASE_URL, SYPNIA_DATA_MASTER_KEY, SYPNIA_DATA_SMTP_URL, SYPNIA_DATA_RESEND_API_KEY, SYPNIA_DATA_POSTMARK_TOKEN, SYPNIA_DATA_ORIGIN_SECRET: the name of an SSM SecureString read at start instead of the value
SYPNIA_DATA_DATABASE_SECRET_ARN—a Secrets Manager secret {username, password} (the RDS format); with SYPNIA_DATA_DATABASE_HOST, _PORT (5432) and _NAME (postgres) it becomes DATABASE_URL with TLS
SYPNIA_DATA_ORIGIN_SECRET—when set, requests must carry X-Sypnia-Origin with this value, or get 403 direct_access (put it on your CDN, so nobody can skip it)
SYPNIA_DATA_MCP_URL<SYPNIA_DATA_PUBLIC_URL>/mcpwhere the MCP server answers; also its OAuth resource indicator
SYPNIA_DATA_ACCOUNT_PROJECT—the project whose users are accounts with organizations (cloud.* tables), so their tokens reach their organizations’ projects through MCP (Sypnia Cloud: sypnia)
SYPNIA_DATA_CONTROL_PLANE_URL—the control plane MCP’s create_project calls (Sypnia Cloud: https://data.api.sypnia.com)
SYPNIA_DATA_ROLE—events: on Lambda, this function handles the minute tick, SES bounces from SNS and the control actions instead of HTTP
SYPNIA_DATA_OFFLINE—set: skip the breached-password lookup (an engine without internet access)
SYPNIA_DATA_NEW_PASSWORD—read only by sypnia-data users create: the new user’s password

Sypnia Cloud’s own

The same binary runs Sypnia Cloud with a few more settings. You do not need them to self-host:

VariableWhat
SYPNIA_DATA_REGISTRY_URL (or _SSM)the database that holds cloud.projects, the registry of hosted projects (read every 60 s)
SYPNIA_DATA_PROJECT_DOMAIN<ref>.<domain> is a project: data.sypnia.com
SYPNIA_DATA_PROJECTS_SSMan SSM SecureString with a JSON array of projects outside the registry, with the fields of projects.toml (Sypnia’s own project at auth.sypnia.com)
SYPNIA_DATA_MASTER_URL, SYPNIA_DATA_PROVISIONER_URL_SSMthe shared Postgres server where provision creates managed databases

Several projects

A self-hosted engine serves one project, default, from DATABASE_URL, on any host. To serve several, list them in projects.toml:

projects.toml
[[project]]
ref = "shop"
host = "api.laespiga.co"
database_url = "postgres://sypnia_admin:…@db.example.com:5432/shop?sslmode=verify-full"

[[project]]
ref = "admin"
hosts = ["admin-api.laespiga.co", "admin-api.internal"]
public_url = "https://admin-api.laespiga.co"
database_url_admin = "postgres://sypnia_admin:…@db.example.com:5432/admin"
database_url_authenticator = "postgres://sypnia_authenticator:…@db.example.com:5432/admin"
FieldWhat
refthe project’s name: a slug, used in keys (syp_pk_<ref>_…) and tokens
host, hoststhe hosts that reach it
public_urlits address; by default https:// and its first host
database_urla user that can install; or the two below
database_url_admin, database_url_authenticatorafter a manual install
admin_role, authenticator_rolerole names other than sypnia_admin and sypnia_authenticator

Each project keeps its own database, keys and settings.

The engine’s commands

The binary is sypnia-data. Every command reads the environment above.

sypnia-data serve

Engine
Serves HTTP on SYPNIA_DATA_LISTEN, or the Lambda runtime when it runs in AWS Lambda. It is also what the binary does with no command.

Flags

  • --install
    boolean optional
    Install or upgrade the schema in DATABASE_URL first (SYPNIA_DATA_INSTALL_ON_START).

    Default: false

sypnia-data health

Engine
Exits 0 when the local server answers /health with 200. The container’s healthcheck (the image has no curl).

sypnia-data install

Engine
Installs or upgrades the engine’s schemas and roles in DATABASE_URL. Safe to run again: it applies only what is missing.

Flags

  • --print-sql
    boolean optional
    Print the SQL for a database administrator instead of running it.

    Default: false

  • --ref
    string optional
    Use the role names of a managed project (sd_<ref>_admin, sd_<ref>_authenticator).

sypnia-data provision

Engine
sypnia-data provision <ref> creates a managed project’s database and roles on the server of SYPNIA_DATA_MASTER_URL and prints its sealed registry value. With --static-ssm <parameter> --host <host> [--public-url <url>] it registers the project in that SSM parameter instead.

sypnia-data keys rotate

Engine
Publishes a new signing key; it signs 24 hours later.

Flags

  • --project
    string optional
    The project’s ref.

    Default: default

sypnia-data keys api-key

Engine
Creates an API key and prints it once.

Flags

  • --project
    string optional
    The project’s ref.

    Default: default

  • --kind
    string optional
    publishable or secret.

    Default: publishable

  • --name
    string optional
    A name for the key.

sypnia-data users create

Engine
sypnia-data users create <email> creates a confirmed user, with the password in SYPNIA_DATA_NEW_PASSWORD, or «e-mail first» when it is not set.

Flags

  • --project
    string optional
    The project’s ref.

    Default: default

sypnia-data registry seal

Engine
sypnia-data registry seal <ref> reads a value from stdin and prints it sealed for that project’s registry row.

sypnia-data tick

Engine
Runs the minute’s work once for every known project: e-mail retries and the cleanup of expired tokens, assertion ids and old audit rows.

The events function

On AWS, the function with SYPNIA_DATA_ROLE=events runs the minute tick and the SES bounce handling, and answers these actions when invoked directly (IAM decides who may invoke it):

actionTakesDoes
api_keyref, kind, name?, protected?creates an API key: { id, key, protected }
protect_keyref, idmarks an existing key protected
rotate_protected_keyref, idreplaces a protected key: { id, key }
upgraderefapplies the engine’s pending migrations to the project
provisionrefcreates a managed database on the shared server
install_byoref, urlinstalls the engine in your own Postgres
deprovisionrefdrops a managed project’s database and roles
Terminal
aws lambda invoke --function-name my-data-events --cli-binary-format raw-in-base64-out \
  --payload '{"action":"api_key","ref":"default","kind":"publishable"}' /dev/stdout

A project

Kept in sypnia_data.settings, one row per key. Read them with GET /auth/v1/admin/settings and change any of them with PATCH /auth/v1/admin/settings and a secret key; an object is merged into the stored one, and credentials come back as "[redacted]". Changes apply within a minute.

SettingDefaultWhat
session_policy{ access_token_ttl: 3600, session_lifetime: null, inactivity_timeout: null, single_session: false, refresh_reuse_interval: 10 }how long sessions live; null is never
require_email_confirmationtruesign-up needs a confirmed e-mail
signup_opentruefalse closes sign-ups (403 signup_disabled); admins still create and invite users
password_policy{ min_length: 10, require: [], breached_check: true }require: any of lower, upper, digit, symbol
site_url—your app’s address: the default return of e-mail links
redirect_urls[]allowed redirect_to values: exact addresses or patterns such as https://*.myapp.com/**
providerse-mail onemail (true or false), google and github ({ enabled, client_id, client_secret })
mailno providerthe e-mail provider
templatesthe engine’se-mail templates per type and language
captchanone{ provider: "turnstile" | "hcaptcha", secret }
exposed_schemas["public"]the schemas the Data API serves
rate_limitssee protectionssignup_per_hour_per_ip, otp_per_hour_per_email, otp_per_hour_per_ip, password_per_5min, refresh_per_hour_per_session, oauth_token_per_min_per_client
dynamic_client_registrationfalseopen dynamic client registration
cross_subdomainnone{ domain: ".example.com" }: one session across your apps
otp_ttl3600lifetime of links and codes, 300 to 86 400 seconds
project_namethe refthe name e-mails show
device_verification_urithe engine’s /auth/v1/deviceyour page where a person approves a device code (Sypnia Cloud: https://data.app.sypnia.com/device)
consent_urlthe engine’s /auth/v1/oauth/consentyour page where a person approves an OAuth client
cors_origins[]origins that may use the session cookie, patterns such as https://*.example.com

An unknown key answers 400 unknown_setting; a session policy out of range, 400 invalid_session_policy.

  1. The engine
  2. Sypnia Cloud’s own
  3. Several projects
  4. The engine’s commands
  5. sypnia-data serve
  6. sypnia-data health
  7. sypnia-data install
  8. sypnia-data provision
  9. sypnia-data keys rotate
  10. sypnia-data keys api-key
  11. sypnia-data users create
  12. sypnia-data registry seal
  13. sypnia-data tick
  14. The events function
  15. A project

    Search pages, sections and terms