API Overview
The DPG API lives in apps/api. It is a Fastify service that uses the network schema as runtime contract for item validation, inter-instance reads, action creation, action events, and schema discovery.
What The API Does
Section titled “What The API Does”- validates requests with Zod through
fastify-type-provider-zod - exposes OpenAPI and Scalar docs at
/api/reference - stores items, actions, and events in PostgreSQL
- uses Redis for short-lived fetch caches
- loads network configs from local files, remote URLs, or schema registry URLs
- validates
item_state, action requirements, and event payloads with JSON Schema - supports one backend serving one or many
network/domainbindings - supports cross-instance item fetch and action/event mirroring
Guide Pages
Section titled “Guide Pages”| Page | Use it for |
|---|---|
| Running And Docker | Local commands, Docker image, and runtime env |
| Auth | Auth middleware behavior and Better Auth mount points |
| Items | Create, fetch, update, validation, ownership, and partitions |
| Network Fetch | Inter-instance item fetch, count/fetch local endpoints, and caching |
| Actions And Events | Action creation, target-side storage, status updates, event mirroring |
| Schemas And Cache | Network schemas, custom schemas, cache refresh, and schema routes |
| Route Reference | Compact list of mounted API endpoints |
Mounted Route Groups
Section titled “Mounted Route Groups”GET //api/auth/*/api/v1/item/*/api/v1/action/*/api/v1/event/*/api/v1/network/*The root endpoint returns service health plus the served domain bindings and network config source.
Current Constraints
Section titled “Current Constraints”- protected routes require auth unless local development disables auth middleware
- production always enables auth middleware
SERVED_DOMAINSdecides whichnetwork/domainpairs an instance may serve- network-wide fetch relies on
instances[]in the network config - action validation relies on
actions[<name>].interactions - the current UI focuses on
connect, but the API can accept any configured action type