# anoch123/helapoz architecture

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

- Interactive diagram: https://gitdiagram.com/anoch123/helapoz
- Repository: https://github.com/anoch123/helapoz

## Overview

Helapoz is a shop-focused POS administration application. A shop user signs in, then works in dashboard areas such as catalogue management and staff administration; those screens call Next.js API routes that validate shop context and delegate to domain services backed by Supabase. The tree also documents sales, profile, permissions, and subscription-related capabilities, though their detailed wiring was not sampled. Edges use source-index references and excerpts where available; uncertain links are omitted rather than inferred.

Main entry points: [`lib/services/require-shop-context.service.ts`](https://github.com/anoch123/helapoz/blob/main/lib/services/require-shop-context.service.ts) (Shop context check), [`lib/supabase/admin.ts`](https://github.com/anoch123/helapoz/blob/main/lib/supabase/admin.ts) (Admin client), [`app/api/auth/login/route.ts`](https://github.com/anoch123/helapoz/blob/main/app/api/auth/login/route.ts) (Login endpoint), [`app/api/shop/users/route.ts`](https://github.com/anoch123/helapoz/blob/main/app/api/shop/users/route.ts) (Shop users API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and dashboard"]
  node_login_page["Sign-in page<br/>[page.tsx]"]
  node_login_form["Login form<br/>[login-form.tsx]"]
  node_dashboard["Dashboard overview<br/>[page.tsx]"]
  node_sales["Sales area<br/>[page.tsx]"]
  node_profile["Shop profile<br/>[my-profile.tsx]"]
end

subgraph group_catalogue["Catalogue management"]
  node_brand_page["Brand page<br/>[page.tsx]"]
  node_brand_ui["Brand management"]
  node_brand_api["Brand API<br/>[route.ts]"]
  node_brand_service["Brand service"]
  node_category_page["Category page<br/>[page.tsx]"]
  node_category_service["Category service"]
end

subgraph group_staff["Staff administration"]
  node_staff_page["Staff directory page<br/>[page.tsx]"]
  node_staff_ui["Staff directory"]
  node_staff_detail["Staff details<br/>[staff-details.tsx]"]
  node_staff_hook["Staff user hook<br/>[useShopUsers.ts]"]
  node_users_api["Shop users API<br/>[route.ts]"]
  node_user_service["Shop user service"]
  node_permissions_page["Staff permissions<br/>[page.tsx]"]
  node_permissions_api["User permissions API<br/>[route.ts]"]
end

subgraph group_platform["Access and services"]
  node_login_api["Login endpoint<br/>[route.ts]"]
  node_shop_context["Shop context check"]
  node_shop_session["Shop sessions"]
  node_subscription["Subscription access"]
  node_permission_check["Permission checks"]
  node_supabase_server["Server client<br/>[server.ts]"]
  node_supabase_admin["Admin client<br/>[admin.ts]"]
end

node_user(("Shop user"))
node_supabase[("Supabase")]

node_user -->|"opens"| node_login_page
node_login_page -->|"renders"| node_login_form
node_login_form -.->|"submits credentials"| node_login_api
node_login_api -->|"creates or revokes"| node_shop_session
node_login_api -->|"checks access"| node_subscription
node_login_api -->|"authenticates with"| node_supabase_server
node_login_api -->|"queries shop"| node_supabase_admin
node_dashboard -.->|"shows overview"| node_user
node_user -.->|"opens"| node_brand_page
node_brand_page -->|"renders"| node_brand_ui
node_brand_ui -.->|"loads and updates"| node_brand_api
node_brand_api -->|"delegates"| node_brand_service
node_brand_api -->|"checks permission"| node_permission_check
node_brand_service -->|"queries catalogue"| node_supabase_admin
node_category_page -.->|"uses category API"| node_category_service
node_user -.->|"opens"| node_staff_page
node_staff_page -->|"renders"| node_staff_ui
node_staff_ui -->|"loads staff"| node_staff_hook
node_staff_ui -.->|"requests staff data"| node_users_api
node_staff_hook -.->|"fetches staff"| node_users_api
node_users_api -->|"requires context"| node_shop_context
node_users_api -->|"lists or creates users"| node_user_service
node_user_service -->|"queries user records"| node_supabase_admin
node_staff_detail -.->|"loads staff details"| node_shop_context
node_permissions_page -.->|"manages permissions"| node_permissions_api
node_permissions_api -->|"requires context"| node_shop_context
node_shop_context -->|"verifies identity"| node_supabase_server
node_shop_context -->|"validates session"| node_shop_session
node_shop_context -->|"rechecks access"| node_subscription
node_shop_context -->|"checks shop status"| node_supabase_admin
node_shop_session -->|"reads and writes sessions"| node_supabase_admin
node_subscription -->|"checks subscription"| node_supabase_admin
node_brand_service -->|"requires shop scope"| node_shop_context
node_category_service -->|"queries categories"| node_supabase_admin
node_category_service -->|"requires shop scope"| node_shop_context
node_supabase_server -.->|"connects"| node_supabase
node_supabase_admin -.->|"connects"| node_supabase

click node_login_page "https://github.com/anoch123/helapoz/blob/main/app/page.tsx"
click node_login_form "https://github.com/anoch123/helapoz/blob/main/components/form/auth/login-form.tsx"
click node_login_api "https://github.com/anoch123/helapoz/blob/main/app/api/auth/login/route.ts"
click node_dashboard "https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/dashboard/page.tsx"
click node_sales "https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/sales/page.tsx"
click node_profile "https://github.com/anoch123/helapoz/blob/main/components/widgets/profile/my-profile.tsx"
click node_brand_page "https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/catalogue/manage-brands/page.tsx"
click node_brand_ui "https://github.com/anoch123/helapoz/blob/main/components/widgets/catalogue/brands/brand-management.tsx"
click node_brand_api "https://github.com/anoch123/helapoz/blob/main/app/api/catalogue/brands/route.ts"
click node_brand_service "https://github.com/anoch123/helapoz/blob/main/lib/services/catalogue-brand.service.ts"
click node_category_page "https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/catalogue/manage-categories/page.tsx"
click node_category_service "https://github.com/anoch123/helapoz/blob/main/lib/services/catalogue-category.service.ts"
click node_staff_page "https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/manage-staff/page.tsx"
click node_staff_ui "https://github.com/anoch123/helapoz/blob/main/components/widgets/staff/staff-directory.tsx"
click node_staff_detail "https://github.com/anoch123/helapoz/blob/main/components/widgets/staff/staff-details.tsx"
click node_staff_hook "https://github.com/anoch123/helapoz/blob/main/hooks/useShopUsers.ts"
click node_users_api "https://github.com/anoch123/helapoz/blob/main/app/api/shop/users/route.ts"
click node_user_service "https://github.com/anoch123/helapoz/blob/main/lib/services/shop-user.service.ts"
click node_permissions_page "https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/manage-staff/%5BmembershipId%5D/permissions/page.tsx"
click node_permissions_api "https://github.com/anoch123/helapoz/blob/main/app/api/shop/users/%5BmembershipId%5D/shop-user-permissions/route.ts"
click node_shop_context "https://github.com/anoch123/helapoz/blob/main/lib/services/require-shop-context.service.ts"
click node_shop_session "https://github.com/anoch123/helapoz/blob/main/lib/services/shop-session.service.ts"
click node_subscription "https://github.com/anoch123/helapoz/blob/main/lib/services/subscription-access.service.ts"
click node_permission_check "https://github.com/anoch123/helapoz/blob/main/lib/services/require-shop-permission.service.ts"
click node_supabase_server "https://github.com/anoch123/helapoz/blob/main/lib/supabase/server.ts"
click node_supabase_admin "https://github.com/anoch123/helapoz/blob/main/lib/supabase/admin.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_page,node_login_form,node_dashboard,node_sales,node_profile,node_user toneBlue
class node_brand_page,node_brand_ui,node_brand_api,node_brand_service,node_category_page,node_category_service,node_supabase toneAmber
class node_staff_page,node_staff_ui,node_staff_detail,node_staff_hook,node_users_api,node_user_service,node_permissions_page,node_permissions_api toneMint
class node_login_api,node_shop_context,node_shop_session,node_subscription,node_permission_check,node_supabase_server,node_supabase_admin toneRose
```

## Components

### Entry and dashboard

- [Sign-in page](https://github.com/anoch123/helapoz/blob/main/app/page.tsx): `app/page.tsx`
- [Login form](https://github.com/anoch123/helapoz/blob/main/components/form/auth/login-form.tsx): `components/form/auth/login-form.tsx`
- [Dashboard overview](https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/dashboard/page.tsx): `app/(dashboard)/dashboard/page.tsx`
- [Sales area](https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/sales/page.tsx): `app/(dashboard)/sales/page.tsx`
- [Shop profile](https://github.com/anoch123/helapoz/blob/main/components/widgets/profile/my-profile.tsx): `components/widgets/profile/my-profile.tsx`

### Catalogue management

- [Brand page](https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/catalogue/manage-brands/page.tsx): `app/(dashboard)/catalogue/manage-brands/page.tsx`
- [Brand management](https://github.com/anoch123/helapoz/blob/main/components/widgets/catalogue/brands/brand-management.tsx): `components/widgets/catalogue/brands/brand-management.tsx`
- [Brand API](https://github.com/anoch123/helapoz/blob/main/app/api/catalogue/brands/route.ts): `app/api/catalogue/brands/route.ts`
- [Brand service](https://github.com/anoch123/helapoz/blob/main/lib/services/catalogue-brand.service.ts): `lib/services/catalogue-brand.service.ts`
- [Category page](https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/catalogue/manage-categories/page.tsx): `app/(dashboard)/catalogue/manage-categories/page.tsx`
- [Category service](https://github.com/anoch123/helapoz/blob/main/lib/services/catalogue-category.service.ts): `lib/services/catalogue-category.service.ts`

### Staff administration

- [Staff directory page](https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/manage-staff/page.tsx): `app/(dashboard)/manage-staff/page.tsx`
- [Staff directory](https://github.com/anoch123/helapoz/blob/main/components/widgets/staff/staff-directory.tsx): `components/widgets/staff/staff-directory.tsx`
- [Staff details](https://github.com/anoch123/helapoz/blob/main/components/widgets/staff/staff-details.tsx): `components/widgets/staff/staff-details.tsx`
- [Staff user hook](https://github.com/anoch123/helapoz/blob/main/hooks/useShopUsers.ts): `hooks/useShopUsers.ts`
- [Shop users API](https://github.com/anoch123/helapoz/blob/main/app/api/shop/users/route.ts): `app/api/shop/users/route.ts`
- [Shop user service](https://github.com/anoch123/helapoz/blob/main/lib/services/shop-user.service.ts): `lib/services/shop-user.service.ts`
- [Staff permissions](https://github.com/anoch123/helapoz/blob/main/app/(dashboard)/manage-staff/%5BmembershipId%5D/permissions/page.tsx): `app/(dashboard)/manage-staff/[membershipId]/permissions/page.tsx`
- [User permissions API](https://github.com/anoch123/helapoz/blob/main/app/api/shop/users/%5BmembershipId%5D/shop-user-permissions/route.ts): `app/api/shop/users/[membershipId]/shop-user-permissions/route.ts`

### Access and services

- [Login endpoint](https://github.com/anoch123/helapoz/blob/main/app/api/auth/login/route.ts): `app/api/auth/login/route.ts`
- [Shop context check](https://github.com/anoch123/helapoz/blob/main/lib/services/require-shop-context.service.ts): `lib/services/require-shop-context.service.ts`
- [Shop sessions](https://github.com/anoch123/helapoz/blob/main/lib/services/shop-session.service.ts): `lib/services/shop-session.service.ts`
- [Subscription access](https://github.com/anoch123/helapoz/blob/main/lib/services/subscription-access.service.ts): `lib/services/subscription-access.service.ts`
- [Permission checks](https://github.com/anoch123/helapoz/blob/main/lib/services/require-shop-permission.service.ts): `lib/services/require-shop-permission.service.ts`
- [Server client](https://github.com/anoch123/helapoz/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`
- [Admin client](https://github.com/anoch123/helapoz/blob/main/lib/supabase/admin.ts): `lib/supabase/admin.ts`

### Other components

- **Shop user**
- **Supabase**

## Connections

- Shop user → Sign-in page: opens (evidence: `app/page.tsx`)
- Sign-in page → Login form: renders (evidence: `app/page.tsx`)
- Login form → Login endpoint: submits credentials
- Login endpoint → Shop sessions: creates or revokes (evidence: `app/api/auth/login/route.ts`)
- Login endpoint → Subscription access: checks access (evidence: `app/api/auth/login/route.ts`)
- Login endpoint → Server client: authenticates with (evidence: `app/api/auth/login/route.ts`)
- Login endpoint → Admin client: queries shop (evidence: `app/api/auth/login/route.ts`)
- Dashboard overview → Shop user: shows overview
- Shop user → Brand page: opens
- Brand page → Brand management: renders (evidence: `app/(dashboard)/catalogue/manage-brands/page.tsx`)
- Brand management → Brand API: loads and updates
- Brand API → Brand service: delegates (evidence: `app/api/catalogue/brands/route.ts`)
- Brand API → Permission checks: checks permission (evidence: `app/api/catalogue/brands/route.ts`)
- Brand service → Admin client: queries catalogue (evidence: `lib/services/catalogue-brand.service.ts`)
- Category page → Category service: uses category API
- Shop user → Staff directory page: opens
- Staff directory page → Staff directory: renders (evidence: `app/(dashboard)/manage-staff/page.tsx`)
- Staff directory → Staff user hook: loads staff (evidence: `components/widgets/staff/staff-directory.tsx`)
- Staff directory → Shop users API: requests staff data
- Staff user hook → Shop users API: fetches staff
- Shop users API → Shop context check: requires context (evidence: `app/api/shop/users/route.ts`)
- Shop users API → Shop user service: lists or creates users (evidence: `app/api/shop/users/route.ts`)
- Shop user service → Admin client: queries user records (evidence: `lib/services/shop-user.service.ts`)
- Staff details → Shop context check: loads staff details
- Staff permissions → User permissions API: manages permissions
- User permissions API → Shop context check: requires context (evidence: `app/api/shop/users/[membershipId]/shop-user-permissions/route.ts`)
- Shop context check → Server client: verifies identity (evidence: `lib/services/require-shop-context.service.ts`)
- Shop context check → Shop sessions: validates session (evidence: `lib/services/require-shop-context.service.ts`)
- Shop context check → Subscription access: rechecks access (evidence: `lib/services/require-shop-context.service.ts`)
- Shop context check → Admin client: checks shop status (evidence: `lib/services/require-shop-context.service.ts`)
- Shop sessions → Admin client: reads and writes sessions (evidence: `lib/services/shop-session.service.ts`)
- Subscription access → Admin client: checks subscription (evidence: `lib/services/subscription-access.service.ts`)
- Brand service → Shop context check: requires shop scope (evidence: `lib/services/catalogue-brand.service.ts`)
- Category service → Admin client: queries categories (evidence: `lib/services/catalogue-category.service.ts`)
- Category service → Shop context check: requires shop scope (evidence: `lib/services/catalogue-category.service.ts`)
- Server client → Supabase: connects
- Admin client → Supabase: connects
