YouBothAgent▾
You — Business rules and flows you own. Read these yourself.
Both — Know the idea; your agent follows the details.
Agent — Conventions and references your agent follows. Look up as needed.
General▾
Interface▾
Observability▾
Constant Schema Docs
You do not have to write a data model spec by hand.
Constant.Doc reads every model registered in ConstantRegistry and draws field tables and a relation diagram from it.Words used on this page
TermDescription
refName
A model's name in code, such as
user or bizContract. You pick models by it.variant
One of the five classes a model declares: Input, Object, Light, Full and Insight.
scalar
A value object stored inside another model, declared under
lib/__scalar/.enum
A fixed list of allowed values, declared with
enumOf(...).The parts
ComponentDescription
Constant.Doc.Zone
An explorer for the screen, with search, a table or diagram view and a tab per variant.
Constant.Doc.Print
Everything expanded on one long page, ready to print or save as a PDF.
Constant.Doc.ModelConstant.Doc.Scalar
One model or scalar as a collapsible panel, picked by
refName.Constant.Doc.Enum
Every registered enum in one table, with its values and the fields that use it.
Put it on a page
- Write a client component in
ui/that rendersConstant.Doc.ZoneorConstant.Doc.Print. - Give each one a route of its own.
First, the client component:
apps/myapp/ui/SchemaDocs.tsx
- The
cnstimport registers your models. Nothing is taken from it: loading the file is what lets the explorer find your app's models. - Pick what to show with props. Both components take the same lists, described below.
modelsstring[]default all
Database models to show, by
refName, in the order you list them.scalarsstring[]default all
Scalar models to show, by
refName.enumsstring[]default all
Enums to show: the class name, first letter lowercased (
BizContractStatus → bizContractStatus).openAllbooleandefault falseDoc.Zone
Opens every model and scalar panel.
Doc.Print is always fully open and ignores it.- An empty list means all.
models={[]}shows every model, the same as leaving the prop out. - A misspelled name is skipped quietly. If a model is missing, check its
refNameagainst the summary counts. - Order follows your list. A list you leave out is sorted by name.
Then a route renders the component, and the route stays a server page:
apps/myapp/page/(admin)/schema/_index.tsx
- The URL.
(admin)is a route group and adds nothing to the path, so this page serves/schema. - The print version. Write
schema/print.tsxthe same way with<PrintableSchemaDocs />, and it serves/schema/print.


