# andrianllmm/hack-iloilo architecture

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

- Interactive diagram: https://gitdiagram.com/andrianllmm/hack-iloilo
- Repository: https://github.com/andrianllmm/hack-iloilo

## Overview

SACKTO is a web application for post-harvest planning and services at the Iloilo Rice Processing Complex. Its user-facing workflows include public booking, rice buying and selling, and staff operations for clients, capacity, gate batches, prices, and messaging. The graph preserves these distinct domain areas and the forecast capability visible in the tree. Several connections rely on the SOURCE INDEX rather than full excerpts; uncertain links are omitted, and the forecast implementation is represented only at the supported directory level.

Main entry points: [`src/modules/pricing`](https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/pricing) (Prices and costs), [`src/app/buy/page.tsx`](https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/buy/page.tsx) (Public rice buying), [`src/app/sell/page.tsx`](https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/sell/page.tsx) (Public selling), [`src/app/(app)`](https://github.com/andrianllmm/hack-iloilo/tree/main/src/app/(app)) (Staff workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_public["Public home<br/>[page.tsx]"]
  node_booking["Public booking<br/>[page.tsx]"]
  node_public_buy["Public rice buying<br/>[page.tsx]"]
  node_public_sell["Public selling<br/>[page.tsx]"]
  node_staff["Staff workspace"]
end

subgraph group_operations["Facility operations"]
  node_accounts["Client accounts"]
  node_capacity["Capacity planning"]
  node_gate["Gate and batches"]
  node_setup["Facility setup"]
  node_forecast["Forecasting"]
end

subgraph group_commercial["Commercial services"]
  node_orders["Rice orders"]
  node_buying["Palay offers"]
  node_pricing["Prices and costs"]
  node_prescriptions["Prescriptions"]
end

subgraph group_platform["Shared platform"]
  node_supabase[("Supabase database")]
end

subgraph group_integrations["Messaging and forecasting"]
  node_sms["SMS processing"]
  node_sms_route["SMS process endpoint<br/>[route.ts]"]
  node_webhook["Inbound webhook<br/>[inbound.ts]"]
  node_relay["Webhook relay<br/>[relay.ts]"]
  node_verify["Webhook verification<br/>[verify.ts]"]
  node_forecast_train["Forecast training<br/>[train.py]"]
  node_forecast_lib["Forecast model and parsing"]
end

node_visitor(("Public visitor"))
node_staff_user(("Facility staff"))
node_sms_sender(("SMS sender"))

node_visitor -.->|"opens services"| node_public
node_visitor -.->|"requests booking"| node_booking
node_visitor -.->|"requests rice"| node_public_buy
node_visitor -.->|"offers palay"| node_public_sell
node_staff_user -.->|"uses operations"| node_staff
node_public -->|"reads prices"| node_pricing
node_public_buy -->|"tracks batch"| node_gate
node_public_buy -->|"checks stock"| node_orders
node_public_buy -->|"reads prices"| node_pricing
node_public_buy -->|"renders order form"| node_orders
node_public_sell -->|"renders offer form"| node_buying
node_public_sell -->|"reads prices"| node_pricing
node_booking -.->|"submits booking"| node_supabase
node_staff -->|"uses client tools"| node_accounts
node_staff -->|"loads price tools"| node_pricing
node_accounts -.->|"reads and writes"| node_supabase
node_pricing -->|"reads price records"| node_supabase
node_pricing -->|"reads facility"| node_setup
node_pricing -->|"reads purchase cost"| node_buying
node_orders -.->|"reads order stock"| node_supabase
node_capacity -.->|"reads facility load"| node_supabase
node_gate -.->|"manages batches"| node_supabase
node_setup -.->|"manages facility"| node_supabase
node_prescriptions -.->|"manages prescriptions"| node_supabase
node_sms_sender -.->|"sends message"| node_webhook
node_webhook -->|"relays request"| node_relay
node_relay -->|"verifies request"| node_verify
node_sms_route -->|"loads message data"| node_sms
node_sms -.->|"reads message records"| node_supabase
node_forecast_train -->|"uses model and parser"| node_forecast_lib
node_forecast -.->|"uses forecast data"| node_supabase

click node_public "https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/page.tsx"
click node_booking "https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/book/page.tsx"
click node_public_buy "https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/buy/page.tsx"
click node_public_sell "https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/sell/page.tsx"
click node_staff "https://github.com/andrianllmm/hack-iloilo/tree/main/src/app/(app)"
click node_accounts "https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/accounts"
click node_capacity "https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/capacity"
click node_gate "https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/gate"
click node_setup "https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/setup"
click node_orders "https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/orders"
click node_buying "https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/buying"
click node_pricing "https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/pricing"
click node_prescriptions "https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/prescriptions"
click node_forecast "https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/forecast"
click node_sms "https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/sms"
click node_sms_route "https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/api/sms/process/route.ts"
click node_webhook "https://github.com/andrianllmm/hack-iloilo/blob/main/services/sms-webhook/api/inbound.ts"
click node_relay "https://github.com/andrianllmm/hack-iloilo/blob/main/services/sms-webhook/lib/relay.ts"
click node_verify "https://github.com/andrianllmm/hack-iloilo/blob/main/services/sms-webhook/lib/verify.ts"
click node_forecast_train "https://github.com/andrianllmm/hack-iloilo/blob/main/data/forecast/src/forecast/train.py"
click node_forecast_lib "https://github.com/andrianllmm/hack-iloilo/tree/main/data/forecast/src/forecast"

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,node_booking,node_public_buy,node_public_sell,node_staff toneBlue
class node_accounts,node_capacity,node_gate,node_setup,node_forecast toneAmber
class node_orders,node_buying,node_pricing,node_prescriptions toneMint
class node_supabase toneRose
class node_sms,node_sms_route,node_webhook,node_relay,node_verify,node_forecast_train,node_forecast_lib,node_visitor,node_staff_user,node_sms_sender toneIndigo
```

## Components

### User entry points

- [Public home](https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Public booking](https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/book/page.tsx): `src/app/book/page.tsx`
- [Public rice buying](https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/buy/page.tsx): `src/app/buy/page.tsx`
- [Public selling](https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/sell/page.tsx): `src/app/sell/page.tsx`
- [Staff workspace](https://github.com/andrianllmm/hack-iloilo/tree/main/src/app/(app)): `src/app/(app)`

### Facility operations

- [Client accounts](https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/accounts): `src/modules/accounts`
- [Capacity planning](https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/capacity): `src/modules/capacity`
- [Gate and batches](https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/gate): `src/modules/gate`
- [Facility setup](https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/setup): `src/modules/setup`
- [Forecasting](https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/forecast): `src/modules/forecast`

### Commercial services

- [Rice orders](https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/orders): `src/modules/orders`
- [Palay offers](https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/buying): `src/modules/buying`
- [Prices and costs](https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/pricing): `src/modules/pricing`
- [Prescriptions](https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/prescriptions): `src/modules/prescriptions`

### Shared platform

- **Supabase database**

### Messaging and forecasting

- [SMS processing](https://github.com/andrianllmm/hack-iloilo/tree/main/src/modules/sms): `src/modules/sms`
- [SMS process endpoint](https://github.com/andrianllmm/hack-iloilo/blob/main/src/app/api/sms/process/route.ts): `src/app/api/sms/process/route.ts`
- [Inbound webhook](https://github.com/andrianllmm/hack-iloilo/blob/main/services/sms-webhook/api/inbound.ts): `services/sms-webhook/api/inbound.ts`
- [Webhook relay](https://github.com/andrianllmm/hack-iloilo/blob/main/services/sms-webhook/lib/relay.ts): `services/sms-webhook/lib/relay.ts`
- [Webhook verification](https://github.com/andrianllmm/hack-iloilo/blob/main/services/sms-webhook/lib/verify.ts): `services/sms-webhook/lib/verify.ts`
- [Forecast training](https://github.com/andrianllmm/hack-iloilo/blob/main/data/forecast/src/forecast/train.py): `data/forecast/src/forecast/train.py`
- [Forecast model and parsing](https://github.com/andrianllmm/hack-iloilo/tree/main/data/forecast/src/forecast): `data/forecast/src/forecast`

### Other components

- **Public visitor**
- **Facility staff**
- **SMS sender**

## Connections

- Public visitor → Public home: opens services
- Public visitor → Public booking: requests booking
- Public visitor → Public rice buying: requests rice
- Public visitor → Public selling: offers palay
- Facility staff → Staff workspace: uses operations
- Public home → Prices and costs: reads prices (evidence: `src/app/page.tsx`)
- Public rice buying → Gate and batches: tracks batch (evidence: `src/app/buy/page.tsx`)
- Public rice buying → Rice orders: checks stock (evidence: `src/app/buy/page.tsx`)
- Public rice buying → Prices and costs: reads prices (evidence: `src/app/buy/page.tsx`)
- Public rice buying → Rice orders: renders order form (evidence: `src/app/buy/page.tsx`)
- Public selling → Palay offers: renders offer form (evidence: `src/app/sell/page.tsx`)
- Public selling → Prices and costs: reads prices (evidence: `src/app/sell/page.tsx`)
- Public booking → Supabase database: submits booking
- Staff workspace → Client accounts: uses client tools (evidence: `src/app/(app)/prices/page.tsx`)
- Staff workspace → Prices and costs: loads price tools (evidence: `src/app/(app)/prices/page.tsx`)
- Client accounts → Supabase database: reads and writes
- Prices and costs → Supabase database: reads price records (evidence: `src/modules/pricing/queries.ts`)
- Prices and costs → Facility setup: reads facility (evidence: `src/modules/pricing/queries.ts`)
- Prices and costs → Palay offers: reads purchase cost (evidence: `src/modules/pricing/queries.ts`)
- Rice orders → Supabase database: reads order stock
- Capacity planning → Supabase database: reads facility load
- Gate and batches → Supabase database: manages batches
- Facility setup → Supabase database: manages facility
- Prescriptions → Supabase database: manages prescriptions
- SMS sender → Inbound webhook: sends message
- Inbound webhook → Webhook relay: relays request (evidence: `services/sms-webhook/api/inbound.ts`)
- Webhook relay → Webhook verification: verifies request (evidence: `services/sms-webhook/lib/relay.ts`)
- SMS process endpoint → SMS processing: loads message data (evidence: `src/app/api/sms/process/route.ts`)
- SMS processing → Supabase database: reads message records
- Forecast training → Forecast model and parsing: uses model and parser (evidence: `data/forecast/src/forecast/train.py`)
- Forecasting → Supabase database: uses forecast data
