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#
| Variable | Required | Default | What it does |
|---|---|---|---|
DATABASE_URL | yes | none | The PostgreSQL connection string. The backend will not start without it. |
JWT_SECRET | in production | none | Signs 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. |
PORT | no | 3000 | The port it listens on, on all interfaces. |
NODE_ENV | no | none | production turns on the JWT_SECRET check and changes the CORS default (below). |
CORS_ALLOWED_ORIGINS | no | unset | A comma-separated list of browser origins allowed to call the API directly. |
DISABLE_API_DOCS | no | unset | Set 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#
| Variable | Required | What it does |
|---|---|---|
SYNTHGRAPH_API_URL | yes, in practice | Where the backend is. Read on the server only. It falls back to http://localhost:3000. |
NEXT_PUBLIC_SITE_URL | for the public site | The site's public address, used for links, the sitemap and social previews. |
BACKEND_FETCH_TIMING | no | Set 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 oneUpdate 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#
| Limit | Value |
|---|---|
| Requests per API key | 120 a minute |
| Requests per IP address | 3,000 a minute |
| Sign-in and sign-up | 10 a minute per IP address |
| List page size | 1 to 200, default 100 |
They are held in memory, so each running instance counts for itself.