Render
Constant.Doc from a "use client" file. Its parts exist only on the client, so a page that renders <Constant.Doc.Zone> directly fails. Keep the route a server page that renders your wrapper.Generated Schema
Constant.Doc.Zone is for browsing. Each model is a panel with a field table, and the toolbar switches the whole view to a relation diagram.What is on screen
| Part | What it does |
|---|---|
| Summary cards | Counts of database models, scalar models, enums and relations. |
| Search | Filters models and scalars by refName, and enums by name. |
| Table · Diagram | Switches between field tables and a graph of how models point at each other. |
| Input · Object · Full · Light · Insight | Shows one variant of a model at a time. Full opens first. |
| Detail | Opens one field's full settings as JSON, including ref, example and meta. |
Reading a field row
ColumnWhat it shows
Type
The field type.
! marks a required field, and a model or scalar type is highlighted.Kind
property, hidden, secret or resolve, with select:false and immutable badges.Default
The declared default. A function default reads
[function].Constraints
min, max, minlength, maxlength, the text: search role, custom validate, accumulate.Values
The allowed values when the field is an enum.
- Labels come from the dictionary. The model description is the one in
.of(), and each field shows its label and.desc(). - Reading the diagram. Each arrow is labelled with the fields that make it. A model outside your list shows as an
Externalnode. - Click a node. The side panel lists its fields and their types, from the
Fullvariant for a database model.
Live on this site
Constant Schema Docs
Database models, scalar models, enums, and relations from ConstantRegistry.
Database Models
0
Scalar Models
5
Enums
5
Relations
1
Database Models
No database model matches.
Scalar Models
DocPagedocPageOne page of the Akan.js documentation, as both a menu entry and a readable document.
DocPagedocPage
One page of the Akan.js documentation, as both a menu entry and a readable document.
| Field | Type | Kind | Default | Constraints | Values | Description | |
|---|---|---|---|---|---|---|---|
href Path | String! | property | — | — | — | The docs route, and the identifier to pass to readDocPage | |
title Title | String | property | — | — | Page title | ||
section Section | String! | property | docs | — | docsreferencesconventionscheatsheet | Which of the four documentation sections it belongs to | |
category Category | String | property | — | — | The menu group the page sits under | ||
priority Priority | String! | property | P2 | — | P0P1P2 | Reading order — P0 is the path through the framework | |
summary Summary | String | property | — | — | First prose paragraph of the page |
AccessTokenaccessTokenAccess token for authentication
AccessTokenaccessToken
Access token for authentication
| Field | Type | Kind | Default | Constraints | Values | Description | |
|---|---|---|---|---|---|---|---|
jwt JWT | String! | property | — | — | — | JSON Web Token | |
refreshToken Refresh Token | String | property | — | — | — | Refresh token for token renewal | |
expiresAt Expires At | Date | property | — | — | — | Access token expiration time |
AccessLogaccessLogAccess log information
AccessLogaccessLog
Access log information
| Field | Type | Kind | Default | Constraints | Values | Description | |
|---|---|---|---|---|---|---|---|
period Period | Int! | property | 0 | — | — | Time period | |
countryCode Country Code | String | property | — | — | — | ISO country code | |
countryName Country Name | String | property | — | — | — | Name of the country | |
city City | String | property | — | — | — | City name | |
postal Postal | Int | property | — | — | — | Postal code | |
location Location | Coordinate | property | — | — | — | Geographic location | |
ipv4 IPv4 | String | property | — | — | — | IPv4 address | |
state State | String | property | — | — | — | State or province | |
osName OS Name | String | property | — | — | — | Operating system name | |
osVersion OS Version | String | property | — | — | — | Operating system version | |
browserName Browser Name | String | property | — | — | — | Web browser name | |
browserVersion Browser Version | String | property | — | — | — | Web browser version | |
mobileModel Mobile Model | String | property | — | — | — | Mobile device model | |
mobileVendor Mobile Vendor | String | property | — | — | — | Mobile device vendor | |
deviceType Device Type | String | property | — | — | — | Type of device | |
at At | Date! | property | [function] | — | — | Access time |
AccessStataccessStatAccess statistics information
AccessStataccessStat
Access statistics information
| Field | Type | Kind | Default | Constraints | Values | Description | |
|---|---|---|---|---|---|---|---|
request Request | Int! | property | 0 | — | — | Number of requests | |
device Device | Int! | property | 0 | — | — | Number of devices | |
ip IP | Int! | property | 0 | — | — | Number of unique IPs | |
country Country | Int! | property | 0 | — | — | Number of countries |
CoordinatecoordinateGeographic coordinate information
Coordinatecoordinate
Geographic coordinate information
| Field | Type | Kind | Default | Constraints | Values | Description | |
|---|---|---|---|---|---|---|---|
type Type | String! | property | Point | — | Point | Coordinate type | |
coordinates Coordinates | [Float]! | property | [0,0] | — | — | Longitude and latitude values | |
altitude Altitude | Float! | property | 0 | — | — | Altitude in meters |
Enums
| Enum | Type | Values | Used By |
|---|---|---|---|
agentStop agentStop | String | endtoolUselength | — |
coordinateType coordinateType | String | Point | coordinate.type |
docPriority docPriority | String | P0P1P2 | docPage.priority |
docSection docSection | String | docsreferencesconventionscheatsheet | docPage.section |
responsive responsive | String | xllgmdsmxs | — |
Printable Definition
Constant.Doc.Print renders every selected variant and field expanded. There are no tabs, collapse panels, modals or diagram, so the page prints as it looks.Feature
Doc.Zone
Doc.Print
Browsing on screen
Search
✓
Relation diagram
✓
Variant tabs
✓
One variant at a time.
Collapsible panels
✓
openAll opens them all.Field detail modal
✓
Printing
All five variants at once
✓
Printed one after another per model.
Field details in the table
✓
ref, refPath, example and meta inline, in place of the modal.Enum value labels
✓
Written in a column.
Doc.Zone shows them only on hover.Page breaks
✓
Each database model gets its own page, and scalars and enums start on a new one.
Print colors
✓
Switches to black text on white when printed, even from dark mode.
✓has itdoes not
To keep a copy as a PDF:
- Open the print route, such as
/schema/print. - Press
⌘PorCtrl+Pand choose Save as PDF in the browser's print dialog.
Live on this site
Constant Schema Definition
Database models, scalar models, enums, and relations from ConstantRegistry.
Database Models
0
Scalar Models
3
Enums
5
Relations
1
Scalar Models
DocPage
docPage
One page of the Akan.js documentation, as both a menu entry and a readable document.
| Key | Type | Required | Field Type | Relation | Default | Constraints | Enum | Description | Detail |
|---|---|---|---|---|---|---|---|---|---|
href Path | String | Required | property | - | null | - | - | The docs route, and the identifier to pass to readDocPage | example: /references/akanjs/signal |
title Title | String | Optional | property | - | - | - | Page title | - | |
section Section | String | Required | property | - | docs | - | docSection: docs, references, conventions, cheatsheet | Which of the four documentation sections it belongs to | - |
category Category | String | Optional | property | - | - | - | The menu group the page sits under | - | |
priority Priority | String | Required | property | - | P2 | - | docPriority: P0, P1, P2 | Reading order — P0 is the path through the framework | - |
summary Summary | String | Optional | property | - | - | - | First prose paragraph of the page | - |
AccessToken
accessToken
Access token for authentication
| Key | Type | Required | Field Type | Relation | Default | Constraints | Enum | Description | Detail |
|---|---|---|---|---|---|---|---|---|---|
jwt JWT | String | Required | property | - | null | - | - | JSON Web Token | - |
refreshToken Refresh Token | String | Optional | property | - | null | - | - | Refresh token for token renewal | - |
expiresAt Expires At | Date | Optional | property | - | null | - | - | Access token expiration time | - |
AccessLog
accessLog
Access log information
| Key | Type | Required | Field Type | Relation | Default | Constraints | Enum | Description | Detail |
|---|---|---|---|---|---|---|---|---|---|
period Period | Int | Required | property | - | 0 | - | - | Time period | - |
countryCode Country Code | String | Optional | property | - | null | - | - | ISO country code | - |
countryName Country Name | String | Optional | property | - | null | - | - | Name of the country | - |
city City | String | Optional | property | - | null | - | - | City name | - |
postal Postal | Int | Optional | property | - | null | - | - | Postal code | - |
location Location | Coordinate | Optional | property | target: coordinate | null | - | - | Geographic location | - |
ipv4 IPv4 | String | Optional | property | - | null | - | - | IPv4 address | - |
state State | String | Optional | property | - | null | - | - | State or province | - |
osName OS Name | String | Optional | property | - | null | - | - | Operating system name | - |
osVersion OS Version | String | Optional | property | - | null | - | - | Operating system version | - |
browserName Browser Name | String | Optional | property | - | null | - | - | Web browser name | - |
browserVersion Browser Version | String | Optional | property | - | null | - | - | Web browser version | - |
mobileModel Mobile Model | String | Optional | property | - | null | - | - | Mobile device model | - |
mobileVendor Mobile Vendor | String | Optional | property | - | null | - | - | Mobile device vendor | - |
deviceType Device Type | String | Optional | property | - | null | - | - | Type of device | - |
at At | Date | Required | property | - | [function] | - | - | Access time | - |
Enums
| Key | Ref Name | Type | Values | Descriptions | Used By |
|---|---|---|---|---|---|
| agentStop | agentStop | String | end, toolUse, length | end: End toolUse: Tool Use length: Length | - |
| coordinateType | coordinateType | String | Point | Point: Point | - |
| docPriority | docPriority | String | P0, P1, P2 | P0: Essential P1: Recommended P2: Detail | docPage.priority (Scalar) |
| docSection | docSection | String | docs, references, conventions, cheatsheet | docs: Guide references: Reference conventions: Convention cheatsheet: Cheatsheet | docPage.section (Scalar) |
| responsive | responsive | String | xl, lg, md, sm, xs | xl: responsive.xl lg: responsive.lg md: responsive.md sm: responsive.sm xs: responsive.xs | - |