Get started

Maintenance and monitoring

How to watch a running installation, keep it tidy, and find problems quickly.

Health checks

EndpointMeaningUse for
GET /api/v1/healthThe API process respondsLiveness probes
GET /api/v1/health/readyThe database is reachable (otherwise 503)Readiness checks, load balancers, uptime monitors

Both Docker images define health checks, so docker compose ps shows their status.

Logs

The API writes one JSON object per line to standard output:

json
{"level":30,"time":1794589661477,"req":{"id":"7f0c2d…","method":"GET","path":"/api/v1/entities/article/records"},"tenantId":"…","actor":"user","res":{"statusCode":200},"responseTime":16,"msg":"request completed"}
  • Every response has an x-request-id header. Clients can send their own id (8 to 128 characters of letters, digits, . _ -) to correlate requests.
  • Server errors return error.requestId. Ask users for it, then search the logs.
  • Never logged: request bodies, query strings, passwords, cookies, API keys, CSRF and setup tokens.
  • Health checks are not logged.

Collect logs with your Docker logging driver or any log stack (Loki, ELK, CloudWatch, Datadog). For local development set LOG_FORMAT=pretty.

Usage and quotas

GET /api/v1/admin/usage (admins) returns the workspace's records, entities, media files and bytes, members, API keys and limits:

json
{ "data": { "records": 1520, "entities": 6, "media": { "files": 84, "bytes": 51234567 },
            "members": 4, "apiKeys": 2, "limits": { "maxRecords": null, "maxMediaBytes": 1073741824 } } }

Set TENANT_MAX_RECORDS and TENANT_MAX_MEDIA_BYTES to cap workspaces. When a limit is reached, new records or uploads fail with 403 QUOTA_EXCEEDED. Trashed items don't count.

Scheduled maintenance

Run the maintenance job once a day:

bash
# Docker
docker compose --env-file .env.production -f docker-compose.prod.yml run --rm maintenance
# Native
pnpm maintenance

It:

  • deletes expired sessions;
  • removes audit events older than AUDIT_RETENTION_DAYS (365);
  • permanently deletes records and media that have been in the trash longer than TRASH_RETENTION_DAYS (30). References to purged records are removed from other records.

It prints a JSON summary, for example {"maintenance":{"expiredSessions":12,"auditEvents":0,"purgedRecords":3,"purgedMedia":1}}.

Troubleshooting

SymptomCause and fix
API exits with Invalid environment configurationA variable is missing or malformed. The message names it
Signing in works but you are signed out againCOOKIE_SECURE=true over plain HTTP. Use HTTPS, or set it to false for local testing only
All users hit the same rate limitBehind a proxy without TRUST_PROXY=true
/health/ready returns 503Database down or wrong DATABASE_URL
Data seems missing when querying PostgreSQL by handRow-level security hides rows without a workspace context. Use a BYPASSRLS role for manual queries
429 RATE_LIMITED on loginMore than 10 attempts per minute from one IP. Wait for Retry-After
PLUGIN_TIMEOUTA plugin hook is too slow. Check its logs or raise PLUGIN_HOOK_TIMEOUT_MS
Upload rejected with MEDIA_CONTENT_MISMATCHThe file's content doesn't match its type, for example a renamed file
Forgot the only owner's passwordUpdate the password hash in the database as a superuser, or ask another owner to add you again

ByteContent by ByteRings is open source under the MIT License. Edit on GitHub