Skip to content

Advanced Users

Welcome back to another jam session: Advanced Workflows.

If you read the introduction you learned that model.js are the leader singers of alab. In the following section you we are going to take a tour to the backstage and take this from a band to an orchestra.

OpenAPI is the language of the internet. Within Alab, it serves as the conductor, orchestrating every section to play in sync.

By using v3 extensions AstrolaDB includes x-db fields in your Model(Table) and Fields(Columns). These extensions turn a standard OpenAPI spec into a complete database blueprint that any tool, language or framework can consume.

At the schema level (per table), x-db carries:

FieldTypeDescription
tablestringFully qualified table name (e.g. auth_user)
namespacestringSchema namespace (e.g. auth)
primary_keystring[]Primary key column(s)
timestampsbooleanWhether the table has created_at / updated_at
soft_deletebooleanWhether the table uses deleted_at
auditablebooleanWhether the table tracks created_by / updated_by
sort_bystring[]Default ORDER BY columns for queries
searchablestring[]Columns marked for full-text search indexing
filterablestring[]Columns available for query filtering
indexesobject[]Index definitions (unique, composite, primary)
join_tableobjectJoin table metadata (only on many-to-many tables)
relationshipsobjectRelationship map (has_one, has_many, many_to_many)

At the property level (per column), x-db carries:

FieldTypeDescription
sql_typeobjectNative SQL type per dialect (postgres, sqlite)
semanticstringColumn role hint (id, username, flag, etc.)
defaultanyDefault value or expression (e.g. {"expr": "NOW()"})
auto_managedbooleanWhether adapters must manage this column
generatedbooleanWhether the value is auto-generated (e.g. UUID id)
refstringReferenced table name
fkstringFull foreign key path (e.g. auth_user.id)
on_deletestringReferential action on delete (e.g. CASCADE)
on_updatestringReferential action on update
relationstringRelationship name derived from the column
inverse_ofstringInverse relationship (source table name)
virtualbooleanWhether this is a computed/virtual column
computedobjectComputed column expression
polymorphicobjectPolymorphic relationship metadata

Most tools use OpenAPI just for documentation. AstrolaDB uses it as a Rich Metadata Manifest. By embedding x-db tags into the standard OpenAPI spec, it creates a portable brain of your database — types, constraints, relationships, indexes, and SQL details all in one file.

Since almost every language on earth speaks JSON, your automation is truly portable. AstrolaDB is essentially a Metadata Factory that feeds the rest of your ecosystem:

  • Generate typed clients: in any language with QuickType; x-db extensions stay intact.
  • Build custom adapters: ORM, REST, or GraphQL from a single JSON.
  • Automate infrastructure: CI, migration checks, and docs all parse the same spec.
  • Feed AI agents: LLMs or code generators understand your entire DB without source access.