image
Akan.js
English
DocsConventionsReferencesCheatsheet
image
Akan.js
DocsConventionsReferencesCheatsheet
Released under the MIT License
Official Akan.js Consulting onAkansoft
Copyright © 2026 Akan.js All rights reserved.
System managed bybassman
General
• Authorization
• Schema Design
• Edge Computing
• File Management
• Single Sign-On
• DataList & Enum
Interface
• CRUD
• Endpoint
• Form
Observability
• Logging
• Dependency Injection
• Error Handling
• Metrics
Performance
• Caching
• Image Optimization
• Lazy Loading
• Querying
• Queueing
• Realtime
Development
• Documentation
• Script
• Docker
• Kubernetes
General
• Authorization
• Schema Design
• Edge Computing
• File Management
• Single Sign-On
• DataList & Enum
Interface
• CRUD
• Endpoint
• Form
Observability
• Logging
• Dependency Injection
• Error Handling
• Metrics
Performance
• Caching
• Image Optimization
• Lazy Loading
• Querying
• Queueing
• Realtime
Development
• Documentation
• Script
• Docker
• Kubernetes
Previous
Logging
Next
Error Handling

Dependency Injection

Dependency injection means a service receives what it needs instead of creating everything by itself. This keeps business code small and makes external systems easier to replace.
  • `use` receives values registered in app or library options.
  • `adapt` and `plug` are good for replaceable tools such as storage, cache, or message APIs.
  • `service` connects one service to another service.
  • `env` reads runtime configuration without passing it through every function.

Register With use

`AkanOption.use()` is a simple place to prepare global values. Put API clients, generated secrets, host values, and shared settings there.
Option registers values
Service receives values

Adapt And Plug

Use an adaptor when a tool has behavior and can be replaced later. The service only asks for the role it needs.
Declare adaptor
Plug adaptor into service

Inject Services

Use `service()` when one service needs another service's business method. This is clearer than importing and creating the other service yourself.
Service to service

Read Environment

`env()` is useful when the service needs runtime identity such as app name, operation mode, hostname, or a feature flag.
Environment value

Tips

  • Do not create external clients inside every method. Register them once with `use` or `adapt`.
  • Use `service()` for business collaboration, and `plug()` for replaceable infrastructure.
  • Keep secrets in env/options and inject prepared clients, not raw credentials, when possible.
  • If a value is shared across many services, `AkanOption.use()` is usually the cleanest home.
Dependency Injection
Register With use
Adapt And Plug
Inject Services
Read Environment
Tips