Comparison
| Backend | Use case | Durability | Requires |
|---|---|---|---|
| In-memory | Development, testing | None — all state is lost on restart | Nothing |
| JSON file | Small or single-node deployments | File system | SERVICENET_REGISTRY_FILE |
| PostgreSQL | Production | Full ACID durability | SERVICENET_DATABASE_URL + SERVICENET_SECRET_BROKER_KEY |
In-Memory (Default)
When you start the node without any storage configuration, it defaults to in-memory storage. All registry state, providers, agents, and submissions exist only for the lifetime of the process.In-memory mode is intentionally stateless. Use it for local development, integration tests, and CI pipelines where persistence is not needed.
JSON File Backend
SetSERVICENET_REGISTRY_FILE to a file path to enable file-backed persistence. The node creates the file and its parent directories automatically if they do not exist. State survives restarts.
PostgreSQL Backend
PostgreSQL is the recommended backend for production. It provides full ACID durability across all registry, receipt, health, trust, audit, and auth-context tables, and is required for encrypted secret broker storage.Start a PostgreSQL instance
You can use any PostgreSQL 14+ server. For local development, the included Docker Compose file starts one for you.
Generate a secret broker key
The PostgreSQL backend requires a 32-byte base64-encoded encryption key for auth-context secrets:
Docker Compose
The includeddocker-compose.yml wires up a PostgreSQL 16 container alongside the ServiceNet node. Use it as a reference for your own deployment:
Running PostgreSQL Integration Tests
To run the integration test suite against a local PostgreSQL instance:PostgreSQL mode automatically enables provider ownership challenges (
SERVICENET_REQUIRE_PROVIDER_OWNERSHIP_CHALLENGES=1). Auth-context secret storage is only available in PostgreSQL mode and always requires SERVICENET_SECRET_BROKER_KEY.Switching Backends
You can switch backends between restarts, but note:- In-memory → file or PostgreSQL: no migration needed; the node starts with an empty registry in the new backend.
- File → PostgreSQL: existing JSON file data is not automatically migrated to PostgreSQL. You must re-register providers and agents against the new backend.
- PostgreSQL → file or in-memory: existing PostgreSQL data is not accessible from the other backends.