# hadiissa1/nahel architecture

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

- Interactive diagram: https://gitdiagram.com/hadiissa1/nahel
- Repository: https://github.com/hadiissa1/nahel

## Overview

Nahel is a bilingual honey and beekeeping shop with a public storefront and an owner/staff admin. The main customer path is browsing the catalog, building a cart, and recording an order; the README documents live stock checks, promo codes, delivery-area selection, and WhatsApp follow-up. Separate branches cover in-person sales, finance and visitor reporting, traceability, reviews, articles, and subscriber offers. The graph uses README statements and SOURCE INDEX references for links; many implementation details were not sampled, so those links are documentation-backed rather than claims of inspected call flow.

Main entry points: [`app/admin/actions.ts`](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/app/admin/actions.ts) (Admin actions), [`lib/orders.ts`](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/orders.ts) (Order processing), [`lib/products.ts`](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/products.ts) (Product and stock), [`lib/db.ts`](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/db.ts) (SQLite database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shop["Storefront"]
  node_shop["Shop and catalog<br/>[Shop.tsx]"]
  node_productpage["Product pages<br/>[page.tsx]"]
  node_articles["Tips and articles<br/>[articles.ts]"]
end

subgraph group_commerce["Commerce"]
  node_cart["Cart and checkout<br/>[Cart.tsx]"]
  node_orderactions["Order actions<br/>[actions.ts]"]
  node_orders["Order processing<br/>[orders.ts]"]
  node_delivery["Delivery areas<br/>[delivery.ts]"]
  node_promos["Promo codes<br/>[promo.ts]"]
  node_catalog["Product and stock<br/>[products.ts]"]
  node_lots["Lot traceability<br/>[lots.ts]"]
  node_reviews["Customer reviews<br/>[reviews.ts]"]
end

subgraph group_management["Store management"]
  node_till["In-person till<br/>[PosTerminal.tsx]"]
  node_admin["Admin pages<br/>[page.tsx]"]
  node_adminactions["Admin actions<br/>[actions.ts]"]
  node_auth["Admin and staff access<br/>[auth.ts]"]
  node_staff["Staff accounts<br/>[staff.ts]"]
  node_finance["Finance reports<br/>[finance.ts]"]
  node_alerts["Stock alerts<br/>[stock-alerts.ts]"]
end

subgraph group_services["Store services"]
  node_database[("SQLite database<br/>[db.ts]")]
  node_analytics["Visitor analytics<br/>[analytics.ts]"]
  node_subscribers["Offers subscribers<br/>[subscribers.ts]"]
  node_mail["Email delivery<br/>[mail.ts]"]
end

node_customer(("Customer"))
node_owner(("Owner or staff"))
node_whatsapp["WhatsApp"]

node_customer -->|"browses"| node_shop
node_customer -->|"adds items"| node_cart
node_cart -->|"checks stock"| node_catalog
node_cart -->|"applies code"| node_promos
node_cart -->|"selects area"| node_delivery
node_cart -->|"submits order"| node_orderactions
node_orderactions -.->|"records order"| node_orders
node_orders -->|"updates stock"| node_catalog
node_orders -->|"sends order"| node_whatsapp
node_customer -->|"views product"| node_productpage
node_productpage -->|"loads product"| node_catalog
node_productpage -->|"loads ratings"| node_reviews
node_owner -->|"manages store"| node_admin
node_admin -->|"checks access"| node_auth
node_admin -->|"manages products"| node_catalog
node_admin -.->|"submits changes"| node_adminactions
node_adminactions -->|"requires access"| node_auth
node_adminactions -->|"saves products"| node_catalog
node_adminactions -->|"moderates reviews"| node_reviews
node_adminactions -->|"saves articles"| node_articles
node_adminactions -->|"sends promotions"| node_subscribers
node_adminactions -->|"manages lots"| node_lots
node_owner -->|"rings up sale"| node_till
node_till -->|"records sale"| node_orders
node_owner -->|"reviews reports"| node_finance
node_finance -->|"reports sales"| node_orders
node_finance -->|"reports visitors"| node_analytics
node_catalog -->|"reads and writes"| node_database
node_orders -.->|"persists orders"| node_database
node_articles -->|"reads and writes"| node_database
node_reviews -->|"reads and writes"| node_database
node_subscribers -->|"reads and writes"| node_database
node_subscribers -->|"sends confirmations"| node_mail
node_owner -->|"configures alerts"| node_alerts
node_alerts -->|"emails low stock"| node_mail
node_customer -->|"reads tips"| node_articles
node_customer -->|"submits review"| node_reviews
node_customer -->|"signs up"| node_subscribers
node_customer -->|"contacts shop"| node_whatsapp
node_owner -->|"manages accounts"| node_staff
node_owner -->|"records harvest lots"| node_lots
node_lots -.->|"stores records"| node_database

click node_shop "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/components/Shop.tsx"
click node_cart "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/components/Cart.tsx"
click node_productpage "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/app/(shop)/product/%5Bid%5D/page.tsx"
click node_orderactions "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/app/orders/actions.ts"
click node_orders "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/orders.ts"
click node_delivery "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/delivery.ts"
click node_promos "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/promo.ts"
click node_till "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/components/admin/PosTerminal.tsx"
click node_catalog "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/products.ts"
click node_database "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/db.ts"
click node_admin "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/app/admin/page.tsx"
click node_adminactions "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/app/admin/actions.ts"
click node_auth "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/auth.ts"
click node_staff "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/staff.ts"
click node_finance "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/finance.ts"
click node_analytics "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/analytics.ts"
click node_alerts "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/stock-alerts.ts"
click node_lots "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/lots.ts"
click node_reviews "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/reviews.ts"
click node_articles "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/articles.ts"
click node_subscribers "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/subscribers.ts"
click node_mail "https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/mail.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_shop,node_productpage,node_articles toneBlue
class node_cart,node_orderactions,node_orders,node_delivery,node_promos,node_catalog,node_lots,node_reviews toneAmber
class node_till,node_admin,node_adminactions,node_auth,node_staff,node_finance,node_alerts toneMint
class node_database,node_analytics,node_subscribers,node_mail toneRose
class node_customer,node_owner,node_whatsapp toneIndigo
```

## Components

### Storefront

- [Shop and catalog](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/components/Shop.tsx): `components/Shop.tsx`
- [Product pages](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/app/(shop)/product/%5Bid%5D/page.tsx): `app/(shop)/product/[id]/page.tsx`
- [Tips and articles](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/articles.ts): `lib/articles.ts`

### Commerce

- [Cart and checkout](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/components/Cart.tsx): `components/Cart.tsx`
- [Order actions](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/app/orders/actions.ts): `app/orders/actions.ts`
- [Order processing](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/orders.ts): `lib/orders.ts`
- [Delivery areas](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/delivery.ts): `lib/delivery.ts`
- [Promo codes](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/promo.ts): `lib/promo.ts`
- [Product and stock](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/products.ts): `lib/products.ts`
- [Lot traceability](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/lots.ts): `lib/lots.ts`
- [Customer reviews](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/reviews.ts): `lib/reviews.ts`

### Store management

- [In-person till](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/components/admin/PosTerminal.tsx): `components/admin/PosTerminal.tsx`
- [Admin pages](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/app/admin/page.tsx): `app/admin/page.tsx`
- [Admin actions](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/app/admin/actions.ts): `app/admin/actions.ts`
- [Admin and staff access](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/auth.ts): `lib/auth.ts`
- [Staff accounts](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/staff.ts): `lib/staff.ts`
- [Finance reports](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/finance.ts): `lib/finance.ts`
- [Stock alerts](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/stock-alerts.ts): `lib/stock-alerts.ts`

### Store services

- [SQLite database](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/db.ts): `lib/db.ts`
- [Visitor analytics](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/analytics.ts): `lib/analytics.ts`
- [Offers subscribers](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/subscribers.ts): `lib/subscribers.ts`
- [Email delivery](https://github.com/hadiissa1/nahel/blob/claude/shuffle-hero-component-ughbam/lib/mail.ts): `lib/mail.ts`

### Other components

- **Customer**
- **Owner or staff**
- **WhatsApp**

## Connections

- Customer → Shop and catalog: browses (evidence: `README.md`)
- Customer → Cart and checkout: adds items (evidence: `README.md`)
- Cart and checkout → Product and stock: checks stock (evidence: `README.md`)
- Cart and checkout → Promo codes: applies code (evidence: `README.md`)
- Cart and checkout → Delivery areas: selects area (evidence: `README.md`)
- Cart and checkout → Order actions: submits order (evidence: `README.md`)
- Order actions → Order processing: records order
- Order processing → Product and stock: updates stock (evidence: `README.md`)
- Order processing → WhatsApp: sends order (evidence: `README.md`)
- Customer → Product pages: views product (evidence: `README.md`)
- Product pages → Product and stock: loads product (evidence: `app/(shop)/product/[id]/page.tsx`)
- Product pages → Customer reviews: loads ratings (evidence: `app/(shop)/product/[id]/page.tsx`)
- Owner or staff → Admin pages: manages store (evidence: `README.md`)
- Admin pages → Admin and staff access: checks access (evidence: `app/admin/page.tsx`)
- Admin pages → Product and stock: manages products (evidence: `app/admin/page.tsx`)
- Admin pages → Admin actions: submits changes
- Admin actions → Admin and staff access: requires access (evidence: `app/admin/actions.ts`)
- Admin actions → Product and stock: saves products (evidence: `app/admin/actions.ts`)
- Admin actions → Customer reviews: moderates reviews (evidence: `app/admin/actions.ts`)
- Admin actions → Tips and articles: saves articles (evidence: `app/admin/actions.ts`)
- Admin actions → Offers subscribers: sends promotions (evidence: `app/admin/actions.ts`)
- Admin actions → Lot traceability: manages lots (evidence: `app/admin/actions.ts`)
- Owner or staff → In-person till: rings up sale (evidence: `README.md`)
- In-person till → Order processing: records sale (evidence: `README.md`)
- Owner or staff → Finance reports: reviews reports (evidence: `README.md`)
- Finance reports → Order processing: reports sales (evidence: `README.md`)
- Finance reports → Visitor analytics: reports visitors (evidence: `README.md`)
- Product and stock → SQLite database: reads and writes (evidence: `lib/products.ts`)
- Order processing → SQLite database: persists orders
- Tips and articles → SQLite database: reads and writes (evidence: `lib/articles.ts`)
- Customer reviews → SQLite database: reads and writes (evidence: `lib/reviews.ts`)
- Offers subscribers → SQLite database: reads and writes (evidence: `lib/subscribers.ts`)
- Offers subscribers → Email delivery: sends confirmations (evidence: `lib/subscribers.ts`)
- Owner or staff → Stock alerts: configures alerts (evidence: `README.md`)
- Stock alerts → Email delivery: emails low stock (evidence: `README.md`)
- Customer → Tips and articles: reads tips
- Customer → Customer reviews: submits review
- Customer → Offers subscribers: signs up (evidence: `README.md`)
- Customer → WhatsApp: contacts shop (evidence: `README.md`)
- Owner or staff → Staff accounts: manages accounts (evidence: `README.md`)
- Owner or staff → Lot traceability: records harvest lots (evidence: `README.md`)
- Lot traceability → SQLite database: stores records
