# aforap/bookme architecture

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

- Interactive diagram: https://gitdiagram.com/aforap/bookme
- Repository: https://github.com/aforap/bookme

## Overview

This is a booking platform for service providers: providers manage their profile, services, availability, and bookings; customers discover a provider, check slots, verify email, book, and—when required—pay. The backend also supports provider authentication, calendar/email integrations, wallet payouts, and platform administration. The principal public-booking flow is visible in the controller excerpt; several management routes and frontend API calls are only identified by the source index, so uncertain frontend-to-backend links are omitted or marked unverified.

Main entry points: [`backend/controllers/publicController.js`](https://github.com/aforap/bookme/blob/main/backend/controllers/publicController.js) (Booking orchestration), [`frontend/src/App.jsx`](https://github.com/aforap/bookme/blob/main/frontend/src/App.jsx) (App routes), [`backend/controllers/adminController.js`](https://github.com/aforap/bookme/blob/main/backend/controllers/adminController.js) (Admin operations), [`backend/server.js`](https://github.com/aforap/bookme/blob/main/backend/server.js) (API server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Provider interface"]
  node_app["App routes<br/>[App.jsx]"]
  node_service_ui["Service editor<br/>[ServicePage.jsx]"]
  node_provider_ui["Provider workspace<br/>[DashboardPage.jsx]"]
  node_bookings_ui["Bookings view<br/>[BookingsPage.jsx]"]
  node_profile_ui["Profile settings<br/>[ProfilePage.jsx]"]
  node_availability_ui["Availability editor"]
end

subgraph group_identity["Accounts and management"]
  node_auth["Account workflows<br/>[authController.js]"]
  node_auth_routes["Auth routes<br/>[authRoutes.js]"]
  node_user_store[("Provider accounts<br/>[User.js]")]
  node_admin_ops["Admin operations<br/>[adminController.js]"]
  node_admin_routes["Admin routes<br/>[adminRoutes.js]"]
end

subgraph group_booking["Booking and fulfillment"]
  node_public_routes["Public booking routes<br/>[publicRoutes.js]"]
  node_public_booking["Booking orchestration"]
  node_slot_generation["Slot generation<br/>[slotGenerator.js]"]
  node_booking_store[("Bookings<br/>[Booking.js]")]
  node_service_store[("Service catalog<br/>[Service.js]")]
  node_email_otp["Email verification<br/>[emailOtp.js]"]
  node_notifications["Booking notifications"]
  node_calendar["Calendar integration<br/>[googleCalendar.js]"]
end

subgraph group_finance["Payments and payouts"]
  node_payment_ops["Payment handling"]
  node_wallet_ops["Wallet ledger<br/>[wallet.js]"]
  node_wallet_store[("Wallet transactions")]
  node_withdrawals[("Withdrawals<br/>[Withdrawal.js]")]
end

node_provider(("Provider"))
node_customer(("Customer"))
node_admin(("Platform admin"))
node_server["API server<br/>[server.js]"]

node_provider -->|"uses"| node_app
node_app -->|"routes to"| node_service_ui
node_app -->|"routes to"| node_provider_ui
node_app -->|"routes to"| node_bookings_ui
node_app -->|"routes to"| node_profile_ui
node_app -->|"routes to"| node_availability_ui
node_service_ui -.->|"manages via API"| node_service_store
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_admin_routes
node_server -->|"mounts"| node_public_routes
node_auth_routes -->|"dispatches"| node_auth
node_auth -->|"reads and writes"| node_user_store
node_auth -->|"verifies email"| node_email_otp
node_admin_routes -->|"dispatches"| node_admin_ops
node_admin_ops -->|"queries"| node_user_store
node_admin_ops -->|"aggregates"| node_booking_store
node_admin_ops -->|"aggregates"| node_wallet_store
node_admin_ops -->|"updates"| node_withdrawals
node_customer -->|"requests booking"| node_public_routes
node_public_routes -->|"dispatches"| node_public_booking
node_public_booking -->|"loads services"| node_service_store
node_public_booking -->|"loads provider"| node_user_store
node_public_booking -->|"generates slots"| node_slot_generation
node_public_booking -->|"verifies email"| node_email_otp
node_public_booking -->|"creates booking"| node_booking_store
node_public_booking -->|"creates event"| node_calendar
node_public_booking -->|"sends notice"| node_notifications
node_public_booking -->|"records payout"| node_wallet_ops
node_wallet_ops -->|"writes ledger"| node_wallet_store
node_public_booking -.->|"payment workflow"| node_payment_ops

click node_app "https://github.com/aforap/bookme/blob/main/frontend/src/App.jsx"
click node_service_ui "https://github.com/aforap/bookme/blob/main/frontend/src/pages/ServicePage.jsx"
click node_provider_ui "https://github.com/aforap/bookme/blob/main/frontend/src/pages/DashboardPage.jsx"
click node_bookings_ui "https://github.com/aforap/bookme/blob/main/frontend/src/pages/BookingsPage.jsx"
click node_profile_ui "https://github.com/aforap/bookme/blob/main/frontend/src/pages/ProfilePage.jsx"
click node_availability_ui "https://github.com/aforap/bookme/blob/main/frontend/src/pages/AvailabilityPage.jsx"
click node_auth "https://github.com/aforap/bookme/blob/main/backend/controllers/authController.js"
click node_auth_routes "https://github.com/aforap/bookme/blob/main/backend/routes/authRoutes.js"
click node_user_store "https://github.com/aforap/bookme/blob/main/backend/models/User.js"
click node_admin_ops "https://github.com/aforap/bookme/blob/main/backend/controllers/adminController.js"
click node_admin_routes "https://github.com/aforap/bookme/blob/main/backend/routes/adminRoutes.js"
click node_public_routes "https://github.com/aforap/bookme/blob/main/backend/routes/publicRoutes.js"
click node_public_booking "https://github.com/aforap/bookme/blob/main/backend/controllers/publicController.js"
click node_slot_generation "https://github.com/aforap/bookme/blob/main/backend/utils/slotGenerator.js"
click node_booking_store "https://github.com/aforap/bookme/blob/main/backend/models/Booking.js"
click node_service_store "https://github.com/aforap/bookme/blob/main/backend/models/Service.js"
click node_email_otp "https://github.com/aforap/bookme/blob/main/backend/utils/emailOtp.js"
click node_notifications "https://github.com/aforap/bookme/blob/main/backend/utils/bookingNotifications.js"
click node_calendar "https://github.com/aforap/bookme/blob/main/backend/utils/googleCalendar.js"
click node_payment_ops "https://github.com/aforap/bookme/blob/main/backend/controllers/paymentController.js"
click node_wallet_ops "https://github.com/aforap/bookme/blob/main/backend/utils/wallet.js"
click node_wallet_store "https://github.com/aforap/bookme/blob/main/backend/models/WalletTransaction.js"
click node_withdrawals "https://github.com/aforap/bookme/blob/main/backend/models/Withdrawal.js"
click node_server "https://github.com/aforap/bookme/blob/main/backend/server.js"

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_app,node_service_ui,node_provider_ui,node_bookings_ui,node_profile_ui,node_availability_ui toneBlue
class node_auth,node_auth_routes,node_user_store,node_admin_ops,node_admin_routes toneAmber
class node_public_routes,node_public_booking,node_slot_generation,node_booking_store,node_service_store,node_email_otp,node_notifications,node_calendar,node_server toneMint
class node_payment_ops,node_wallet_ops,node_wallet_store,node_withdrawals toneRose
class node_provider,node_customer,node_admin toneIndigo
```

## Components

### Provider interface

- [App routes](https://github.com/aforap/bookme/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Service editor](https://github.com/aforap/bookme/blob/main/frontend/src/pages/ServicePage.jsx): `frontend/src/pages/ServicePage.jsx`
- [Provider workspace](https://github.com/aforap/bookme/blob/main/frontend/src/pages/DashboardPage.jsx): `frontend/src/pages/DashboardPage.jsx`
- [Bookings view](https://github.com/aforap/bookme/blob/main/frontend/src/pages/BookingsPage.jsx): `frontend/src/pages/BookingsPage.jsx`
- [Profile settings](https://github.com/aforap/bookme/blob/main/frontend/src/pages/ProfilePage.jsx): `frontend/src/pages/ProfilePage.jsx`
- [Availability editor](https://github.com/aforap/bookme/blob/main/frontend/src/pages/AvailabilityPage.jsx): `frontend/src/pages/AvailabilityPage.jsx`

### Accounts and management

- [Account workflows](https://github.com/aforap/bookme/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Auth routes](https://github.com/aforap/bookme/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Provider accounts](https://github.com/aforap/bookme/blob/main/backend/models/User.js): `backend/models/User.js`
- [Admin operations](https://github.com/aforap/bookme/blob/main/backend/controllers/adminController.js): `backend/controllers/adminController.js`
- [Admin routes](https://github.com/aforap/bookme/blob/main/backend/routes/adminRoutes.js): `backend/routes/adminRoutes.js`

### Booking and fulfillment

- [Public booking routes](https://github.com/aforap/bookme/blob/main/backend/routes/publicRoutes.js): `backend/routes/publicRoutes.js`
- [Booking orchestration](https://github.com/aforap/bookme/blob/main/backend/controllers/publicController.js): `backend/controllers/publicController.js`
- [Slot generation](https://github.com/aforap/bookme/blob/main/backend/utils/slotGenerator.js): `backend/utils/slotGenerator.js`
- [Bookings](https://github.com/aforap/bookme/blob/main/backend/models/Booking.js): `backend/models/Booking.js`
- [Service catalog](https://github.com/aforap/bookme/blob/main/backend/models/Service.js): `backend/models/Service.js`
- [Email verification](https://github.com/aforap/bookme/blob/main/backend/utils/emailOtp.js): `backend/utils/emailOtp.js`
- [Booking notifications](https://github.com/aforap/bookme/blob/main/backend/utils/bookingNotifications.js): `backend/utils/bookingNotifications.js`
- [Calendar integration](https://github.com/aforap/bookme/blob/main/backend/utils/googleCalendar.js): `backend/utils/googleCalendar.js`

### Payments and payouts

- [Payment handling](https://github.com/aforap/bookme/blob/main/backend/controllers/paymentController.js): `backend/controllers/paymentController.js`
- [Wallet ledger](https://github.com/aforap/bookme/blob/main/backend/utils/wallet.js): `backend/utils/wallet.js`
- [Wallet transactions](https://github.com/aforap/bookme/blob/main/backend/models/WalletTransaction.js): `backend/models/WalletTransaction.js`
- [Withdrawals](https://github.com/aforap/bookme/blob/main/backend/models/Withdrawal.js): `backend/models/Withdrawal.js`

### Other components

- **Provider**
- **Customer**
- **Platform admin**
- [API server](https://github.com/aforap/bookme/blob/main/backend/server.js): `backend/server.js`

## Connections

- Provider → App routes: uses (evidence: `frontend/src/App.jsx`)
- App routes → Service editor: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Provider workspace: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Bookings view: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Profile settings: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Availability editor: routes to (evidence: `frontend/src/App.jsx`)
- Service editor → Service catalog: manages via API
- API server → Auth routes: mounts (evidence: `backend/server.js`)
- API server → Admin routes: mounts (evidence: `backend/server.js`)
- API server → Public booking routes: mounts (evidence: `backend/server.js`)
- Auth routes → Account workflows: dispatches (evidence: `backend/routes/authRoutes.js`)
- Account workflows → Provider accounts: reads and writes (evidence: `backend/controllers/authController.js`)
- Account workflows → Email verification: verifies email (evidence: `backend/controllers/authController.js`)
- Admin routes → Admin operations: dispatches (evidence: `backend/routes/adminRoutes.js`)
- Admin operations → Provider accounts: queries (evidence: `backend/controllers/adminController.js`)
- Admin operations → Bookings: aggregates (evidence: `backend/controllers/adminController.js`)
- Admin operations → Wallet transactions: aggregates (evidence: `backend/controllers/adminController.js`)
- Admin operations → Withdrawals: updates (evidence: `backend/controllers/adminController.js`)
- Customer → Public booking routes: requests booking (evidence: `backend/routes/publicRoutes.js`)
- Public booking routes → Booking orchestration: dispatches (evidence: `backend/routes/publicRoutes.js`)
- Booking orchestration → Service catalog: loads services (evidence: `backend/controllers/publicController.js`)
- Booking orchestration → Provider accounts: loads provider (evidence: `backend/controllers/publicController.js`)
- Booking orchestration → Slot generation: generates slots (evidence: `backend/controllers/publicController.js`)
- Booking orchestration → Email verification: verifies email (evidence: `backend/controllers/publicController.js`)
- Booking orchestration → Bookings: creates booking (evidence: `backend/controllers/publicController.js`)
- Booking orchestration → Calendar integration: creates event (evidence: `backend/controllers/publicController.js`)
- Booking orchestration → Booking notifications: sends notice (evidence: `backend/controllers/publicController.js`)
- Booking orchestration → Wallet ledger: records payout (evidence: `backend/controllers/publicController.js`)
- Wallet ledger → Wallet transactions: writes ledger (evidence: `backend/utils/wallet.js`)
- Booking orchestration → Payment handling: payment workflow
