BetaUpdated 2026-11-29
Application specs (preview)
Define entities, fields and routes, then compile a SQLite and auth/REST runtime.
An application spec is a JSON contract for the data and API behind a project. Ordeploy validates it and compiles a self-contained runtime: a SQLite schema, a Node HTTP server with owner-scoped CRUD endpoints and spec functions, and an OpenAPI document. App users sign up and sign in through Ordeploy (Studio → Backend, or createAppClient in the SDK); the runtime accepts their token.
Open the spec
- 1Open the project in Studio.
- 2Select App in the toolbar.
- 3Edit the JSON, then choose Validate & save.
- 4Choose Generate runtime to inspect schema.sql, server.mjs and openapi.json.
What is generated
| File | Contents |
|---|---|
| schema.sql | app_users (owners) and one table per entity, with owner_id, timestamps and typed columns |
| server.mjs | Node HTTP runtime using built-in SQLite: checks Ordeploy app tokens with this project's key, serves CRUD routes and POST /api/functions/:name (Node 22.5+) |
| openapi.json | OpenAPI 3.1 document for the generated routes |
Version history and migrations
- Every save records a version. The first save stores the full schema; later saves store generated SQLite migration SQL.
- New entities become create table statements. New fields become alter table ... add column plus a unique index when requested.
- Ordeploy never drops a table or column automatically. Removed fields, removed entities and type changes appear as comments for a manual decision.
- On activation the generated runtime applies pending migrations to a per-project SQLite file, so records survive switching deployments.
- Open App to read the migration history beside the spec.
Runtime console
- Activate a deployment with runtime hosting enabled, then open App.
- Register an app user or sign in with the app email and password.
- Pick an entity, list its records, or post a JSON record through the authenticated console proxy.
Runtime lifecycle
- A static deployment with an AppSpec also contains an api/ directory with schema.sql, server.mjs and openapi.json.
- On a trusted host with RUNTIME_HOSTING=true, activating the deployment starts one runtime per project on a loopback port and publishes a reverse-proxy route (runtime-<id>.<domain>) when Caddy hosting is configured; activating another deployment stops the previous runtime and route.
- Project deletion stops the runtime. Bubblewrap is required for isolation in production; RUNTIME_ALLOW_UNISOLATED is a development-only escape hatch. RUNTIME_MAX_INSTANCES and RUNTIME_MAX_MEMORY_MB bound concurrency and memory; the memory monitor stops a runtime that exceeds its budget.
- Each generated API allows 120 requests per minute per client by default (RUNTIME_RATE_LIMIT_PER_MINUTE) and answers 429 with Retry-After; health checks are exempt.
- GET or DELETE /v1/projects/<id>/deployments/<id>/runtime reads or stops the running instance.
Auth and ownership
- POST /auth/register creates an account and returns a bearer token.
- POST /auth/login verifies a scrypt password hash and issues a new token.
- GET /auth/me returns the signed-in user.
- Every /api/<entity> route requires the bearer token and only reads or writes rows owned by that user.
Spec rules
- Entity and field names start with a lowercase letter and use only a-z, 0-9 or _.
- Entity names are unique, and field names are unique within an entity.
- Route paths start with / and cannot contain two consecutive dots.
- Reserved table names such as app_users cannot be used as an entity.
[ Related ]
Was this page helpful?
