Skip to content
SynthGraph

Operate

Backend configuration

Every setting the backend and the dashboard read.

Every setting the backend and the dashboard read, with what it does. Settings are environment variables.

Backend#

VariableRequiredDefaultWhat it does
DATABASE_URLyesnoneThe PostgreSQL connection string. The backend will not start without it.
JWT_SECRETin productionnoneSigns the short-lived tokens used for dashboard sign-in. In production the backend refuses to start if it is unset or is dev-only-change-me. There is no strength check beyond that, so use a long random value.
PORTno3000The port it listens on, on all interfaces.
NODE_ENVnononeproduction turns on the JWT_SECRET check and changes the CORS default (below).
CORS_ALLOWED_ORIGINSnounsetA comma-separated list of browser origins allowed to call the API directly.
DISABLE_API_DOCSnounsetSet to true to stop serving the interactive reference at /docs.

CORS#

If CORS_ALLOWED_ORIGINS is set, only those origins are allowed. If it is not set, CORS is open outside production and closed in production.

You need it only if a third-party web page calls the API from a visitor's browser. The dashboard calls the backend from its own server, and the SDK and the CLI are not browsers, so none of them need CORS.

Tokens#

Dashboard sign-in tokens last 15 minutes. Everything that reads or writes your research data uses API keys, not these tokens.

Dashboard#

VariableRequiredWhat it does
SYNTHGRAPH_API_URLyes, in practiceWhere the backend is. Read on the server only. It falls back to http://localhost:3000.
NEXT_PUBLIC_SITE_URLfor the public siteThe site's public address, used for links, the sitemap and social previews.
BACKEND_FETCH_TIMINGnoSet to 1 to log how long each backend call takes.

The demo-request form of the public website also reads RESEND_API_KEY, DEMO_NOTIFY_TO, DEMO_NOTIFY_FROM, DEMO_FORM_ENDPOINT and DEMO_FORM_TOKEN. A dashboard does not need any of them.

The SDK and the CLI#

They read SYNTHGRAPH_API_KEY, SYNTHGRAPH_API_URL and a few more. See Installation and configuration.

Database and migrations#

The schema is changed only by migrations, never automatically. From synthgraph-backend, with DATABASE_URL set:

npm run migration:show     # which migrations have run
npm run migration:run      # apply the pending ones
npm run migration:revert   # undo the most recent one

Update in this order: back up, run the migrations, then start the new backend. The migrations so far only add to the schema. Reverting one drops what it added, along with the data in it.

Health check#

GET /health needs no key and is never rate-limited. It answers {"status":"ok","service":"synthgraph-backend", ...}. It does not touch the database.

Limits#

LimitValue
Requests per API key120 a minute
Requests per IP address3,000 a minute
Sign-in and sign-up10 a minute per IP address
List page size1 to 200, default 100

They are held in memory, so each running instance counts for itself.