# abdullah2036/hayyak architecture

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

- Interactive diagram: https://gitdiagram.com/abdullah2036/hayyak
- Repository: https://github.com/abdullah2036/hayyak

## Overview

Hayyak is an Arabic, RTL animated-invitation service. Workspace users create invitations, manage guest lists and sending, then track RSVP and code/QR attendance, issue certificates, and view reports; Studio staff handle orders, credit, requests, and design administration. Next.js routes select screens and load server data, while the API router dispatches business operations to services backed by PostgreSQL. The graph preserves documented product branches; some links are omitted because the relevant route or service implementation was not excerpted.

Main entry points: [`src/server/api/routes.ts`](https://github.com/abdullah2036/hayyak/blob/main/src/server/api/routes.ts) (API routes), [`src/app`](https://github.com/abdullah2036/hayyak/tree/main/src/app) (Page routes), [`src/server/services/screens.ts`](https://github.com/abdullah2036/hayyak/blob/main/src/server/services/screens.ts) (Screen data), [`src/server/services/invitations.ts`](https://github.com/abdullah2036/hayyak/blob/main/src/server/services/invitations.ts) (Invitation operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_web_routes["Page routes"]
  node_screen_dispatch["Screen dispatch<br/>[index.jsx]"]
  node_screen_state["Screen behavior"]
  node_screen_views["Screen views"]
  node_browser_runtime["Browser runtime"]
end

subgraph group_workspace["Workspace operations"]
  node_invitation_ops["Invitation operations<br/>[invitations.ts]"]
  node_credit["Credit and orders<br/>[credit.ts]"]
  node_asset_ops["Invitation assets<br/>[assets.ts]"]
  node_xlsx_helpers["Spreadsheet tools<br/>[xlsx.ts]"]
end

subgraph group_guest["Guest journey"]
  node_guest_ops["Guest registration<br/>[guest.ts]"]
  node_attendance_ops["Attendance check-in<br/>[attendance.ts]"]
  node_certificate["Certificates<br/>[page.tsx]"]
end

subgraph group_studio["Studio administration"]
  node_studio_ops["Studio operations<br/>[studio.ts]"]
end

subgraph group_platform["Server platform"]
  node_api_routes["API routes<br/>[routes.ts]"]
  node_api_router["API router<br/>[router.ts]"]
  node_page_loader["Page data loader<br/>[page.ts]"]
  node_screen_data["Screen data<br/>[screens.ts]"]
  node_scheduler["Scheduled work<br/>[scheduler.ts]"]
  node_auth_ops["Authentication<br/>[auth.ts]"]
  node_session_security["Sessions and access<br/>[session.ts]"]
  node_email_queue["Email queue<br/>[mail.ts]"]
  node_database[("PostgreSQL<br/>[index.ts]")]
  node_shared_rules["Shared rules<br/>[constants.ts]"]
  node_date_helpers["Date helpers<br/>[dates.ts]"]
end

node_workspace_user(("Workspace user"))
node_guest_user(("Guest"))
node_studio_user(("Studio staff"))
node_email_service["SMTP or Resend"]

node_workspace_user -->|"opens workspace"| node_web_routes
node_guest_user -->|"opens guest pages"| node_web_routes
node_studio_user -->|"opens Studio"| node_web_routes
node_web_routes -->|"selects screen"| node_screen_dispatch
node_web_routes -->|"loads page data"| node_page_loader
node_screen_dispatch -->|"loads screen"| node_screen_state
node_screen_state -->|"renders view"| node_screen_views
node_screen_state -->|"uses shared runtime"| node_browser_runtime
node_screen_state -.->|"calls API"| node_api_routes
node_api_routes -->|"registers handlers"| node_api_router
node_web_routes -->|"dispatches API"| node_api_router
node_api_router -->|"checks access"| node_session_security
node_api_routes -->|"invokes operations"| node_invitation_ops
node_api_routes -->|"invokes operations"| node_attendance_ops
node_api_routes -->|"invokes operations"| node_guest_ops
node_api_routes -->|"invokes operations"| node_studio_ops
node_api_routes -->|"invokes operations"| node_credit
node_api_routes -->|"invokes operations"| node_auth_ops
node_page_loader -->|"checks session"| node_session_security
node_page_loader -->|"loads data"| node_screen_data
node_screen_data -->|"reads balance"| node_credit
node_screen_data -->|"reads invitation data"| node_invitation_ops
node_screen_data -->|"reads service list"| node_studio_ops
node_guest_ops -->|"uses attendance"| node_attendance_ops
node_guest_ops -->|"uses invitation data"| node_invitation_ops
node_studio_ops -->|"uses credit"| node_credit
node_studio_ops -->|"uses invitation data"| node_invitation_ops
node_web_routes -->|"serves certificate code"| node_certificate
node_invitation_ops -.->|"uses invitation assets"| node_asset_ops
node_scheduler -.->|"flushes queued mail"| node_email_queue
node_email_queue -->|"delivers mail"| node_email_service
node_auth_ops -.->|"sends sign-in mail"| node_email_queue
node_session_security -->|"reads and writes sessions"| node_database
node_api_router -->|"uses database"| node_database
node_api_routes -->|"reads and writes records"| node_database
node_screen_data -->|"loads screen records"| node_database
node_screen_data -->|"formats dates"| node_date_helpers
node_invitation_ops -.->|"uses product rules"| node_shared_rules
node_attendance_ops -->|"uses product rules"| node_shared_rules
node_screen_state -->|"imports spreadsheet data"| node_xlsx_helpers

click node_web_routes "https://github.com/abdullah2036/hayyak/tree/main/src/app"
click node_screen_dispatch "https://github.com/abdullah2036/hayyak/blob/main/src/screens/index.jsx"
click node_screen_state "https://github.com/abdullah2036/hayyak/tree/main/src/screens"
click node_screen_views "https://github.com/abdullah2036/hayyak/tree/main/src/views"
click node_browser_runtime "https://github.com/abdullah2036/hayyak/tree/main/src/ui"
click node_api_routes "https://github.com/abdullah2036/hayyak/blob/main/src/server/api/routes.ts"
click node_api_router "https://github.com/abdullah2036/hayyak/blob/main/src/server/api/router.ts"
click node_page_loader "https://github.com/abdullah2036/hayyak/blob/main/src/server/page.ts"
click node_screen_data "https://github.com/abdullah2036/hayyak/blob/main/src/server/services/screens.ts"
click node_invitation_ops "https://github.com/abdullah2036/hayyak/blob/main/src/server/services/invitations.ts"
click node_guest_ops "https://github.com/abdullah2036/hayyak/blob/main/src/server/services/guest.ts"
click node_attendance_ops "https://github.com/abdullah2036/hayyak/blob/main/src/server/services/attendance.ts"
click node_certificate "https://github.com/abdullah2036/hayyak/blob/main/src/app/c/%5Bcode%5D/page.tsx"
click node_credit "https://github.com/abdullah2036/hayyak/blob/main/src/server/services/credit.ts"
click node_studio_ops "https://github.com/abdullah2036/hayyak/blob/main/src/server/services/studio.ts"
click node_asset_ops "https://github.com/abdullah2036/hayyak/blob/main/src/server/services/assets.ts"
click node_scheduler "https://github.com/abdullah2036/hayyak/blob/main/src/server/services/scheduler.ts"
click node_auth_ops "https://github.com/abdullah2036/hayyak/blob/main/src/server/services/auth.ts"
click node_session_security "https://github.com/abdullah2036/hayyak/blob/main/src/server/lib/session.ts"
click node_email_queue "https://github.com/abdullah2036/hayyak/blob/main/src/server/lib/mail.ts"
click node_database "https://github.com/abdullah2036/hayyak/blob/main/src/server/db/index.ts"
click node_shared_rules "https://github.com/abdullah2036/hayyak/blob/main/src/lib/constants.ts"
click node_date_helpers "https://github.com/abdullah2036/hayyak/blob/main/src/lib/dates.ts"
click node_xlsx_helpers "https://github.com/abdullah2036/hayyak/blob/main/src/lib/xlsx.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_web_routes,node_screen_dispatch,node_screen_state,node_screen_views,node_browser_runtime,node_workspace_user toneBlue
class node_invitation_ops,node_credit,node_asset_ops,node_xlsx_helpers toneAmber
class node_guest_ops,node_attendance_ops,node_certificate toneMint
class node_studio_ops toneRose
class node_api_routes,node_api_router,node_page_loader,node_screen_data,node_scheduler,node_auth_ops,node_session_security,node_email_queue,node_database,node_shared_rules,node_date_helpers,node_guest_user,node_studio_user,node_email_service toneIndigo
```

## Components

### Web experience

- [Page routes](https://github.com/abdullah2036/hayyak/tree/main/src/app): `src/app`
- [Screen dispatch](https://github.com/abdullah2036/hayyak/blob/main/src/screens/index.jsx): `src/screens/index.jsx`
- [Screen behavior](https://github.com/abdullah2036/hayyak/tree/main/src/screens): `src/screens`
- [Screen views](https://github.com/abdullah2036/hayyak/tree/main/src/views): `src/views`
- [Browser runtime](https://github.com/abdullah2036/hayyak/tree/main/src/ui): `src/ui`

### Workspace operations

- [Invitation operations](https://github.com/abdullah2036/hayyak/blob/main/src/server/services/invitations.ts): `src/server/services/invitations.ts`
- [Credit and orders](https://github.com/abdullah2036/hayyak/blob/main/src/server/services/credit.ts): `src/server/services/credit.ts`
- [Invitation assets](https://github.com/abdullah2036/hayyak/blob/main/src/server/services/assets.ts): `src/server/services/assets.ts`
- [Spreadsheet tools](https://github.com/abdullah2036/hayyak/blob/main/src/lib/xlsx.ts): `src/lib/xlsx.ts`

### Guest journey

- [Guest registration](https://github.com/abdullah2036/hayyak/blob/main/src/server/services/guest.ts): `src/server/services/guest.ts`
- [Attendance check-in](https://github.com/abdullah2036/hayyak/blob/main/src/server/services/attendance.ts): `src/server/services/attendance.ts`
- [Certificates](https://github.com/abdullah2036/hayyak/blob/main/src/app/c/%5Bcode%5D/page.tsx): `src/app/c/[code]/page.tsx`

### Studio administration

- [Studio operations](https://github.com/abdullah2036/hayyak/blob/main/src/server/services/studio.ts): `src/server/services/studio.ts`

### Server platform

- [API routes](https://github.com/abdullah2036/hayyak/blob/main/src/server/api/routes.ts): `src/server/api/routes.ts`
- [API router](https://github.com/abdullah2036/hayyak/blob/main/src/server/api/router.ts): `src/server/api/router.ts`
- [Page data loader](https://github.com/abdullah2036/hayyak/blob/main/src/server/page.ts): `src/server/page.ts`
- [Screen data](https://github.com/abdullah2036/hayyak/blob/main/src/server/services/screens.ts): `src/server/services/screens.ts`
- [Scheduled work](https://github.com/abdullah2036/hayyak/blob/main/src/server/services/scheduler.ts): `src/server/services/scheduler.ts`
- [Authentication](https://github.com/abdullah2036/hayyak/blob/main/src/server/services/auth.ts): `src/server/services/auth.ts`
- [Sessions and access](https://github.com/abdullah2036/hayyak/blob/main/src/server/lib/session.ts): `src/server/lib/session.ts`
- [Email queue](https://github.com/abdullah2036/hayyak/blob/main/src/server/lib/mail.ts): `src/server/lib/mail.ts`
- [PostgreSQL](https://github.com/abdullah2036/hayyak/blob/main/src/server/db/index.ts): `src/server/db/index.ts`
- [Shared rules](https://github.com/abdullah2036/hayyak/blob/main/src/lib/constants.ts): `src/lib/constants.ts`
- [Date helpers](https://github.com/abdullah2036/hayyak/blob/main/src/lib/dates.ts): `src/lib/dates.ts`

### Other components

- **Workspace user**
- **Guest**
- **Studio staff**
- **SMTP or Resend**

## Connections

- Workspace user → Page routes: opens workspace
- Guest → Page routes: opens guest pages
- Studio staff → Page routes: opens Studio
- Page routes → Screen dispatch: selects screen (evidence: `src/app/app/page.tsx`)
- Page routes → Page data loader: loads page data (evidence: `src/app/app/page.tsx`)
- Screen dispatch → Screen behavior: loads screen (evidence: `src/screens/index.jsx`)
- Screen behavior → Screen views: renders view (evidence: `src/screens/Create.jsx`)
- Screen behavior → Browser runtime: uses shared runtime (evidence: `src/screens/Admin.jsx`)
- Screen behavior → API routes: calls API
- API routes → API router: registers handlers (evidence: `src/server/api/routes.ts`)
- Page routes → API router: dispatches API (evidence: `src/app/api/[...path]/route.ts`)
- API router → Sessions and access: checks access (evidence: `src/server/api/router.ts`)
- API routes → Invitation operations: invokes operations (evidence: `src/server/api/routes.ts`)
- API routes → Attendance check-in: invokes operations (evidence: `src/server/api/routes.ts`)
- API routes → Guest registration: invokes operations (evidence: `src/server/api/routes.ts`)
- API routes → Studio operations: invokes operations (evidence: `src/server/api/routes.ts`)
- API routes → Credit and orders: invokes operations (evidence: `src/server/api/routes.ts`)
- API routes → Authentication: invokes operations (evidence: `src/server/api/routes.ts`)
- Page data loader → Sessions and access: checks session (evidence: `src/server/page.ts`)
- Page data loader → Screen data: loads data (evidence: `src/server/page.ts`)
- Screen data → Credit and orders: reads balance (evidence: `src/server/services/screens.ts`)
- Screen data → Invitation operations: reads invitation data (evidence: `src/server/services/screens.ts`)
- Screen data → Studio operations: reads service list (evidence: `src/server/services/screens.ts`)
- Guest registration → Attendance check-in: uses attendance (evidence: `src/server/services/guest.ts`)
- Guest registration → Invitation operations: uses invitation data (evidence: `src/server/services/guest.ts`)
- Studio operations → Credit and orders: uses credit (evidence: `src/server/services/studio.ts`)
- Studio operations → Invitation operations: uses invitation data (evidence: `src/server/services/studio.ts`)
- Page routes → Certificates: serves certificate code
- Invitation operations → Invitation assets: uses invitation assets
- Scheduled work → Email queue: flushes queued mail
- Email queue → SMTP or Resend: delivers mail (evidence: `src/server/lib/mail.ts`)
- Authentication → Email queue: sends sign-in mail (evidence: `src/server/services/auth.ts`)
- Sessions and access → PostgreSQL: reads and writes sessions (evidence: `src/server/lib/session.ts`)
- API router → PostgreSQL: uses database (evidence: `src/server/api/router.ts`)
- API routes → PostgreSQL: reads and writes records (evidence: `src/server/api/routes.ts`)
- Screen data → PostgreSQL: loads screen records (evidence: `src/server/services/screens.ts`)
- Screen data → Date helpers: formats dates (evidence: `src/server/services/screens.ts`)
- Invitation operations → Shared rules: uses product rules
- Attendance check-in → Shared rules: uses product rules (evidence: `src/server/services/attendance.ts`)
- Screen behavior → Spreadsheet tools: imports spreadsheet data (evidence: `src/screens/Create.jsx`)
