# fxagro/akur architecture

> Architecture diagram of the GitHub repository fxagro/akur, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fxagro/akur
- Repository: https://github.com/fxagro/akur

## Overview

Akur is an Indonesian modular ERP centered on company-scoped accounting workflows: users manage business records and transactions, then review ledgers and financial or tax reports. The web application pairs Next.js pages and client components with server actions, accounting logic, and Prisma-backed persistence; authentication and permissions provide a shared internal layer. The repository also includes a CLI for creating and managing modules. Several domain capabilities are documented in the README but their implementation was not sampled, so those branches are shown at subsystem level and undocumented links are omitted.

Main entry points: [`src/app/(app)`](https://github.com/fxagro/akur/tree/main/src/app/(app)) (ERP pages), [`src/lib/prisma.ts`](https://github.com/fxagro/akur/blob/main/src/lib/prisma.ts) (Prisma client), [`packages/cli/src/index.ts`](https://github.com/fxagro/akur/blob/main/packages/cli/src/index.ts) (CLI command router), [`src/lib/accounting/posting.ts`](https://github.com/fxagro/akur/blob/main/src/lib/accounting/posting.ts) (Automatic posting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["ERP application"]
  node_webapp["ERP pages"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
end

subgraph group_domains["Business modules"]
  node_sales["Sales and receipts<br/>[sales-actions.ts]"]
  node_purchases["Purchases and payments"]
  node_partners["Customers and suppliers<br/>[partner-actions.ts]"]
  node_inventory["Inventory"]
  node_bank["Bank and reconciliation<br/>[bank-actions.ts]"]
  node_banktx["Bank transactions"]
  node_tax["Tax<br/>[tax-actions.ts]"]
  node_assets["Fixed assets<br/>[asset-actions.ts]"]
  node_depreciation["Depreciation"]
end

subgraph group_accounting["Accounting core"]
  node_accounts["Chart of accounts<br/>[account-actions.ts]"]
  node_journals["Journal entries<br/>[journal-actions.ts]"]
  node_journalcore["Journal logic<br/>[journal.ts]"]
  node_posting["Automatic posting<br/>[posting.ts]"]
  node_reports["Financial reports<br/>[reports.ts]"]
  node_ledger["General ledger<br/>[page.tsx]"]
end

subgraph group_security["Identity and access"]
  node_access["Session and permissions<br/>[auth-context.ts]"]
  node_auth["Session management<br/>[auth.ts]"]
  node_authactions["Login actions<br/>[auth-actions.ts]"]
end

subgraph group_modules["Module manager"]
  node_cli["CLI command router<br/>[index.ts]"]
  node_create["Create module<br/>[create.ts]"]
  node_init["Initialize project<br/>[init.ts]"]
  node_list["List modules<br/>[list.ts]"]
  node_registry["Module catalog<br/>[catalog.ts]"]
  node_installer["Module installer<br/>[installer.ts]"]
end

node_user(("ERP user"))
node_database[("PostgreSQL database")]
node_cliuser(("CLI operator"))

node_user -->|"uses"| node_webapp
node_webapp -.->|"checks access"| node_access
node_webapp -.->|"manages sales"| node_sales
node_webapp -.->|"manages purchases"| node_purchases
node_webapp -.->|"manages partners"| node_partners
node_webapp -.->|"manages stock"| node_inventory
node_webapp -.->|"manages banking"| node_bank
node_webapp -.->|"records transactions"| node_banktx
node_webapp -.->|"manages tax"| node_tax
node_webapp -.->|"manages assets"| node_assets
node_webapp -.->|"records depreciation"| node_depreciation
node_webapp -.->|"manages accounts"| node_accounts
node_webapp -.->|"records journals"| node_journals
node_webapp -->|"views ledger"| node_ledger
node_ledger -->|"requires permission"| node_access
node_webapp -.->|"views reports"| node_reports
node_sales -.->|"posts automatically"| node_posting
node_purchases -.->|"posts automatically"| node_posting
node_journals -.->|"uses journal logic"| node_journalcore
node_posting -.->|"uses journal logic"| node_journalcore
node_authactions -->|"manages sessions"| node_auth
node_auth -->|"stores sessions"| node_prisma
node_access -->|"loads session"| node_prisma
node_accounts -->|"reads and writes"| node_prisma
node_inventory -->|"reads and writes"| node_prisma
node_partners -->|"reads and writes"| node_prisma
node_assets -->|"reads and writes"| node_prisma
node_tax -->|"reads and writes"| node_prisma
node_prisma -->|"connects to"| node_database
node_cliuser -->|"runs commands"| node_cli
node_cli -->|"dispatches"| node_create
node_cli -->|"dispatches"| node_init
node_cli -->|"dispatches"| node_list
node_list -->|"reads catalog"| node_registry
node_cli -->|"dispatches install"| node_installer

click node_webapp "https://github.com/fxagro/akur/tree/main/src/app/(app)"
click node_sales "https://github.com/fxagro/akur/blob/main/src/lib/actions/sales-actions.ts"
click node_purchases "https://github.com/fxagro/akur/blob/main/src/lib/actions/purchase-actions.ts"
click node_partners "https://github.com/fxagro/akur/blob/main/src/lib/actions/partner-actions.ts"
click node_inventory "https://github.com/fxagro/akur/blob/main/src/lib/actions/inventory-actions.ts"
click node_bank "https://github.com/fxagro/akur/blob/main/src/lib/actions/bank-actions.ts"
click node_banktx "https://github.com/fxagro/akur/blob/main/src/lib/actions/bank-transaction-actions.ts"
click node_tax "https://github.com/fxagro/akur/blob/main/src/lib/actions/tax-actions.ts"
click node_assets "https://github.com/fxagro/akur/blob/main/src/lib/actions/asset-actions.ts"
click node_depreciation "https://github.com/fxagro/akur/blob/main/src/lib/actions/depreciation-actions.ts"
click node_accounts "https://github.com/fxagro/akur/blob/main/src/lib/actions/account-actions.ts"
click node_journals "https://github.com/fxagro/akur/blob/main/src/lib/actions/journal-actions.ts"
click node_journalcore "https://github.com/fxagro/akur/blob/main/src/lib/accounting/journal.ts"
click node_posting "https://github.com/fxagro/akur/blob/main/src/lib/accounting/posting.ts"
click node_reports "https://github.com/fxagro/akur/blob/main/src/lib/accounting/reports.ts"
click node_ledger "https://github.com/fxagro/akur/blob/main/src/app/(app)/ledger/page.tsx"
click node_access "https://github.com/fxagro/akur/blob/main/src/lib/auth-context.ts"
click node_auth "https://github.com/fxagro/akur/blob/main/src/lib/auth.ts"
click node_authactions "https://github.com/fxagro/akur/blob/main/src/lib/actions/auth-actions.ts"
click node_prisma "https://github.com/fxagro/akur/blob/main/src/lib/prisma.ts"
click node_cli "https://github.com/fxagro/akur/blob/main/packages/cli/src/index.ts"
click node_create "https://github.com/fxagro/akur/blob/main/packages/cli/src/commands/create.ts"
click node_init "https://github.com/fxagro/akur/blob/main/packages/cli/src/commands/init.ts"
click node_list "https://github.com/fxagro/akur/blob/main/packages/cli/src/commands/list.ts"
click node_registry "https://github.com/fxagro/akur/blob/main/packages/registry/src/catalog.ts"
click node_installer "https://github.com/fxagro/akur/blob/main/packages/registry/src/installer.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_prisma,node_user toneBlue
class node_sales,node_purchases,node_partners,node_inventory,node_bank,node_banktx,node_tax,node_assets,node_depreciation,node_database toneAmber
class node_accounts,node_journals,node_journalcore,node_posting,node_reports,node_ledger toneMint
class node_access,node_auth,node_authactions toneRose
class node_cli,node_create,node_init,node_list,node_registry,node_installer,node_cliuser toneIndigo
```

## Components

### ERP application

- [ERP pages](https://github.com/fxagro/akur/tree/main/src/app/(app)): `src/app/(app)`
- [Prisma client](https://github.com/fxagro/akur/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`

### Business modules

- [Sales and receipts](https://github.com/fxagro/akur/blob/main/src/lib/actions/sales-actions.ts): `src/lib/actions/sales-actions.ts`
- [Purchases and payments](https://github.com/fxagro/akur/blob/main/src/lib/actions/purchase-actions.ts): `src/lib/actions/purchase-actions.ts`
- [Customers and suppliers](https://github.com/fxagro/akur/blob/main/src/lib/actions/partner-actions.ts): `src/lib/actions/partner-actions.ts`
- [Inventory](https://github.com/fxagro/akur/blob/main/src/lib/actions/inventory-actions.ts): `src/lib/actions/inventory-actions.ts`
- [Bank and reconciliation](https://github.com/fxagro/akur/blob/main/src/lib/actions/bank-actions.ts): `src/lib/actions/bank-actions.ts`
- [Bank transactions](https://github.com/fxagro/akur/blob/main/src/lib/actions/bank-transaction-actions.ts): `src/lib/actions/bank-transaction-actions.ts`
- [Tax](https://github.com/fxagro/akur/blob/main/src/lib/actions/tax-actions.ts): `src/lib/actions/tax-actions.ts`
- [Fixed assets](https://github.com/fxagro/akur/blob/main/src/lib/actions/asset-actions.ts): `src/lib/actions/asset-actions.ts`
- [Depreciation](https://github.com/fxagro/akur/blob/main/src/lib/actions/depreciation-actions.ts): `src/lib/actions/depreciation-actions.ts`

### Accounting core

- [Chart of accounts](https://github.com/fxagro/akur/blob/main/src/lib/actions/account-actions.ts): `src/lib/actions/account-actions.ts`
- [Journal entries](https://github.com/fxagro/akur/blob/main/src/lib/actions/journal-actions.ts): `src/lib/actions/journal-actions.ts`
- [Journal logic](https://github.com/fxagro/akur/blob/main/src/lib/accounting/journal.ts): `src/lib/accounting/journal.ts`
- [Automatic posting](https://github.com/fxagro/akur/blob/main/src/lib/accounting/posting.ts): `src/lib/accounting/posting.ts`
- [Financial reports](https://github.com/fxagro/akur/blob/main/src/lib/accounting/reports.ts): `src/lib/accounting/reports.ts`
- [General ledger](https://github.com/fxagro/akur/blob/main/src/app/(app)/ledger/page.tsx): `src/app/(app)/ledger/page.tsx`

### Identity and access

- [Session and permissions](https://github.com/fxagro/akur/blob/main/src/lib/auth-context.ts): `src/lib/auth-context.ts`
- [Session management](https://github.com/fxagro/akur/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Login actions](https://github.com/fxagro/akur/blob/main/src/lib/actions/auth-actions.ts): `src/lib/actions/auth-actions.ts`

### Module manager

- [CLI command router](https://github.com/fxagro/akur/blob/main/packages/cli/src/index.ts): `packages/cli/src/index.ts`
- [Create module](https://github.com/fxagro/akur/blob/main/packages/cli/src/commands/create.ts): `packages/cli/src/commands/create.ts`
- [Initialize project](https://github.com/fxagro/akur/blob/main/packages/cli/src/commands/init.ts): `packages/cli/src/commands/init.ts`
- [List modules](https://github.com/fxagro/akur/blob/main/packages/cli/src/commands/list.ts): `packages/cli/src/commands/list.ts`
- [Module catalog](https://github.com/fxagro/akur/blob/main/packages/registry/src/catalog.ts): `packages/registry/src/catalog.ts`
- [Module installer](https://github.com/fxagro/akur/blob/main/packages/registry/src/installer.ts): `packages/registry/src/installer.ts`

### Other components

- **ERP user**
- **PostgreSQL database**
- **CLI operator**

## Connections

- ERP user → ERP pages: uses
- ERP pages → Session and permissions: checks access (evidence: `src/app/(app)/ledger/page.tsx`)
- ERP pages → Sales and receipts: manages sales
- ERP pages → Purchases and payments: manages purchases
- ERP pages → Customers and suppliers: manages partners
- ERP pages → Inventory: manages stock
- ERP pages → Bank and reconciliation: manages banking
- ERP pages → Bank transactions: records transactions
- ERP pages → Tax: manages tax (evidence: `src/app/(app)/tax/spt-ppn/page.tsx`)
- ERP pages → Fixed assets: manages assets
- ERP pages → Depreciation: records depreciation
- ERP pages → Chart of accounts: manages accounts (evidence: `src/app/(app)/accounts/accounts-client.tsx`)
- ERP pages → Journal entries: records journals
- ERP pages → General ledger: views ledger (evidence: `src/app/(app)/ledger/page.tsx`)
- General ledger → Session and permissions: requires permission (evidence: `src/app/(app)/ledger/page.tsx`)
- ERP pages → Financial reports: views reports
- Sales and receipts → Automatic posting: posts automatically
- Purchases and payments → Automatic posting: posts automatically
- Journal entries → Journal logic: uses journal logic
- Automatic posting → Journal logic: uses journal logic
- Login actions → Session management: manages sessions (evidence: `src/lib/actions/auth-actions.ts`)
- Session management → Prisma client: stores sessions (evidence: `src/lib/auth.ts`)
- Session and permissions → Prisma client: loads session (evidence: `src/lib/auth-context.ts`)
- Chart of accounts → Prisma client: reads and writes (evidence: `src/lib/actions/account-actions.ts`)
- Inventory → Prisma client: reads and writes (evidence: `src/lib/actions/inventory-actions.ts`)
- Customers and suppliers → Prisma client: reads and writes (evidence: `src/lib/actions/partner-actions.ts`)
- Fixed assets → Prisma client: reads and writes (evidence: `src/lib/actions/asset-actions.ts`)
- Tax → Prisma client: reads and writes (evidence: `src/lib/actions/tax-actions.ts`)
- Prisma client → PostgreSQL database: connects to (evidence: `src/lib/prisma.ts`)
- CLI operator → CLI command router: runs commands (evidence: `packages/cli/src/index.ts`)
- CLI command router → Create module: dispatches (evidence: `packages/cli/src/index.ts`)
- CLI command router → Initialize project: dispatches (evidence: `packages/cli/src/index.ts`)
- CLI command router → List modules: dispatches (evidence: `packages/cli/src/index.ts`)
- List modules → Module catalog: reads catalog (evidence: `packages/cli/src/commands/list.ts`)
- CLI command router → Module installer: dispatches install (evidence: `packages/cli/src/index.ts`)
