[ AxiomCore · Documentation ]
Databases
Declare PostgreSQL or SQLite schemas in Acore, apply versioned migrations with the Axiom CLI and give a backend typed storage.
An Acore database contract declares the schema you want and its version. The Axiom CLI checks and builds it offline, applies it to a PostgreSQL or SQLite database as a versioned migration, and reports status and history. An Acore backend then reads and writes those tables through typed storage declarations instead of SQL strings.
The contract lifecycle
Diagram source
flowchart TD
A[Schema and version in Acore] --> B[axiom database check and build]
B --> C[axiom database migrate]
C --> D[status and history]
D --> E{Next change}
E -->|Edit the schema| F[New version in source]
F --> B
E -->|Undo| G[rollback publishes a new version]
G --> D
D --> H[Backend storage declarations]
H --> I[Typed application storage]- Declare the schema in an
.acorefile beside anAxiomDeps.tomlwithtype = "database".project(id: ..., version: ...)names the contract and its version. - Check and build offline with
axiom database checkandaxiom database build. Neither connects to a database. - Migrate with
axiom database migrate(oraxiom run). The change is validated on a disposable copy, then applied as one versioned migration. - Observe with
status(applied and working versions, pending changes, drift) andhistory(migrations, compensating rollbacks, failed attempts). - Change or undo. Every schema change needs a new version.
rollbackpublishes another new version; it never rewrites history or restores deleted values. - Use the tables from a backend through
storagedeclarations. The CLI checks them against the compiled schema and migrates the linked database before the backend accepts requests.
Validation and review always come before a change reaches your database. Keep backups and test recovery for data you need to retain.
From a request to a table
Diagram source
flowchart LR
A[GET /tasks endpoint] --> B[listTasks action]
B --> C[Resources.tasks.list operation]
C --> D[storage tasks: select list]
D --> E[main.tasks table]In the task app, the endpoint calls a managed action. The
action awaits a resource operation, and the storage declaration implements
that operation as a typed select on main.tasks. The runtime binds every
input as a parameter and adds the authenticated tenant to the query. You never
write SQL text for application queries.
Choose an engine
| SQLite | PostgreSQL | |
|---|---|---|
| Supported versions | SQLite 3.37 or newer | PostgreSQL 17 and 18 |
| Target | A local file. migrate and run create it. | An existing server you can reach. The CLI never provisions, starts or restarts it. |
| Connection | --database-file, a sqlite: URL, or the project's default file | --database-url, DATABASE_URL, or host, port, database and user fields |
| Pre-apply validation | On a copy of the file, including a populated backup for table rebuilds | On a disposable PostgreSQL of the same major version: bundled with the Linux CLI archives (PostgreSQL 17), otherwise a matching local installation |
| Checked platforms | macOS arm64 and Linux arm64 acceptance | Declared Unix platforms |
Both engines use the same commands, version rules and storage declarations. Windows, hosted-provider capabilities and nontransactional migration stages keep their own qualification gates. There is no MySQL or MariaDB adapter.
Where database work runs
| Path | What it shows | Status |
|---|---|---|
| Axiom CLI against SQLite or PostgreSQL | Real migrations, history and typed application storage on your target | Experimental |
| Browser preview in the playground | Simulated storage and history; no native migration, file or connection | Experimental |
| Fleet delivery | Reviewed, frozen rollout to many enrolled targets | Experimental |
| Named PostgreSQL production profile | Admission for one exact build, platform and recovery procedure | Available |
A passing browser preview does not prove database persistence, and a local run does not qualify a production deployment.
Next steps
- Create your first database with SQLite.
- Read the database contract reference.
- Connect a backend in Migrations and persistence.
- Keep an existing schema with the existing database guide.
App lifecycle and targets
Create, check, run, test, build and package one Acore UI app for web, Android Emulator and iOS Simulator with the axiom ui commands.
Database contracts
Reference for Acore database contract files, versions, PostgreSQL and SQLite schemas, connections, the SQL console, commands and diagnostics.