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
Next
Structure

Common Overview

The common folder contains logic that can run in both server and client environments. Use it for pure helpers, shared formatting, validation, metadata builders, and transforms that should not depend on browser-only or server-only APIs.
Use srvkit for server-only logic, webkit for browser or web-rendering logic, and common for cross-runtime logic shared by services, signals, pages, and components.

What Belongs In Common

Formatters
Formatting logic used in both service output and UI display, such as bytes, packets, money, or short labels.
common/formatBytes.ts
Validators
Validation or predicate helpers that should behave the same on the server and in the browser.
common/isHttpUri.ts
Random/string utilities
Small deterministic or generic helpers such as random codes, padding, shuffling, or short string transforms.
common/randomCode.ts
Metadata builders
Small objects or builder classes that describe query, filter, or display metadata without binding to one runtime.
common/getQueryMeta.ts
Content transforms
Pure transforms that convert stored content into another shape, such as extracting plain text from editor JSON.
common/extractTextFromSlateJson.ts

Barrel, Optimized Import, And Shape

The common folder is also a barrel folder like ui and webkit. Export shared helpers from index.ts, then import from the barrel. Akan can optimize imports so pages include only the common helpers they actually use.
Prefer one file, one export, and file name equals export name. This keeps cross-runtime helpers easy to find and easy to optimize.
common/randomCode.ts
common/index.ts

Server And Client Usage

A common helper can be used from both service code and page/client code. Keep the helper free from window, document, Bun, fs, process.env, or vendor SDK assumptions unless those APIs are available in both runtimes.
order.service.ts
page.tsx

Practical Rules

Use common when the same logic must work in both service/signal code and page/component code.
Use srvkit instead when the helper needs server-only APIs.
Use webkit instead when the helper needs browser-only APIs.
Keep common helpers small, pure, and imported from the barrel.
Common Overview
What Belongs In Common
Barrel, Optimized Import, And Shape
Server And Client Usage
Practical Rules