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
Model.Zone.tsx
Next
scalar.constant.ts

Scalar Overview

A scalar is a small reusable value object. Use it when the same group of fields appears inside multiple domain models.
For example, a product, order, and invoice may all need a price value. Instead of rewriting `amount` and `currency` every time, define a `Price` scalar once and embed it wherever it is needed.

When To Use Scalar

Use a scalar when the value is stored as part of another model. Use a normal module model when the data needs its own list page, permissions, service methods, or independent lifecycle.
  • Good scalar examples: Price, Address, ContactInfo, Coordinate, FileMeta.
  • Good module model examples: Product, Order, User, Post, Ticket.
product.constant.ts

Scalar Files

Scalar files live under `lib/__scalar/<scalarName>`. Start with constant, dictionary, and document files. Add Template or Unit files only when the scalar needs reusable UI.
  • *.constant.ts: defines the scalar fields and enum values.
  • *.dictionary.ts: adds labels and descriptions for the scalar fields.
  • *.document.ts: optionally adds small value helper methods.
  • *.Template.tsx: renders a reusable editor for the scalar inside a parent form.
  • *.Unit.tsx: renders a reusable display for the scalar inside a parent card or detail page.

Small Example

A scalar should be easy to understand on its own. The example below defines only the value shape; the parent module decides how to save, load, and render it.
price.constant.ts
Scalar Overview
When To Use Scalar
Scalar Files
Small Example