[ AxiomCore · Documentation ]
Acore language
What Acore is, how the Axiom CLI evaluates a .acore file, and which profile and output each project uses.
Acore is the declarative language you use to author AxiomCore contracts and
applications. One .acore file describes data, endpoints, user interfaces or
database schemas, and the Axiom CLI checks it and builds an artifact. Acore is
an independent language and does not need a Pkl runtime.
How a .acore file is evaluated
Diagram source
flowchart LR
A[".acore source"] --> B["Select profile from AxiomDeps.toml"]
B --> C["Parse"]
C --> D["Resolve import, amends and use"]
D --> E["Evaluate and check types"]
E --> F["Validate for the profile"]
F --> G[".axiom contract"]
F --> H[".axiom package"]
F --> I[".axiomapp application"]
F --> J["axiom eval output"]- Select the profile. The
typein the nearestAxiomDeps.tomlselects the grammar and rules. A file with no manifest type is a general module. Older backend sources that start withprofile backend 1are still read. - Parse. The parser keeps source spans so diagnostics and editors point at the authored text.
- Resolve.
importandamendsload other source or extractor input.use contractreads a compiled.axiomthrough the manifest and lock. An import cycle is an error. - Evaluate. Properties are lazy: a value is computed when something references or renders it. Source order is not execution order. Type annotations and constraints are checked.
- Validate. The profile applies its own rules, such as backend validators, domain and security analysis, or UI checks.
- Output. The command decides what is written or printed. A backend build
validates the contract schema and writes the canonical
.axiom; it does not dump arbitrary JSON. Acore UI lowers to a UI graph and a target bundle. For backend contracts, one named variant is applied before output.
Profiles
A declaration accepted by one profile is not automatically valid in another.
type in AxiomDeps.toml | What you author | Output | Continue with |
|---|---|---|---|
backend | Models, endpoints, actions, validation, policies | .axiom contract | Backend declarations |
frontend | Apps, pages, forms, state, queries, mutations, views | Local run or .axiomapp | Acore UI |
database | Tables, keys, relationships, constraints, schema versions | Offline database compiler output | Database contracts |
package | Theme, component-library, database-schema, extension and application-policy exports | .axiom package | Packages |
extension | Sandboxed extension projects | Signed extension package | Extensions |
| none | General modules: properties, classes, expressions | axiom eval output | Syntax |
Database sources go through the offline database compiler. General evaluation
of a database source fails with ADB158, because evaluation cannot acquire
migration authority.
Minimal sources
With type = "backend" in AxiomDeps.toml, axiom check main.acore prints
Valid backend contract: main.acore.
project(id: "hello-api", version: "1.0.0")
model Greeting { message: String }
endpoint hello(method: GET, path: "/hello") {
response(type: Models.Greeting)
}With type = "frontend", axiom ui check main.acore --target web checks this
module. The frontend quickstart adds the
run command.
module example.hello.ui
app Hello { route "/" => Home }
page Home {
view {
SafeArea { Text("Hello from Acore") }
}
}Extraction starts from an explicit source. Install the FastAPI extractor first, then follow the FastAPI guide.
amends "axiom-fastapi:./main.py:app"
project(id: "tasks-api", version: "0.1.0")
policies(retry: RetryPolicy(maxAttempts: 3))The Acore schema reference lists exact fields and defaults.
Commands that read Acore
| Command | Use it to |
|---|---|
axiom eval FILE | Evaluate any module and print the result. -f json, -f yaml or -f md; anything else prints PCF. -v NAME selects a backend variant. |
axiom check [FILE] | Validate a backend, frontend or database contract without writing outputs. It rejects a general module ('project' block missing). |
axiom build [FILE] | Build a contract under .axiom/contracts, or export with --out. |
axiom explain [FILE] | Print expanded backend JSON. --schema prints the declaration catalog; --provenance adds source spans, defaults and policy origins. |
A general module and its evaluated output:
module example.config
name = "orders"
port: Int = 8080
retry { attempts = 3 }
hidden secretSuffix = "internal"axiom eval config.acore -f json{
"name": "orders",
"port": 8080,
"retry": {
"attempts": 3
}
}Rendered output sorts keys and omits null values, hidden and local
properties, names that start with _, functions and a property named output.
To render one value instead of the whole module, set output { value = settings }.
PCF, the default format, is the canonical text form used by the toolchain.
The language library also has XML and Protocol Buffers renderers, but
axiom eval does not select them. -f md is meant for contracts: it prints API
documentation with a Mermaid route diagram.
Authority and imports
Evaluation runs under a security manager that controls module, file,
environment and package access. A path in source is a request for access, not
proof of authority. Evaluation does not fetch network modules. A compiled
.axiom is not source: import and amends reject it, and you consume it with
use contract through a manifest and lock. Declarative .axiom packages do not
gain execution authority. An extension package carries metadata, requested
capabilities and a digest for separately distributed code; running that code is
a separate host decision.
Errors
| Error | Meaning |
|---|---|
Parse Error | The source does not match the grammar. |
Evaluation error | A value could not be computed, such as an undefined name. |
Type mismatch | A value does not match its declared type or constraint. |
Division by zero | An integer divided by zero. A float divided by zero is infinite and cannot be rendered. |
Security violation | The security manager denied a module or resource. |
I/O Error | A file could not be read. |
AXB001, AXB002, AXB004 to AXB007 | Backend profile diagnostics: syntax (AXB001), declaration or argument shape (AXB002), unresolved reference (AXB004), extractor input not cached (AXB005), server-plan rule (AXB006), expression (AXB007). |
Commands add their own codes for artifact, runtime, UI, package and Cloud
boundaries. Use the narrowest check that does not write files, for example
axiom doctor --json, axiom check, axiom domain validate,
axiom security check or axiom ui check main.acore --target web. Not every
source needs every check.
Reproducible builds
An artifact is reproducible only when the source, resolved dependencies, compiler version, target and build mode are all the same. Commit dependency locks and record build provenance. Matching top-level source alone does not make two builds identical.
Read the reference
| Page | Covers |
|---|---|
| Syntax | Modules, comments, keywords, properties, declarations, authoring shortcuts |
| Values, types and operators | Literals, types, operators, null handling, expressions |
| Objects, classes and functions | Objects, classes, scope, lambdas, pure functions |
| Imports, amends and variants | import, use, amends, entity, variants |
| Validation | Constraints, validators, codecs, limits |
| Managed logic and concurrency | Actions, failures, transactions, parallel groups, policies |
| Streams and WebSockets | Stream declarations and bounded views |
| Standard library | Modules and built-in members |
| Domain and security models | Entities, projections, invariants, security policy |