image
Akan.js
English
Docs (V1)
image
Akan.js
You are viewing the Akan.js v1 docs.Go to the latest v2 docs
Docs (V1)
Released under the MIT License
Official Akan.js Consulting onAkansoft
Copyright © 2026 Akan.js All rights reserved.
System managed bybassman
Introduction
• Quick Start
• How it works
• Practice a Workflow
Tutorials
• Show Details
• Modifying Status
• Interact in Service
• Displaying with Slice
• UX with Pages
• Using Scalar
• Using Insight
• Relate Data
System Architecture
• Overview
• Backend System
• Frontend System
• Environment Variables
• Primitive Scalar Types
• Domain Based Modules
• CSS
Module 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
Introduction
• Quick Start
• How it works
• Practice a Workflow
Tutorials
• Show Details
• Modifying Status
• Interact in Service
• Displaying with Slice
• UX with Pages
• Using Scalar
• Using Insight
• Relate Data
System Architecture
• Overview
• Backend System
• Frontend System
• Environment Variables
• Primitive Scalar Types
• Domain Based Modules
• CSS
Module 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
Previous
model.service.ts
Next
model.store.ts

model.signal.ts

Signals define the external interface of your module. They connect your Service logic to the outside world via various protocols (HTTP, GQL, WebSocket).
📡Three Signal Types
  • Internal: Background tasks, cron jobs
  • Endpoint: Public API (REST/GQL, WebSocket)
  • Slice: Frontend-facing data subsets

Defining Internal Tasks

Use `internal()` to define background tasks like cron jobs or process queues that run independently of user requests.
methodDescriptionExample
interval(ms)Defines a recurring task executed every 'ms' milliseconds.
process(ReturnType)Defines a background process queue handled by a worker.
interval(ms)

Defines a recurring task executed every 'ms' milliseconds.

process(ReturnType)

Defines a background process queue handled by a worker.

product.signal.ts

Defining Public APIs

Use `endpoint()` to define standard API methods. You can mix Query, Mutation, and Real-time subscriptions.
Method Types
methodDescriptionExample
query(ReturnType, options?)Defines a GraphQL Query or HTTP GET endpoint.
mutation(ReturnType, options?)Defines a GraphQL Mutation or HTTP POST endpoint.
message(ReturnType, options?)Defines a WebSocket message handler.
pubsub(payloadType)Defines a PubSub topic handler.
query(ReturnType, options?)

Defines a GraphQL Query or HTTP GET endpoint.

mutation(ReturnType, options?)

Defines a GraphQL Mutation or HTTP POST endpoint.

message(ReturnType, options?)

Defines a WebSocket message handler.

pubsub(payloadType)

Defines a PubSub topic handler.

Parameter Builders
Parameters are strictly scoped. For example, you cannot use `.room()` in a Query or `.body()` in a Subscription.
fieldDescriptionExample
.param(name, Type, options?)Required path parameter. (Available in: Query, Mutation, Process)
.search(name, Type, options?)Query string or optional argument. (Available in: Query, Mutation)
.body(name, Type, options?)Request body parameter. (Available in: Mutation)
.msg(name, Type, options?)Message payload field. (Available in: Message)
.room(name, Type, options?)PubSub room identifier. (Available in: PubSub)
.param(name, Type, options?)

Required path parameter. (Available in: Query, Mutation, Process)

.search(name, Type, options?)

Query string or optional argument. (Available in: Query, Mutation)

.body(name, Type, options?)

Request body parameter. (Available in: Mutation)

.msg(name, Type, options?)

Message payload field. (Available in: Message)

.room(name, Type, options?)

PubSub room identifier. (Available in: PubSub)

Chat Example
Client Usage (fetch)
Use the `fetch` object to call endpoint methods on the client.
Client Usage

Standard Model APIs

The following methods are automatically generated for every model and are available via the `fetch` object.
methodDescriptionExample
view[Model](id: string): Promise<ViewReturn>Fetch detail view data. Returns { [Model], [Model]View }.
edit[Model](id: string): Promise<EditReturn>Fetch data for editing. Returns { [Model], [Model]Edit }.
merge[Model](id: string | null, data: Partial<Model>): Promise<Model>Create or Update model data. Returns updated Model.
view[Model](id: string): Promise<ViewReturn>

Fetch detail view data. Returns { [Model], [Model]View }.

edit[Model](id: string): Promise<EditReturn>

Fetch data for editing. Returns { [Model], [Model]Edit }.

merge[Model](id: string | null, data: Partial<Model>): Promise<Model>

Create or Update model data. Returns updated Model.

Defining Slices & Stores

Use `slice()` to group APIs for specific contexts (e.g., 'My Tickets', 'Project Tickets'). It automatically generates client-side stores and pagination Actions.
⚡Automation Power
Defining a slice automatically creates `fetch.init[SliceName]` on the client. It handles data loading, pagination, and state management in one go.
Server Definition
ticket.signal.ts
Slice Auto-Generated Methods
Methods generated specifically for each slice definition.
methodDescriptionExample
[Model]List[Suffix](...args, skip, limit, sort): Promise<Model[]>Get list of data with pagination arguments. Returns Model array.
[Model]Insight[Suffix](...args): Promise<Insight>Get aggregated statistics. Returns Insight object.
init[Model](query?, option?): Promise<InitReturn>Initialize list with default options. Returns { [Model]Init, [Model]List, [Model]Insight }.
init[SliceName](...args): Promise<InitReturn>Initialize slice list data. Returns { [Slice]Init, [Slice]List, [Slice]Insight }.
[Model]List[Suffix](...args, skip, limit, sort): Promise<Model[]>

Get list of data with pagination arguments. Returns Model array.

[Model]Insight[Suffix](...args): Promise<Insight>

Get aggregated statistics. Returns Insight object.

init[Model](query?, option?): Promise<InitReturn>

Initialize list with default options. Returns { [Model]Init, [Model]List, [Model]Insight }.

init[SliceName](...args): Promise<InitReturn>

Initialize slice list data. Returns { [Slice]Init, [Slice]List, [Slice]Insight }.

Client Usage
Client Page (page.tsx)

Using & Defining Guards

Guards protect your Signals. You can use built-in guards or define your own by implementing the `Guard` interface.
Creating a Custom Guard
methodDescriptionExample
canActivate(context)Returns boolean indicating if the request is allowed.
getRequest(context)Helper to extract the request object, including the user account.
canActivate(context)

Returns boolean indicating if the request is allowed.

getRequest(context)

Helper to extract the request object, including the user account.

libs/shared/nest/authGuards.ts
Applying Guards
model.signal.ts
Defining Internal Tasks
Defining Public APIs
Standard Model APIs
Defining Slices & Stores
Using & Defining Guards