# fourier-tech/galla architecture

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

- Interactive diagram: https://gitdiagram.com/fourier-tech/galla
- Repository: https://github.com/fourier-tech/galla

## Overview

Galla is a multi-tenant salon-management SaaS. Its main workflow is owner/staff sign-in into a tenant-scoped dashboard, where staff manage orders, inventory, customers, services, suppliers, and expenses; dashboard actions persist domain changes and can broadcast updates. Analytics is a separate read-oriented capability, with rollups supporting reporting. The graph reflects documented product scope and indexed module references; several implementation details are unsampled, so their connections are omitted or cited to the README rather than inferred.

Main entry points: [`src/components/dashboard/dashboard-client.tsx`](https://github.com/fourier-tech/galla/blob/main/src/components/dashboard/dashboard-client.tsx) (Dashboard client), [`src/app/dashboard/actions.ts`](https://github.com/fourier-tech/galla/blob/main/src/app/dashboard/actions.ts) (Domain actions), [`src/lib/db/models`](https://github.com/fourier-tech/galla/tree/main/src/lib/db/models) (Domain records), [`src/app/api/auth/register/route.ts`](https://github.com/fourier-tech/galla/blob/main/src/app/api/auth/register/route.ts) (Workspace registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access &amp; tenancy"]
  node_login["Sign-in<br/>[login-form.tsx]"]
  node_auth["Auth service<br/>[auth.ts]"]
  node_registration["Workspace registration<br/>[route.ts]"]
  node_code["Access-code service<br/>[code-service.ts]"]
  node_tenant[("Tenant records<br/>[tenant.model.ts]")]
end

subgraph group_operations["Salon operations"]
  node_dashboard["Dashboard page<br/>[page.tsx]"]
  node_dashboard_ui["Dashboard client"]
  node_orders_ui["Order workspace<br/>[orders-tab.tsx]"]
  node_order_modal["New order form"]
  node_inventory_ui["Inventory workspace<br/>[inventory-tab.tsx]"]
  node_services_ui["Services workspace<br/>[services-tab.tsx]"]
  node_actions["Domain actions<br/>[actions.ts]"]
  node_orders_api["Orders API<br/>[route.ts]"]
  node_expenses_api["Expenses API<br/>[route.ts]"]
  node_products_api["Products API<br/>[route.ts]"]
end

subgraph group_insights["Analytics"]
  node_analytics_api["Analytics endpoint<br/>[route.ts]"]
  node_rollups["Analytics rollups<br/>[rollup-service.ts]"]
  node_analytics_ui["Analytics views"]
end

subgraph group_platform["Persistence &amp; integrations"]
  node_domain_models[("Domain records")]
  node_database[("MongoDB connection<br/>[mongodb.ts]")]
  node_realtime["Tenant realtime<br/>[pusher-server.ts]"]
  node_email["Email service<br/>[email-service.ts]"]
end

node_owner(("Owner / staff"))
node_pusher["Pusher Channels"]

node_owner -->|"signs in"| node_login
node_login -->|"authenticates"| node_auth
node_owner -->|"creates workspace"| node_registration
node_registration -->|"creates tenant"| node_tenant
node_registration -->|"requests codes"| node_code
node_code -->|"connects to"| node_database
node_code -->|"sends codes"| node_email
node_auth -->|"protects access"| node_dashboard
node_dashboard -->|"renders"| node_dashboard_ui
node_dashboard_ui -->|"shows tab"| node_orders_ui
node_dashboard_ui -->|"shows tab"| node_inventory_ui
node_dashboard_ui -->|"shows tab"| node_services_ui
node_orders_ui -->|"opens form"| node_order_modal
node_dashboard_ui -->|"invokes actions"| node_actions
node_services_ui -->|"invokes actions"| node_actions
node_actions -->|"connects to"| node_database
node_actions -->|"reads and writes"| node_domain_models
node_actions -->|"broadcasts updates"| node_realtime
node_orders_api -->|"queries orders"| node_domain_models
node_orders_api -->|"connects to"| node_database
node_expenses_api -->|"queries expenses"| node_domain_models
node_products_api -->|"queries products"| node_domain_models
node_analytics_api -->|"queries domain data"| node_domain_models
node_analytics_api -->|"uses rollups"| node_rollups
node_dashboard_ui -->|"shows analytics"| node_analytics_ui
node_realtime -.->|"publishes events"| node_pusher

click node_login "https://github.com/fourier-tech/galla/blob/main/src/components/auth/login-form.tsx"
click node_auth "https://github.com/fourier-tech/galla/blob/main/src/lib/auth/auth.ts"
click node_registration "https://github.com/fourier-tech/galla/blob/main/src/app/api/auth/register/route.ts"
click node_code "https://github.com/fourier-tech/galla/blob/main/src/lib/auth/code-service.ts"
click node_tenant "https://github.com/fourier-tech/galla/blob/main/src/lib/db/models/tenant.model.ts"
click node_dashboard "https://github.com/fourier-tech/galla/blob/main/src/app/dashboard/page.tsx"
click node_dashboard_ui "https://github.com/fourier-tech/galla/blob/main/src/components/dashboard/dashboard-client.tsx"
click node_orders_ui "https://github.com/fourier-tech/galla/blob/main/src/components/dashboard/tabs/orders-tab.tsx"
click node_order_modal "https://github.com/fourier-tech/galla/blob/main/src/components/dashboard/modals/new-order-modal.tsx"
click node_inventory_ui "https://github.com/fourier-tech/galla/blob/main/src/components/dashboard/tabs/inventory-tab.tsx"
click node_services_ui "https://github.com/fourier-tech/galla/blob/main/src/components/dashboard/tabs/services-tab.tsx"
click node_actions "https://github.com/fourier-tech/galla/blob/main/src/app/dashboard/actions.ts"
click node_orders_api "https://github.com/fourier-tech/galla/blob/main/src/app/api/orders/route.ts"
click node_expenses_api "https://github.com/fourier-tech/galla/blob/main/src/app/api/expenses/route.ts"
click node_products_api "https://github.com/fourier-tech/galla/blob/main/src/app/api/products/route.ts"
click node_domain_models "https://github.com/fourier-tech/galla/tree/main/src/lib/db/models"
click node_database "https://github.com/fourier-tech/galla/blob/main/src/lib/db/mongodb.ts"
click node_analytics_api "https://github.com/fourier-tech/galla/blob/main/src/app/api/analytics/route.ts"
click node_rollups "https://github.com/fourier-tech/galla/blob/main/src/lib/analytics/rollup-service.ts"
click node_analytics_ui "https://github.com/fourier-tech/galla/tree/main/src/components/dashboard/analytics"
click node_realtime "https://github.com/fourier-tech/galla/blob/main/src/lib/realtime/pusher-server.ts"
click node_email "https://github.com/fourier-tech/galla/blob/main/src/lib/email/email-service.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_login,node_auth,node_registration,node_code,node_tenant toneBlue
class node_dashboard,node_dashboard_ui,node_orders_ui,node_order_modal,node_inventory_ui,node_services_ui,node_actions,node_orders_api,node_expenses_api,node_products_api toneAmber
class node_analytics_api,node_rollups,node_analytics_ui toneMint
class node_domain_models,node_database,node_realtime,node_email toneRose
class node_owner,node_pusher toneIndigo
```

## Components

### Access & tenancy

- [Sign-in](https://github.com/fourier-tech/galla/blob/main/src/components/auth/login-form.tsx): `src/components/auth/login-form.tsx`
- [Auth service](https://github.com/fourier-tech/galla/blob/main/src/lib/auth/auth.ts): `src/lib/auth/auth.ts`
- [Workspace registration](https://github.com/fourier-tech/galla/blob/main/src/app/api/auth/register/route.ts): `src/app/api/auth/register/route.ts`
- [Access-code service](https://github.com/fourier-tech/galla/blob/main/src/lib/auth/code-service.ts): `src/lib/auth/code-service.ts`
- [Tenant records](https://github.com/fourier-tech/galla/blob/main/src/lib/db/models/tenant.model.ts): `src/lib/db/models/tenant.model.ts`

### Salon operations

- [Dashboard page](https://github.com/fourier-tech/galla/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Dashboard client](https://github.com/fourier-tech/galla/blob/main/src/components/dashboard/dashboard-client.tsx): `src/components/dashboard/dashboard-client.tsx`
- [Order workspace](https://github.com/fourier-tech/galla/blob/main/src/components/dashboard/tabs/orders-tab.tsx): `src/components/dashboard/tabs/orders-tab.tsx`
- [New order form](https://github.com/fourier-tech/galla/blob/main/src/components/dashboard/modals/new-order-modal.tsx): `src/components/dashboard/modals/new-order-modal.tsx`
- [Inventory workspace](https://github.com/fourier-tech/galla/blob/main/src/components/dashboard/tabs/inventory-tab.tsx): `src/components/dashboard/tabs/inventory-tab.tsx`
- [Services workspace](https://github.com/fourier-tech/galla/blob/main/src/components/dashboard/tabs/services-tab.tsx): `src/components/dashboard/tabs/services-tab.tsx`
- [Domain actions](https://github.com/fourier-tech/galla/blob/main/src/app/dashboard/actions.ts): `src/app/dashboard/actions.ts`
- [Orders API](https://github.com/fourier-tech/galla/blob/main/src/app/api/orders/route.ts): `src/app/api/orders/route.ts`
- [Expenses API](https://github.com/fourier-tech/galla/blob/main/src/app/api/expenses/route.ts): `src/app/api/expenses/route.ts`
- [Products API](https://github.com/fourier-tech/galla/blob/main/src/app/api/products/route.ts): `src/app/api/products/route.ts`

### Analytics

- [Analytics endpoint](https://github.com/fourier-tech/galla/blob/main/src/app/api/analytics/route.ts): `src/app/api/analytics/route.ts`
- [Analytics rollups](https://github.com/fourier-tech/galla/blob/main/src/lib/analytics/rollup-service.ts): `src/lib/analytics/rollup-service.ts`
- [Analytics views](https://github.com/fourier-tech/galla/tree/main/src/components/dashboard/analytics): `src/components/dashboard/analytics`

### Persistence & integrations

- [Domain records](https://github.com/fourier-tech/galla/tree/main/src/lib/db/models): `src/lib/db/models`
- [MongoDB connection](https://github.com/fourier-tech/galla/blob/main/src/lib/db/mongodb.ts): `src/lib/db/mongodb.ts`
- [Tenant realtime](https://github.com/fourier-tech/galla/blob/main/src/lib/realtime/pusher-server.ts): `src/lib/realtime/pusher-server.ts`
- [Email service](https://github.com/fourier-tech/galla/blob/main/src/lib/email/email-service.ts): `src/lib/email/email-service.ts`

### Other components

- **Owner / staff**
- **Pusher Channels**

## Connections

- Owner / staff → Sign-in: signs in (evidence: `README.md`)
- Sign-in → Auth service: authenticates (evidence: `README.md`)
- Owner / staff → Workspace registration: creates workspace (evidence: `README.md`)
- Workspace registration → Tenant records: creates tenant (evidence: `src/app/api/auth/register/route.ts`)
- Workspace registration → Access-code service: requests codes (evidence: `src/app/api/auth/register/route.ts`)
- Access-code service → MongoDB connection: connects to (evidence: `src/lib/auth/code-service.ts`)
- Access-code service → Email service: sends codes (evidence: `src/lib/auth/code-service.ts`)
- Auth service → Dashboard page: protects access (evidence: `README.md`)
- Dashboard page → Dashboard client: renders (evidence: `src/app/dashboard/page.tsx`)
- Dashboard client → Order workspace: shows tab (evidence: `src/components/dashboard/dashboard-client.tsx`)
- Dashboard client → Inventory workspace: shows tab (evidence: `src/components/dashboard/dashboard-client.tsx`)
- Dashboard client → Services workspace: shows tab (evidence: `src/components/dashboard/dashboard-client.tsx`)
- Order workspace → New order form: opens form (evidence: `src/components/dashboard/tabs/orders-tab.tsx`)
- Dashboard client → Domain actions: invokes actions (evidence: `src/components/dashboard/dashboard-client.tsx`)
- Services workspace → Domain actions: invokes actions (evidence: `src/components/dashboard/tabs/services-tab.tsx`)
- Domain actions → MongoDB connection: connects to (evidence: `src/app/dashboard/actions.ts`)
- Domain actions → Domain records: reads and writes (evidence: `src/app/dashboard/actions.ts`)
- Domain actions → Tenant realtime: broadcasts updates (evidence: `src/app/dashboard/actions.ts`)
- Orders API → Domain records: queries orders (evidence: `src/app/api/orders/route.ts`)
- Orders API → MongoDB connection: connects to (evidence: `src/app/api/orders/route.ts`)
- Expenses API → Domain records: queries expenses (evidence: `src/app/api/expenses/route.ts`)
- Products API → Domain records: queries products (evidence: `src/app/api/products/route.ts`)
- Analytics endpoint → Domain records: queries domain data (evidence: `src/app/api/analytics/route.ts`)
- Analytics endpoint → Analytics rollups: uses rollups (evidence: `src/app/api/analytics/route.ts`)
- Dashboard client → Analytics views: shows analytics (evidence: `src/components/dashboard/dashboard-client.tsx`)
- Tenant realtime → Pusher Channels: publishes events (evidence: `README.md`)
