# sapikkk/muhammadsyafiq213510100 architecture

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

- Interactive diagram: https://gitdiagram.com/sapikkk/muhammadsyafiq213510100
- Repository: https://github.com/sapikkk/muhammadsyafiq213510100

## Overview

Kokonus Farm is a role-based hydroponic farm operations and production-cost management web application. Farmers record production-cycle progress and harvests; admins manage operations and approve harvest reports; owners review financial and hydroponic KPIs, journals, and reports. The tree shows distinct production, sales, inventory, infrastructure, and accounting capabilities. The source excerpts confirm selected authentication, API, journal, harvest-approval, and dashboard relationships; links for unsampled areas are marked unverified rather than inferred as call chains.

Main entry points: [`app/api/transactions/route.ts`](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/api/transactions/route.ts) (HTTP API routes), [`app/owner/page.tsx`](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/owner/page.tsx) (Role dashboards), [`app/page.tsx`](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/page.tsx) (Home and login), [`app/petani/siklus/[id]/page.tsx`](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/petani/siklus/%5Bid%5D/page.tsx) (Production cycles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and interface"]
  node_public_home["Home and login<br/>[page.tsx]"]
  node_role_dashboards["Role dashboards<br/>[page.tsx]"]
  node_shared_ui["Shared UI components<br/>[button.tsx]"]
end

subgraph group_production["Farm production"]
  node_cycle["Production cycles<br/>[page.tsx]"]
  node_production_logs["Growth and failure logs"]
  node_harvest["Harvest reports<br/>[laporan-panen.ts]"]
  node_harvest_review["Harvest review"]
  node_varieties["Variety management<br/>[varietas.ts]"]
end

subgraph group_operations["Operations and sales"]
  node_inventory["Inventory management<br/>[inventaris.ts]"]
  node_infrastructure["Farm infrastructure<br/>[infrastruktur.ts]"]
  node_sales["Sales orders<br/>[sales-order.ts]"]
  node_customers["Customer records<br/>[pelanggan.ts]"]
end

subgraph group_finance["Accounting and insight"]
  node_journals["Journal workflow<br/>[jurnal.ts]"]
  node_costs["Production costs<br/>[biaya.ts]"]
  node_reports["Financial reports<br/>[cash-flow.ts]"]
  node_owner_insights["Owner insights<br/>[monthly-summary.ts]"]
end

subgraph group_foundation["Application services"]
  node_api_routes["HTTP API routes<br/>[route.ts]"]
  node_api_auth["API role checks<br/>[api-auth.ts]"]
  node_auth["Session authentication<br/>[auth.ts]"]
  node_api_response["API response handling<br/>[api-response.ts]"]
  node_database[("Application database<br/>[prisma.ts]")]
end

node_farm_users(("Farm users"))

node_farm_users -->|"opens"| node_public_home
node_public_home -->|"routes by role"| node_role_dashboards
node_public_home -->|"loads session"| node_auth
node_farm_users -.->|"records progress"| node_cycle
node_cycle -.->|"records activity"| node_production_logs
node_cycle -.->|"submits harvest"| node_harvest
node_harvest_review -.->|"reviews report"| node_harvest
node_harvest_review -.->|"posts approval"| node_api_routes
node_farm_users -.->|"manages varieties"| node_varieties
node_farm_users -.->|"tracks stock"| node_inventory
node_farm_users -.->|"manages facilities"| node_infrastructure
node_farm_users -.->|"manages orders"| node_sales
node_sales -.->|"uses customer records"| node_customers
node_api_routes -->|"checks roles"| node_api_auth
node_api_routes -->|"wraps responses"| node_api_response
node_api_routes -->|"invokes journal actions"| node_journals
node_api_routes -->|"invokes variety operations"| node_varieties
node_api_auth -->|"loads session"| node_auth
node_auth -->|"reads user"| node_database
node_journals -->|"uses persistence"| node_database
node_role_dashboards -->|"loads stock alerts"| node_inventory
node_role_dashboards -->|"loads summary"| node_owner_insights
node_role_dashboards -->|"queries staff"| node_database
node_farm_users -.->|"uses application"| node_shared_ui
node_journals -.->|"feeds reporting"| node_reports
node_costs -.->|"feeds reporting"| node_reports

click node_public_home "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/page.tsx"
click node_role_dashboards "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/owner/page.tsx"
click node_shared_ui "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/components/ui/button.tsx"
click node_cycle "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/petani/siklus/%5Bid%5D/page.tsx"
click node_production_logs "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/monitor-produksi.ts"
click node_harvest "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/laporan-panen.ts"
click node_harvest_review "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/admin/harvest/%5Bid%5D/client-approval.tsx"
click node_varieties "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/varietas.ts"
click node_inventory "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/inventaris.ts"
click node_infrastructure "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/infrastruktur.ts"
click node_sales "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/sales-order.ts"
click node_customers "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/pelanggan.ts"
click node_journals "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/jurnal.ts"
click node_costs "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/actions/biaya.ts"
click node_reports "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/cash-flow.ts"
click node_owner_insights "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/monthly-summary.ts"
click node_api_routes "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/api/transactions/route.ts"
click node_api_auth "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/api-auth.ts"
click node_auth "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/auth.ts"
click node_api_response "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/api-response.ts"
click node_database "https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/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_public_home,node_role_dashboards,node_shared_ui,node_farm_users toneBlue
class node_cycle,node_production_logs,node_harvest,node_harvest_review,node_varieties toneAmber
class node_inventory,node_infrastructure,node_sales,node_customers toneMint
class node_journals,node_costs,node_reports,node_owner_insights toneRose
class node_api_routes,node_api_auth,node_auth,node_api_response,node_database toneIndigo
```

## Components

### Access and interface

- [Home and login](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/page.tsx): `app/page.tsx`
- [Role dashboards](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/owner/page.tsx): `app/owner/page.tsx`
- [Shared UI components](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/components/ui/button.tsx): `components/ui/button.tsx`

### Farm production

- [Production cycles](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/petani/siklus/%5Bid%5D/page.tsx): `app/petani/siklus/[id]/page.tsx`
- [Growth and failure logs](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/monitor-produksi.ts): `lib/monitor-produksi.ts`
- [Harvest reports](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/laporan-panen.ts): `lib/laporan-panen.ts`
- [Harvest review](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/admin/harvest/%5Bid%5D/client-approval.tsx): `app/admin/harvest/[id]/client-approval.tsx`
- [Variety management](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/varietas.ts): `lib/varietas.ts`

### Operations and sales

- [Inventory management](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/inventaris.ts): `lib/inventaris.ts`
- [Farm infrastructure](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/infrastruktur.ts): `lib/infrastruktur.ts`
- [Sales orders](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/sales-order.ts): `lib/sales-order.ts`
- [Customer records](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/pelanggan.ts): `lib/pelanggan.ts`

### Accounting and insight

- [Journal workflow](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/jurnal.ts): `lib/jurnal.ts`
- [Production costs](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/actions/biaya.ts): `app/actions/biaya.ts`
- [Financial reports](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/cash-flow.ts): `lib/cash-flow.ts`
- [Owner insights](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/monthly-summary.ts): `lib/monthly-summary.ts`

### Application services

- [HTTP API routes](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/app/api/transactions/route.ts): `app/api/transactions/route.ts`
- [API role checks](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/api-auth.ts): `lib/api-auth.ts`
- [Session authentication](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/auth.ts): `lib/auth.ts`
- [API response handling](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/api-response.ts): `lib/api-response.ts`
- [Application database](https://github.com/sapikkk/muhammadsyafiq213510100/blob/main/lib/prisma.ts): `lib/prisma.ts`

### Other components

- **Farm users**

## Connections

- Farm users → Home and login: opens (evidence: `app/page.tsx`)
- Home and login → Role dashboards: routes by role (evidence: `app/page.tsx`)
- Home and login → Session authentication: loads session (evidence: `app/page.tsx`)
- Farm users → Production cycles: records progress
- Production cycles → Growth and failure logs: records activity
- Production cycles → Harvest reports: submits harvest (evidence: `app/petani/siklus/[id]/page.tsx`)
- Harvest review → Harvest reports: reviews report
- Harvest review → HTTP API routes: posts approval
- Farm users → Variety management: manages varieties
- Farm users → Inventory management: tracks stock
- Farm users → Farm infrastructure: manages facilities
- Farm users → Sales orders: manages orders
- Sales orders → Customer records: uses customer records
- HTTP API routes → API role checks: checks roles (evidence: `app/api/transactions/route.ts`)
- HTTP API routes → API response handling: wraps responses (evidence: `app/api/transactions/route.ts`)
- HTTP API routes → Journal workflow: invokes journal actions (evidence: `app/api/transactions/route.ts`)
- HTTP API routes → Variety management: invokes variety operations
- API role checks → Session authentication: loads session (evidence: `lib/api-auth.ts`)
- Session authentication → Application database: reads user (evidence: `lib/auth.ts`)
- Journal workflow → Application database: uses persistence (evidence: `lib/jurnal.ts`)
- Role dashboards → Inventory management: loads stock alerts (evidence: `app/owner/page.tsx`)
- Role dashboards → Owner insights: loads summary (evidence: `app/owner/page.tsx`)
- Role dashboards → Application database: queries staff (evidence: `app/owner/page.tsx`)
- Farm users → Shared UI components: uses application
- Journal workflow → Financial reports: feeds reporting
- Production costs → Financial reports: feeds reporting
