Skip to Content
Apso is in public beta. Get started
GuidesToolsApso CLIConfiguration

.apsorc Configuration

The CLI reads .apsorc from the current directory or a parent directory. Keep this JSON file at the project root and commit it with the generated source.

Complete shape

.apsorc
{ "version": 2, "language": "typescript", "rootFolder": "src", "apiType": "Rest", "http": true, "emitEvents": false, "coAuthor": true, "auth": { "provider": "better-auth" }, "entities": [ { "name": "Project", "table": "projects", "primaryKeyType": "uuid", "created_at": true, "updated_at": true, "scopeBy": "workspaceId", "fields": [ { "name": "name", "type": "text" }, { "name": "status", "type": "enum", "values": ["Active", "Archived"], "default": "Active" } ], "indexes": [], "uniques": [] }, { "name": "Task", "fields": [ { "name": "title", "type": "text" }, { "name": "priority", "type": "integer", "default": 3 } ] } ], "relationships": [ { "from": "Task", "to": "Project", "type": "ManyToOne", "cascadeDelete": true } ] }

Only include auth, scoping, event, and table settings that the service needs.

Top-level properties

PropertyTypeDefaultUse
versionnumber1 for legacy filesSet 2 for new projects.
languagestringpromptSelect typescript, python, or go. apso generate --language can override it.
rootFolderstringsrcSelect the generated source root.
apiTypestringRestSelect REST or, where supported, GraphQL generation.
entitiesarray[]Define database models and generated resource layers.
relationshipsarray[]Connect entities using version 2 relationship objects.
authobjectnoneConfigure Better Auth, custom sessions, JWT, or application API-key auth.
httpbooleantrueSet the top-level default for generated HTTP controllers.
emitEventsbooleanfalseSet the top-level default for domain events on entity writes.
coAuthorbooleantrueOpt out of the Apso commit co-author hook when set to false.

Entity properties

PropertyTypeDefaultUse
namestringrequiredSet the framework class and default resource name.
tablestringsnake-case nameOverride the database table name.
fieldsarray[]Define stored columns and validation input.
primaryKeyTypestringserialSelect serial or uuid.
created_atbooleanfalseGenerate a managed creation timestamp.
updated_atbooleanfalseGenerate a managed update timestamp.
indexesarray[]Define indexes.
uniquesarray[]Define composite unique constraints.
scopeBystring or arraynoneSelect fields or paths used for authorization scope.
scopeOptionsobjectdefaultsControl create injection, enforced operations, and bypass roles.
httpbooleantop-level valueOverride HTTP generation for one entity.
emitEventsbooleantop-level valueOverride domain-event generation for one entity.

Field shape

{ "name": "amount", "type": "decimal", "precision": 12, "scale": 2, "nullable": false, "index": true }

Fields support name, type, values, nullable, index, primary, unique, default, length, precision, scale, and is_email. See Field Types for compatibility and examples.

Relationship shape

{ "from": "Task", "to": "Project", "type": "ManyToOne", "to_name": "project", "nullable": false, "cascadeDelete": true, "index": true }

Supported types are OneToMany, ManyToOne, ManyToMany, and OneToOne. Define each conceptual relationship once. The generator creates the inverse side where required.

Relationship objects can also set bi_directional, joinTableName, joinColumnName, and inverseJoinColumnName for join-table control.

Validate and generate

apso schema validate apso generate

To validate a linked project without calling the platform validator, use local-only validation:

apso schema validate --local

.apsorc is JSON. Do not add comments, trailing commas, or environment variable interpolation unless the selected generator explicitly documents it.

Last updated on