# rajesh-laptops/service architecture

> Architecture diagram of the GitHub repository rajesh-laptops/service, 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/rajesh-laptops/service
- Repository: https://github.com/rajesh-laptops/service

## Overview

Rajesh Laptop Repairs is a Firebase-backed repair-service platform: customers book and track repairs without accounts, while Admin, Staff, and Dealer portals manage operations and related workflows. The main path runs from public booking through server commands into the repair lifecycle and persisted records; notifications and scheduled work extend that path. The README supports broader portal capabilities, but several feature modules and backend subsystems were not sampled, so their internal links are omitted or documented at subsystem level.

Main entry points: [`packages/server/src/modules/services.ts`](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/modules/services.ts) (Repair lifecycle), [`apps/web/src/app/api/commands/[command]/route.ts`](https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/app/api/commands/%5Bcommand%5D/route.ts) (Command API), [`packages/server/src/firebase.ts`](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/firebase.ts) (Firebase services), [`functions/src/index.ts`](https://github.com/rajesh-laptops/service/blob/feature/full-platform/functions/src/index.ts) (Cloud Functions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer experience"]
  node_public["Public website<br/>[page.tsx]"]
  node_booking["Booking and tracking<br/>[forms.tsx]"]
  node_approval["Estimate approval"]
end

subgraph group_portals["Operational portals"]
  node_admin["Admin portal<br/>[operations.tsx]"]
  node_staff["Staff portal<br/>[portal.tsx]"]
  node_dealer["Dealer portal<br/>[portal.tsx]"]
  node_workspace["Repair workspace<br/>[job-workspace.tsx]"]
end

subgraph group_backend["Command backend"]
  node_commands["Command API<br/>[route.ts]"]
  node_service["Repair lifecycle<br/>[services.ts]"]
  node_bookings["Booking operations<br/>[bookings.ts]"]
  node_customers["Customer records<br/>[customers.ts]"]
  node_dealers["Dealer operations<br/>[dealers.ts]"]
  node_audit["Audit log<br/>[audit.ts]"]
  node_ids["ID allocation<br/>[ids.ts]"]
end

subgraph group_platform["Persistence and integrations"]
  node_firebase[("Firebase services<br/>[firebase.ts]")]
  node_uploads["Media uploads<br/>[route.ts]"]
  node_whatsapp["WhatsApp service<br/>[service.ts]"]
  node_reviews["Reviews service<br/>[service.ts]"]
end

subgraph group_async["Background services"]
  node_functions["Cloud Functions<br/>[index.ts]"]
  node_outbox["Notification outbox<br/>[outbox.ts]"]
  node_processor["Notification processor<br/>[processor.ts]"]
end

node_customer(("Customer"))

node_customer -->|"visits"| node_public
node_public -->|"books or tracks"| node_booking
node_customer -->|"reviews estimate"| node_approval
node_admin -.->|"submits operations"| node_commands
node_staff -.->|"updates jobs"| node_commands
node_dealer -.->|"manages submissions"| node_commands
node_commands -.->|"dispatches commands"| node_service
node_commands -.->|"dispatches commands"| node_bookings
node_workspace -.->|"works on jobs"| node_service
node_service -->|"reads and writes"| node_firebase
node_service -->|"resolves customer"| node_customers
node_service -->|"reserves identifiers"| node_ids
node_service -->|"records changes"| node_audit
node_customers -->|"reads and writes"| node_firebase
node_dealers -->|"reads and writes"| node_firebase
node_dealers -->|"references services"| node_service
node_uploads -->|"authorizes caller"| node_firebase
node_functions -->|"dispatches jobs"| node_processor
node_functions -->|"handles webhook"| node_whatsapp
node_functions -.->|"sweeps notifications"| node_outbox
node_reviews -->|"reads and writes"| node_firebase
node_functions -.->|"schedules review sync"| node_reviews

click node_public "https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/app/(public)/page.tsx"
click node_booking "https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/public/forms.tsx"
click node_approval "https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/public/estimate-approval.tsx"
click node_admin "https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/admin/operations.tsx"
click node_staff "https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/staff/portal.tsx"
click node_dealer "https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/dealer/portal.tsx"
click node_workspace "https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/services/job-workspace.tsx"
click node_commands "https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/app/api/commands/%5Bcommand%5D/route.ts"
click node_service "https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/modules/services.ts"
click node_bookings "https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/modules/bookings.ts"
click node_customers "https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/modules/customers.ts"
click node_dealers "https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/modules/dealers.ts"
click node_audit "https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/audit.ts"
click node_ids "https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/ids.ts"
click node_firebase "https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/firebase.ts"
click node_uploads "https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/app/api/uploads/route.ts"
click node_whatsapp "https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/whatsapp/service.ts"
click node_reviews "https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/reviews/service.ts"
click node_functions "https://github.com/rajesh-laptops/service/blob/feature/full-platform/functions/src/index.ts"
click node_outbox "https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/notifications/outbox.ts"
click node_processor "https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/notifications/processor.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_public,node_booking,node_approval toneBlue
class node_admin,node_staff,node_dealer,node_workspace toneAmber
class node_commands,node_service,node_bookings,node_customers,node_dealers,node_audit,node_ids toneMint
class node_firebase,node_uploads,node_whatsapp,node_reviews toneRose
class node_functions,node_outbox,node_processor,node_customer toneIndigo
```

## Components

### Customer experience

- [Public website](https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/app/(public)/page.tsx): `apps/web/src/app/(public)/page.tsx`
- [Booking and tracking](https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/public/forms.tsx): `apps/web/src/features/public/forms.tsx`
- [Estimate approval](https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/public/estimate-approval.tsx): `apps/web/src/features/public/estimate-approval.tsx`

### Operational portals

- [Admin portal](https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/admin/operations.tsx): `apps/web/src/features/admin/operations.tsx`
- [Staff portal](https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/staff/portal.tsx): `apps/web/src/features/staff/portal.tsx`
- [Dealer portal](https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/dealer/portal.tsx): `apps/web/src/features/dealer/portal.tsx`
- [Repair workspace](https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/features/services/job-workspace.tsx): `apps/web/src/features/services/job-workspace.tsx`

### Command backend

- [Command API](https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/app/api/commands/%5Bcommand%5D/route.ts): `apps/web/src/app/api/commands/[command]/route.ts`
- [Repair lifecycle](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/modules/services.ts): `packages/server/src/modules/services.ts`
- [Booking operations](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/modules/bookings.ts): `packages/server/src/modules/bookings.ts`
- [Customer records](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/modules/customers.ts): `packages/server/src/modules/customers.ts`
- [Dealer operations](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/modules/dealers.ts): `packages/server/src/modules/dealers.ts`
- [Audit log](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/audit.ts): `packages/server/src/audit.ts`
- [ID allocation](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/ids.ts): `packages/server/src/ids.ts`

### Persistence and integrations

- [Firebase services](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/firebase.ts): `packages/server/src/firebase.ts`
- [Media uploads](https://github.com/rajesh-laptops/service/blob/feature/full-platform/apps/web/src/app/api/uploads/route.ts): `apps/web/src/app/api/uploads/route.ts`
- [WhatsApp service](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/whatsapp/service.ts): `packages/server/src/whatsapp/service.ts`
- [Reviews service](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/reviews/service.ts): `packages/server/src/reviews/service.ts`

### Background services

- [Cloud Functions](https://github.com/rajesh-laptops/service/blob/feature/full-platform/functions/src/index.ts): `functions/src/index.ts`
- [Notification outbox](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/notifications/outbox.ts): `packages/server/src/notifications/outbox.ts`
- [Notification processor](https://github.com/rajesh-laptops/service/blob/feature/full-platform/packages/server/src/notifications/processor.ts): `packages/server/src/notifications/processor.ts`

### Other components

- **Customer**

## Connections

- Customer → Public website: visits
- Public website → Booking and tracking: books or tracks
- Customer → Estimate approval: reviews estimate
- Admin portal → Command API: submits operations
- Staff portal → Command API: updates jobs
- Dealer portal → Command API: manages submissions
- Command API → Repair lifecycle: dispatches commands
- Command API → Booking operations: dispatches commands
- Repair workspace → Repair lifecycle: works on jobs
- Repair lifecycle → Firebase services: reads and writes (evidence: `packages/server/src/modules/services.ts`)
- Repair lifecycle → Customer records: resolves customer (evidence: `packages/server/src/modules/services.ts`)
- Repair lifecycle → ID allocation: reserves identifiers (evidence: `packages/server/src/modules/services.ts`)
- Repair lifecycle → Audit log: records changes (evidence: `packages/server/src/modules/services.ts`)
- Customer records → Firebase services: reads and writes (evidence: `packages/server/src/modules/customers.ts`)
- Dealer operations → Firebase services: reads and writes (evidence: `packages/server/src/modules/dealers.ts`)
- Dealer operations → Repair lifecycle: references services (evidence: `packages/server/src/modules/dealers.ts`)
- Media uploads → Firebase services: authorizes caller (evidence: `apps/web/src/app/api/uploads/route.ts`)
- Cloud Functions → Notification processor: dispatches jobs (evidence: `functions/src/index.ts`)
- Cloud Functions → WhatsApp service: handles webhook (evidence: `functions/src/index.ts`)
- Cloud Functions → Notification outbox: sweeps notifications
- Reviews service → Firebase services: reads and writes (evidence: `packages/server/src/reviews/service.ts`)
- Cloud Functions → Reviews service: schedules review sync
