# ergus457/siakoperasi architecture

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

- Interactive diagram: https://gitdiagram.com/ergus457/siakoperasi
- Repository: https://github.com/ergus457/siakoperasi

## Overview

This is a cooperative accounting and member-management application. Users maintain organizational records, record savings, loans, shop activity and journal transactions, then review financial reports. The sampled code confirms the account and savings clients call server actions and confirms authentication uses Prisma; most other business screens and report implementations are unsampled, so their internal links are not asserted. The report and transaction branches are retained based on the repository tree.

Main entry points: [`src/app/dashboard/layout.tsx`](https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/layout.tsx) (Dashboard shell), [`src/lib/prisma.ts`](https://github.com/ergus457/siakoperasi/blob/main/src/lib/prisma.ts) (Database client), [`src/app/dashboard/akun/client.tsx`](https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/akun/client.tsx) (Chart of accounts), [`src/lib/auth.ts`](https://github.com/ergus457/siakoperasi/blob/main/src/lib/auth.ts) (Credentials auth)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and shell"]
  node_authui["Sign in and register<br/>[page.tsx]"]
  node_auth["Credentials auth<br/>[auth.ts]"]
  node_authroutes["Auth endpoints<br/>[route.ts]"]
  node_register["Account registration<br/>[route.ts]"]
  node_shell["Dashboard shell<br/>[layout.tsx]"]
end

subgraph group_operations["Co-op operations"]
  node_members["Member records<br/>[actions.ts]"]
  node_savings["Savings transactions<br/>[actions.ts]"]
  node_loans["Loan management<br/>[actions.ts]"]
  node_shopbuy["Shop purchases<br/>[actions.ts]"]
  node_shopsell["Shop sales<br/>[actions.ts]"]
end

subgraph group_ledger["Accounting"]
  node_accounts["Chart of accounts<br/>[client.tsx]"]
  node_journals["Journal entries<br/>[actions.ts]"]
  node_journalview["Journal review<br/>[client.tsx]"]
  node_accounting["Accounting rules<br/>[accounting.ts]"]
end

subgraph group_reports["Reports"]
  node_reports["Financial statements"]
  node_preview["Report preview<br/>[page.tsx]"]
end

subgraph group_shared["Shared runtime"]
  node_table["Data table<br/>[data-table.tsx]"]
  node_formrows["Dynamic journal rows"]
  node_export["Export controls<br/>[export-buttons.tsx]"]
  node_prisma["Database client<br/>[prisma.ts]"]
  node_database[("PostgreSQL database")]
end

node_user(("Co-op user"))

node_user -->|"signs in"| node_authui
node_authui -.->|"authenticates"| node_auth
node_authroutes -->|"uses handlers"| node_auth
node_auth -->|"looks up user"| node_prisma
node_register -->|"stores account"| node_prisma
node_user -.->|"uses dashboard"| node_shell
node_shell -.->|"opens records"| node_members
node_shell -.->|"opens transactions"| node_savings
node_shell -.->|"opens loans"| node_loans
node_shell -.->|"opens purchases"| node_shopbuy
node_shell -.->|"opens sales"| node_shopsell
node_user -->|"maintains accounts"| node_accounts
node_accounts -->|"gets normal balance"| node_accounting
node_accounts -->|"renders table"| node_table
node_user -->|"records savings"| node_savings
node_user -.->|"manages loans"| node_loans
node_user -.->|"records journals"| node_journals
node_journals -->|"persists entries"| node_prisma
node_user -->|"reviews journals"| node_journalview
node_user -.->|"reviews statements"| node_reports
node_user -.->|"previews report"| node_preview
node_prisma -->|"connects to"| node_database

click node_authui "https://github.com/ergus457/siakoperasi/blob/main/src/app/login/page.tsx"
click node_auth "https://github.com/ergus457/siakoperasi/blob/main/src/lib/auth.ts"
click node_authroutes "https://github.com/ergus457/siakoperasi/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts"
click node_register "https://github.com/ergus457/siakoperasi/blob/main/src/app/api/auth/register/route.ts"
click node_shell "https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/layout.tsx"
click node_members "https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/anggota/actions.ts"
click node_savings "https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/simpanan/actions.ts"
click node_loans "https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/pinjaman/actions.ts"
click node_shopbuy "https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/toko-pembelian/actions.ts"
click node_shopsell "https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/toko-penjualan/actions.ts"
click node_accounts "https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/akun/client.tsx"
click node_journals "https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/jurnal/penerimaan-kas/actions.ts"
click node_journalview "https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/jurnal/client.tsx"
click node_accounting "https://github.com/ergus457/siakoperasi/blob/main/src/lib/accounting.ts"
click node_reports "https://github.com/ergus457/siakoperasi/tree/main/src/app/dashboard/laporan"
click node_preview "https://github.com/ergus457/siakoperasi/blob/main/src/app/report-preview/page.tsx"
click node_table "https://github.com/ergus457/siakoperasi/blob/main/src/components/data-table.tsx"
click node_formrows "https://github.com/ergus457/siakoperasi/blob/main/src/components/dynamic-form-rows.tsx"
click node_export "https://github.com/ergus457/siakoperasi/blob/main/src/components/export-buttons.tsx"
click node_prisma "https://github.com/ergus457/siakoperasi/blob/main/src/lib/prisma.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_authui,node_auth,node_authroutes,node_register,node_shell,node_user toneBlue
class node_members,node_savings,node_loans,node_shopbuy,node_shopsell toneAmber
class node_accounts,node_journals,node_journalview,node_accounting toneMint
class node_reports,node_preview toneRose
class node_table,node_formrows,node_export,node_prisma,node_database toneIndigo
```

## Components

### Access and shell

- [Sign in and register](https://github.com/ergus457/siakoperasi/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Credentials auth](https://github.com/ergus457/siakoperasi/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Auth endpoints](https://github.com/ergus457/siakoperasi/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts): `src/app/api/auth/[...nextauth]/route.ts`
- [Account registration](https://github.com/ergus457/siakoperasi/blob/main/src/app/api/auth/register/route.ts): `src/app/api/auth/register/route.ts`
- [Dashboard shell](https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/layout.tsx): `src/app/dashboard/layout.tsx`

### Co-op operations

- [Member records](https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/anggota/actions.ts): `src/app/dashboard/anggota/actions.ts`
- [Savings transactions](https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/simpanan/actions.ts): `src/app/dashboard/simpanan/actions.ts`
- [Loan management](https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/pinjaman/actions.ts): `src/app/dashboard/pinjaman/actions.ts`
- [Shop purchases](https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/toko-pembelian/actions.ts): `src/app/dashboard/toko-pembelian/actions.ts`
- [Shop sales](https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/toko-penjualan/actions.ts): `src/app/dashboard/toko-penjualan/actions.ts`

### Accounting

- [Chart of accounts](https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/akun/client.tsx): `src/app/dashboard/akun/client.tsx`
- [Journal entries](https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/jurnal/penerimaan-kas/actions.ts): `src/app/dashboard/jurnal/penerimaan-kas/actions.ts`
- [Journal review](https://github.com/ergus457/siakoperasi/blob/main/src/app/dashboard/jurnal/client.tsx): `src/app/dashboard/jurnal/client.tsx`
- [Accounting rules](https://github.com/ergus457/siakoperasi/blob/main/src/lib/accounting.ts): `src/lib/accounting.ts`

### Reports

- [Financial statements](https://github.com/ergus457/siakoperasi/tree/main/src/app/dashboard/laporan): `src/app/dashboard/laporan`
- [Report preview](https://github.com/ergus457/siakoperasi/blob/main/src/app/report-preview/page.tsx): `src/app/report-preview/page.tsx`

### Shared runtime

- [Data table](https://github.com/ergus457/siakoperasi/blob/main/src/components/data-table.tsx): `src/components/data-table.tsx`
- [Dynamic journal rows](https://github.com/ergus457/siakoperasi/blob/main/src/components/dynamic-form-rows.tsx): `src/components/dynamic-form-rows.tsx`
- [Export controls](https://github.com/ergus457/siakoperasi/blob/main/src/components/export-buttons.tsx): `src/components/export-buttons.tsx`
- [Database client](https://github.com/ergus457/siakoperasi/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- **PostgreSQL database**

### Other components

- **Co-op user**

## Connections

- Co-op user → Sign in and register: signs in
- Sign in and register → Credentials auth: authenticates
- Auth endpoints → Credentials auth: uses handlers
- Credentials auth → Database client: looks up user (evidence: `src/lib/auth.ts`)
- Account registration → Database client: stores account (evidence: `src/app/api/auth/register/route.ts`)
- Co-op user → Dashboard shell: uses dashboard
- Dashboard shell → Member records: opens records
- Dashboard shell → Savings transactions: opens transactions
- Dashboard shell → Loan management: opens loans
- Dashboard shell → Shop purchases: opens purchases
- Dashboard shell → Shop sales: opens sales
- Co-op user → Chart of accounts: maintains accounts (evidence: `src/app/dashboard/akun/client.tsx`)
- Chart of accounts → Accounting rules: gets normal balance (evidence: `src/app/dashboard/akun/client.tsx`)
- Chart of accounts → Data table: renders table (evidence: `src/app/dashboard/akun/client.tsx`)
- Co-op user → Savings transactions: records savings
- Co-op user → Loan management: manages loans
- Co-op user → Journal entries: records journals
- Journal entries → Database client: persists entries (evidence: `src/app/dashboard/jurnal/penerimaan-kas/actions.ts`)
- Co-op user → Journal review: reviews journals (evidence: `src/app/dashboard/jurnal/client.tsx`)
- Co-op user → Financial statements: reviews statements
- Co-op user → Report preview: previews report
- Database client → PostgreSQL database: connects to (evidence: `src/lib/prisma.ts`)
