image
Akan.js
English
DocsConventionsReferencesCheatsheet
image
Akan.js
Akan.js v2 docs are now available.View the v1 docs
DocsConventionsReferencesCheatsheet
Released under the MIT License
Official Akan.js Consulting onAkansoft
Copyright © 2026 Akan.js All rights reserved.
System managed bybassman
Workspace Convention
• Structure
• Format & Lint
App & Library Convention
• Assets (public/ private/)
• Components (ui/)
• Server Utils (srvkit/)
• Web Utils (webkit/)
• Common Utils (common/)
• akan.config.ts
Domain Convention
• Overview
• model.constant.ts
• model.dictionary.ts
• model.document.ts
• model.service.ts
• model.signal.ts
• model.store.ts
• Model.Template.tsx
• Model.Unit.tsx
• Model.Util.tsx
• Model.View.tsx
• Model.Zone.tsx
Scalar Convention
• Overview
• scalar.constant.ts
• scalar.dictionary.ts
• scalar.document.ts
• Scalar.Template.tsx
• Scalar.Unit.tsx
Service Convention
• Overview
• service.dictionary.ts
• service.service.ts
• service.signal.ts
• service.store.ts
• Service.Util.tsx
• Service.Zone.tsx
Workspace Convention
• Structure
• Format & Lint
App & Library Convention
• Assets (public/ private/)
• Components (ui/)
• Server Utils (srvkit/)
• Web Utils (webkit/)
• Common Utils (common/)
• akan.config.ts
Domain Convention
• Overview
• model.constant.ts
• model.dictionary.ts
• model.document.ts
• model.service.ts
• model.signal.ts
• model.store.ts
• Model.Template.tsx
• Model.Unit.tsx
• Model.Util.tsx
• Model.View.tsx
• Model.Zone.tsx
Scalar Convention
• Overview
• scalar.constant.ts
• scalar.dictionary.ts
• scalar.document.ts
• Scalar.Template.tsx
• Scalar.Unit.tsx
Service Convention
• Overview
• service.dictionary.ts
• service.service.ts
• service.signal.ts
• service.store.ts
• Service.Util.tsx
• Service.Zone.tsx
Previous
Structure
Next
Assets (public/ private/)

scalar.constant.ts

A scalar constant defines the shape of a small reusable value. It should be simple enough to understand without reading a service, signal, or store file.
Most scalar constants need only `via()`, `field()`, optional defaults, and sometimes a small enum.

Basic Shape

Use `via((field) => ({ ... }))` and describe each value with `field(Type)`. The class name should describe the business value, not the parent model that happens to use it.
price.constant.ts

Defaults And Optional Fields

Add defaults when a value should have a stable initial state. Use `.optional()` when the parent model can exist without that field.
  • `currency` can default to a normal business value such as `KRW`.
  • `memo` can be optional because not every price needs a note.
price.constant.ts

Array Fields

Use an array field when the scalar naturally contains a repeated value. Keep the example small: a contact info value may have several emails.
contactInfo.constant.ts

Enum Fields

Use `enumOf()` when a field should only allow a fixed set of values. The enum name string is also used by the dictionary file, so keep it short and stable.
price.constant.ts

Small Helpers

A constant may include a small pure helper when the behavior belongs to the value itself. Keep it independent from server requests, database calls, and external services.
price.constant.ts
scalar.constant.ts
Basic Shape
Defaults And Optional Fields
Array Fields
Enum Fields
Small Helpers