# ajibare/-business-platform-web architecture

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

- Interactive diagram: https://gitdiagram.com/ajibare/-business-platform-web
- Repository: https://github.com/ajibare/-business-platform-web

## Overview

This is a Next.js frontend for a multi-product SaaS platform, with Pharmacy Stock Intelligence as its first product. A user signs in, enters the authenticated platform, and can review pharmacy stock risk or manage receipts, counts, batches, movements, expiry, suppliers, and reports. Pharmacy screens call a shared API client, which sends authenticated requests to an external backend. The source index documents route-to-feature and feature-to-client imports; backend behavior and several feature implementations were not sampled.

Main entry points: [`src/services/api.ts`](https://github.com/ajibare/-business-platform-web/blob/main/src/services/api.ts) (API Client), [`src/features/pharmacy/pharmacy-dashboard.tsx`](https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/pharmacy-dashboard.tsx) (Stock Dashboard), [`src/features/pharmacy/stock-receipts.tsx`](https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/stock-receipts.tsx) (Stock Receipts), [`src/app/(auth)/login/page.tsx`](https://github.com/ajibare/-business-platform-web/blob/main/src/app/(auth)/login/page.tsx) (Login Route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Authentication"]
  node_login["Login Route<br/>[page.tsx]"]
  node_loginform["Login Form<br/>[login-form.tsx]"]
  node_authstate["Auth State<br/>[use-auth.ts]"]
end

subgraph group_platform["Platform Shell"]
  node_platformroute["Platform Layout<br/>[layout.tsx]"]
  node_guard["Auth Guard<br/>[auth-guard.tsx]"]
  node_shell["App Shell<br/>[app-shell.tsx]"]
end

subgraph group_pharmacy["Pharmacy Intelligence"]
  node_dashboardroute["Dashboard Route<br/>[page.tsx]"]
  node_pharmacyroute["Pharmacy Route<br/>[page.tsx]"]
  node_dashboard["Stock Dashboard"]
  node_batches["Batch Management<br/>[batches.tsx]"]
  node_receipts["Stock Receipts<br/>[stock-receipts.tsx]"]
  node_counts["Stock Counts<br/>[stock-counts.tsx]"]
  node_movements["Stock Movements<br/>[movements.tsx]"]
  node_expiry["Expiry Monitor<br/>[expiry-monitor.tsx]"]
  node_suppliers["Supplier Management<br/>[suppliers.tsx]"]
  node_reports["Reports<br/>[reports-view.tsx]"]
end

subgraph group_shared["Shared Runtime"]
  node_api["API Client<br/>[api.ts]"]
  node_contracts["API Types<br/>[api.ts]"]
  node_ui["UI Primitives"]
end

node_user(("User"))
node_backend{{"Platform API"}}

node_user -->|"opens sign-in"| node_login
node_login -->|"renders"| node_loginform
node_login -.->|"enters platform"| node_platformroute
node_platformroute -->|"wraps routes"| node_guard
node_platformroute -->|"renders shell"| node_shell
node_guard -->|"checks session"| node_authstate
node_shell -->|"reads session"| node_authstate
node_loginform -->|"sets session"| node_authstate
node_loginform -->|"sends requests"| node_api
node_dashboardroute -->|"renders"| node_dashboard
node_pharmacyroute -->|"renders"| node_dashboard
node_dashboard -->|"fetches summary"| node_api
node_batches -->|"fetches batches"| node_api
node_receipts -->|"manages receipts"| node_api
node_counts -->|"manages counts"| node_api
node_movements -->|"fetches movements"| node_api
node_expiry -->|"fetches expiry"| node_api
node_suppliers -->|"manages suppliers"| node_api
node_reports -->|"fetches reports"| node_api
node_api -->|"sends HTTP"| node_backend
node_receipts -->|"uses data types"| node_contracts
node_counts -->|"uses data types"| node_contracts
node_dashboard -->|"uses data types"| node_contracts
node_dashboard -->|"renders primitives"| node_ui
node_receipts -->|"renders primitives"| node_ui

click node_login "https://github.com/ajibare/-business-platform-web/blob/main/src/app/(auth)/login/page.tsx"
click node_loginform "https://github.com/ajibare/-business-platform-web/blob/main/src/features/auth/login-form.tsx"
click node_authstate "https://github.com/ajibare/-business-platform-web/blob/main/src/hooks/use-auth.ts"
click node_platformroute "https://github.com/ajibare/-business-platform-web/blob/main/src/app/(platform)/layout.tsx"
click node_guard "https://github.com/ajibare/-business-platform-web/blob/main/src/components/guards/auth-guard.tsx"
click node_shell "https://github.com/ajibare/-business-platform-web/blob/main/src/components/layouts/app-shell.tsx"
click node_dashboardroute "https://github.com/ajibare/-business-platform-web/blob/main/src/app/(platform)/dashboard/page.tsx"
click node_pharmacyroute "https://github.com/ajibare/-business-platform-web/blob/main/src/app/products/pharmacy/page.tsx"
click node_dashboard "https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/pharmacy-dashboard.tsx"
click node_batches "https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/batches.tsx"
click node_receipts "https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/stock-receipts.tsx"
click node_counts "https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/stock-counts.tsx"
click node_movements "https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/movements.tsx"
click node_expiry "https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/expiry-monitor.tsx"
click node_suppliers "https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/suppliers.tsx"
click node_reports "https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/reports-view.tsx"
click node_api "https://github.com/ajibare/-business-platform-web/blob/main/src/services/api.ts"
click node_contracts "https://github.com/ajibare/-business-platform-web/blob/main/src/types/api.ts"
click node_ui "https://github.com/ajibare/-business-platform-web/tree/main/src/components/ui"

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_login,node_loginform,node_authstate,node_user toneBlue
class node_platformroute,node_guard,node_shell toneAmber
class node_dashboardroute,node_pharmacyroute,node_dashboard,node_batches,node_receipts,node_counts,node_movements,node_expiry,node_suppliers,node_reports,node_backend toneMint
class node_api,node_contracts,node_ui toneRose
```

## Components

### Authentication

- [Login Route](https://github.com/ajibare/-business-platform-web/blob/main/src/app/(auth)/login/page.tsx): `src/app/(auth)/login/page.tsx`
- [Login Form](https://github.com/ajibare/-business-platform-web/blob/main/src/features/auth/login-form.tsx): `src/features/auth/login-form.tsx`
- [Auth State](https://github.com/ajibare/-business-platform-web/blob/main/src/hooks/use-auth.ts): `src/hooks/use-auth.ts`

### Platform Shell

- [Platform Layout](https://github.com/ajibare/-business-platform-web/blob/main/src/app/(platform)/layout.tsx): `src/app/(platform)/layout.tsx`
- [Auth Guard](https://github.com/ajibare/-business-platform-web/blob/main/src/components/guards/auth-guard.tsx): `src/components/guards/auth-guard.tsx`
- [App Shell](https://github.com/ajibare/-business-platform-web/blob/main/src/components/layouts/app-shell.tsx): `src/components/layouts/app-shell.tsx`

### Pharmacy Intelligence

- [Dashboard Route](https://github.com/ajibare/-business-platform-web/blob/main/src/app/(platform)/dashboard/page.tsx): `src/app/(platform)/dashboard/page.tsx`
- [Pharmacy Route](https://github.com/ajibare/-business-platform-web/blob/main/src/app/products/pharmacy/page.tsx): `src/app/products/pharmacy/page.tsx`
- [Stock Dashboard](https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/pharmacy-dashboard.tsx): `src/features/pharmacy/pharmacy-dashboard.tsx`
- [Batch Management](https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/batches.tsx): `src/features/pharmacy/batches.tsx`
- [Stock Receipts](https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/stock-receipts.tsx): `src/features/pharmacy/stock-receipts.tsx`
- [Stock Counts](https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/stock-counts.tsx): `src/features/pharmacy/stock-counts.tsx`
- [Stock Movements](https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/movements.tsx): `src/features/pharmacy/movements.tsx`
- [Expiry Monitor](https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/expiry-monitor.tsx): `src/features/pharmacy/expiry-monitor.tsx`
- [Supplier Management](https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/suppliers.tsx): `src/features/pharmacy/suppliers.tsx`
- [Reports](https://github.com/ajibare/-business-platform-web/blob/main/src/features/pharmacy/reports-view.tsx): `src/features/pharmacy/reports-view.tsx`

### Shared Runtime

- [API Client](https://github.com/ajibare/-business-platform-web/blob/main/src/services/api.ts): `src/services/api.ts`
- [API Types](https://github.com/ajibare/-business-platform-web/blob/main/src/types/api.ts): `src/types/api.ts`
- [UI Primitives](https://github.com/ajibare/-business-platform-web/tree/main/src/components/ui): `src/components/ui`

### Other components

- **User**
- **Platform API**

## Connections

- User → Login Route: opens sign-in (evidence: `README.md`)
- Login Route → Login Form: renders (evidence: `src/app/(auth)/login/page.tsx`)
- Login Route → Platform Layout: enters platform
- Platform Layout → Auth Guard: wraps routes (evidence: `src/app/(platform)/layout.tsx`)
- Platform Layout → App Shell: renders shell (evidence: `src/app/(platform)/layout.tsx`)
- Auth Guard → Auth State: checks session (evidence: `src/components/guards/auth-guard.tsx`)
- App Shell → Auth State: reads session (evidence: `src/components/layouts/app-shell.tsx`)
- Login Form → Auth State: sets session (evidence: `src/features/auth/login-form.tsx`)
- Login Form → API Client: sends requests (evidence: `src/features/auth/login-form.tsx`)
- Dashboard Route → Stock Dashboard: renders (evidence: `src/app/(platform)/dashboard/page.tsx`)
- Pharmacy Route → Stock Dashboard: renders (evidence: `src/app/products/pharmacy/page.tsx`)
- Stock Dashboard → API Client: fetches summary (evidence: `src/features/pharmacy/pharmacy-dashboard.tsx`)
- Batch Management → API Client: fetches batches (evidence: `src/features/pharmacy/batches.tsx`)
- Stock Receipts → API Client: manages receipts (evidence: `src/features/pharmacy/stock-receipts.tsx`)
- Stock Counts → API Client: manages counts (evidence: `src/features/pharmacy/stock-counts.tsx`)
- Stock Movements → API Client: fetches movements (evidence: `src/features/pharmacy/movements.tsx`)
- Expiry Monitor → API Client: fetches expiry (evidence: `src/features/pharmacy/expiry-monitor.tsx`)
- Supplier Management → API Client: manages suppliers (evidence: `src/features/pharmacy/suppliers.tsx`)
- Reports → API Client: fetches reports (evidence: `src/features/pharmacy/reports-view.tsx`)
- API Client → Platform API: sends HTTP (evidence: `src/services/api.ts`)
- Stock Receipts → API Types: uses data types (evidence: `src/features/pharmacy/stock-receipts.tsx`)
- Stock Counts → API Types: uses data types (evidence: `src/features/pharmacy/stock-counts.tsx`)
- Stock Dashboard → API Types: uses data types (evidence: `src/features/pharmacy/pharmacy-dashboard.tsx`)
- Stock Dashboard → UI Primitives: renders primitives (evidence: `src/features/pharmacy/pharmacy-dashboard.tsx`)
- Stock Receipts → UI Primitives: renders primitives (evidence: `src/features/pharmacy/stock-receipts.tsx`)
