# alanmart0717/ezbook architecture

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

- Interactive diagram: https://gitdiagram.com/alanmart0717/ezbook
- Repository: https://github.com/alanmart0717/ezbook

## Overview

EZBook is a customer–provider appointment-booking platform. Customers browse services, choose an available date and time, and book; providers manage profiles, services, availability and blocked time, then review and respond to appointments. The backend exposes these workflows through Express routes and controller/service/model layers backed by PostgreSQL. The README documents rescheduling, booking history and dynamic scheduling; the tree shows related modules, but sampled code does not establish every route-to-controller connection. Messaging and notifications are represented as distinct capabilities; messaging storage shown in sampled code is in memory.

Main entry points: [`backend/src/app.js`](https://github.com/alanmart0717/ezbook/blob/main/backend/src/app.js) (Express API), [`ez-book/src/App.js`](https://github.com/alanmart0717/ezbook/blob/main/ez-book/src/App.js) (Booking interface), [`backend/src/controllers/service.controller.js`](https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/service.controller.js) (Service controller), [`backend/src/controllers/appointment.controller.js`](https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/appointment.controller.js) (Appointment controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_webapp["Booking interface<br/>[App.js]"]
  node_clientdash["Customer dashboard<br/>[ClientDashboard.js]"]
  node_providerdash["Provider dashboard"]
  node_webmessage["Messaging UI<br/>[MessagingUI.js]"]
end

subgraph group_api["API entry"]
  node_apiapp["Express API<br/>[app.js]"]
end

subgraph group_identity["Accounts"]
  node_authroutes["Auth routes<br/>[auth.routes.js]"]
  node_authcontroller["Auth controller<br/>[auth.controller.js]"]
  node_authservice["Auth service<br/>[auth.service.js]"]
  node_authmodel["User model<br/>[user.model.js]"]
  node_authmw["Authentication<br/>[auth.middleware.js]"]
end

subgraph group_catalog["Provider setup"]
  node_serviceroutes["Service routes<br/>[service.routes.js]"]
  node_servicecontroller["Service controller"]
  node_serviceservice["Service service<br/>[service.service.js]"]
  node_servicemodel["Service model<br/>[service.model.js]"]
  node_providercontroller["Provider controller"]
  node_providermodel["Provider model<br/>[provider.model.js]"]
  node_availabilityroutes["Availability routes"]
  node_availabilitycontroller["Availability controller"]
  node_availabilitymodel["Availability model"]
  node_blockedroutes["Blocked-time routes"]
  node_blockedcontroller["Blocked-time controller"]
  node_blockedmodel["Blocked-time model"]
end

subgraph group_booking["Scheduling"]
  node_approutes["Appointment routes"]
  node_appcontroller["Appointment controller"]
  node_appservice["Appointment service"]
  node_appmodel["Appointment model"]
  node_notificationroutes["Notification routes"]
  node_notificationcontroller["Notification controller"]
  node_notificationmodel["Notification model"]
  node_messageroutes["Message routes<br/>[Messages.routes.js]"]
  node_messagecontroller["Message controller"]
end

node_customer(("Customer"))
node_provider(("Provider"))
node_database[("PostgreSQL database")]

node_customer -->|"uses"| node_webapp
node_provider -->|"uses"| node_webapp
node_webapp -->|"requests API"| node_apiapp
node_webapp -->|"renders"| node_clientdash
node_webapp -->|"renders"| node_providerdash
node_apiapp -->|"mounts"| node_authroutes
node_apiapp -->|"mounts"| node_serviceroutes
node_apiapp -->|"mounts"| node_availabilityroutes
node_apiapp -->|"mounts"| node_blockedroutes
node_apiapp -->|"mounts"| node_approutes
node_apiapp -->|"mounts"| node_notificationroutes
node_apiapp -->|"mounts"| node_messageroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authcontroller -->|"calls"| node_authservice
node_authservice -->|"reads/writes"| node_authmodel
node_authroutes -->|"protects"| node_authmw
node_serviceroutes -->|"dispatches"| node_servicecontroller
node_serviceroutes -->|"protects"| node_authmw
node_servicecontroller -->|"calls"| node_serviceservice
node_servicecontroller -->|"reads/writes"| node_servicemodel
node_servicecontroller -->|"reads"| node_providermodel
node_servicecontroller -->|"updates bookings"| node_appmodel
node_availabilityroutes -->|"dispatches"| node_availabilitycontroller
node_blockedroutes -->|"dispatches"| node_blockedcontroller
node_approutes -->|"dispatches"| node_appcontroller
node_approutes -->|"protects"| node_authmw
node_appcontroller -->|"calls"| node_appservice
node_appcontroller -->|"reads/writes"| node_appmodel
node_appcontroller -->|"reads"| node_providermodel
node_appcontroller -->|"creates notices"| node_notificationmodel
node_notificationroutes -->|"dispatches"| node_notificationcontroller
node_messageroutes -->|"dispatches"| node_messagecontroller
node_webmessage -->|"shown by"| node_webapp
node_appservice -->|"persists bookings"| node_database
node_authmodel -->|"queries"| node_database
node_servicemodel -->|"queries"| node_database
node_providermodel -->|"queries"| node_database
node_appmodel -->|"queries"| node_database
node_availabilitycontroller -->|"reads/writes"| node_availabilitymodel
node_blockedcontroller -->|"reads/writes"| node_blockedmodel
node_notificationcontroller -->|"reads/writes"| node_notificationmodel

click node_webapp "https://github.com/alanmart0717/ezbook/blob/main/ez-book/src/App.js"
click node_clientdash "https://github.com/alanmart0717/ezbook/blob/main/ez-book/src/ClientDashboard.js"
click node_providerdash "https://github.com/alanmart0717/ezbook/blob/main/ez-book/src/ProviderDashboard.js"
click node_webmessage "https://github.com/alanmart0717/ezbook/blob/main/ez-book/src/MessagingUI.js"
click node_apiapp "https://github.com/alanmart0717/ezbook/blob/main/backend/src/app.js"
click node_authroutes "https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/auth.routes.js"
click node_authcontroller "https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/auth.controller.js"
click node_authservice "https://github.com/alanmart0717/ezbook/blob/main/backend/src/services/auth.service.js"
click node_authmodel "https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/user.model.js"
click node_authmw "https://github.com/alanmart0717/ezbook/blob/main/backend/src/middleware/auth.middleware.js"
click node_serviceroutes "https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/service.routes.js"
click node_servicecontroller "https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/service.controller.js"
click node_serviceservice "https://github.com/alanmart0717/ezbook/blob/main/backend/src/services/service.service.js"
click node_servicemodel "https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/service.model.js"
click node_providercontroller "https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/provider.controller.js"
click node_providermodel "https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/provider.model.js"
click node_availabilityroutes "https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/provider.availability.routes.js"
click node_availabilitycontroller "https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/availability.controller.js"
click node_availabilitymodel "https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/availability.model.js"
click node_blockedroutes "https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/provider.blockedTime.routes.js"
click node_blockedcontroller "https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/blockedTime.controller.js"
click node_blockedmodel "https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/blockedTime.model.js"
click node_approutes "https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/appointments.routes.js"
click node_appcontroller "https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/appointment.controller.js"
click node_appservice "https://github.com/alanmart0717/ezbook/blob/main/backend/src/services/appointment.service.js"
click node_appmodel "https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/appointment.model.js"
click node_notificationroutes "https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/notification.routes.js"
click node_notificationcontroller "https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/notification.controller.js"
click node_notificationmodel "https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/notification.model.js"
click node_messageroutes "https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/Messages.routes.js"
click node_messagecontroller "https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/message.controller.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_webapp,node_clientdash,node_providerdash,node_webmessage toneBlue
class node_apiapp,node_database toneAmber
class node_authroutes,node_authcontroller,node_authservice,node_authmodel,node_authmw toneMint
class node_serviceroutes,node_servicecontroller,node_serviceservice,node_servicemodel,node_providercontroller,node_providermodel,node_availabilityroutes,node_availabilitycontroller,node_availabilitymodel,node_blockedroutes,node_blockedcontroller,node_blockedmodel toneRose
class node_approutes,node_appcontroller,node_appservice,node_appmodel,node_notificationroutes,node_notificationcontroller,node_notificationmodel,node_messageroutes,node_messagecontroller,node_customer,node_provider toneIndigo
```

## Components

### Web client

- [Booking interface](https://github.com/alanmart0717/ezbook/blob/main/ez-book/src/App.js): `ez-book/src/App.js`
- [Customer dashboard](https://github.com/alanmart0717/ezbook/blob/main/ez-book/src/ClientDashboard.js): `ez-book/src/ClientDashboard.js`
- [Provider dashboard](https://github.com/alanmart0717/ezbook/blob/main/ez-book/src/ProviderDashboard.js): `ez-book/src/ProviderDashboard.js`
- [Messaging UI](https://github.com/alanmart0717/ezbook/blob/main/ez-book/src/MessagingUI.js): `ez-book/src/MessagingUI.js`

### API entry

- [Express API](https://github.com/alanmart0717/ezbook/blob/main/backend/src/app.js): `backend/src/app.js`

### Accounts

- [Auth routes](https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Auth controller](https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [Auth service](https://github.com/alanmart0717/ezbook/blob/main/backend/src/services/auth.service.js): `backend/src/services/auth.service.js`
- [User model](https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/user.model.js): `backend/src/models/user.model.js`
- [Authentication](https://github.com/alanmart0717/ezbook/blob/main/backend/src/middleware/auth.middleware.js): `backend/src/middleware/auth.middleware.js`

### Provider setup

- [Service routes](https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/service.routes.js): `backend/src/routes/service.routes.js`
- [Service controller](https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/service.controller.js): `backend/src/controllers/service.controller.js`
- [Service service](https://github.com/alanmart0717/ezbook/blob/main/backend/src/services/service.service.js): `backend/src/services/service.service.js`
- [Service model](https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/service.model.js): `backend/src/models/service.model.js`
- [Provider controller](https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/provider.controller.js): `backend/src/controllers/provider.controller.js`
- [Provider model](https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/provider.model.js): `backend/src/models/provider.model.js`
- [Availability routes](https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/provider.availability.routes.js): `backend/src/routes/provider.availability.routes.js`
- [Availability controller](https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/availability.controller.js): `backend/src/controllers/availability.controller.js`
- [Availability model](https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/availability.model.js): `backend/src/models/availability.model.js`
- [Blocked-time routes](https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/provider.blockedTime.routes.js): `backend/src/routes/provider.blockedTime.routes.js`
- [Blocked-time controller](https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/blockedTime.controller.js): `backend/src/controllers/blockedTime.controller.js`
- [Blocked-time model](https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/blockedTime.model.js): `backend/src/models/blockedTime.model.js`

### Scheduling

- [Appointment routes](https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/appointments.routes.js): `backend/src/routes/appointments.routes.js`
- [Appointment controller](https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/appointment.controller.js): `backend/src/controllers/appointment.controller.js`
- [Appointment service](https://github.com/alanmart0717/ezbook/blob/main/backend/src/services/appointment.service.js): `backend/src/services/appointment.service.js`
- [Appointment model](https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/appointment.model.js): `backend/src/models/appointment.model.js`
- [Notification routes](https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/notification.routes.js): `backend/src/routes/notification.routes.js`
- [Notification controller](https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/notification.controller.js): `backend/src/controllers/notification.controller.js`
- [Notification model](https://github.com/alanmart0717/ezbook/blob/main/backend/src/models/notification.model.js): `backend/src/models/notification.model.js`
- [Message routes](https://github.com/alanmart0717/ezbook/blob/main/backend/src/routes/Messages.routes.js): `backend/src/routes/Messages.routes.js`
- [Message controller](https://github.com/alanmart0717/ezbook/blob/main/backend/src/controllers/message.controller.js): `backend/src/controllers/message.controller.js`

### Other components

- **Customer**
- **Provider**
- **PostgreSQL database**

## Connections

- Customer → Booking interface: uses
- Provider → Booking interface: uses
- Booking interface → Express API: requests API
- Booking interface → Customer dashboard: renders
- Booking interface → Provider dashboard: renders
- Express API → Auth routes: mounts
- Express API → Service routes: mounts
- Express API → Availability routes: mounts
- Express API → Blocked-time routes: mounts
- Express API → Appointment routes: mounts
- Express API → Notification routes: mounts
- Express API → Message routes: mounts
- Auth routes → Auth controller: dispatches
- Auth controller → Auth service: calls
- Auth service → User model: reads/writes
- Auth routes → Authentication: protects
- Service routes → Service controller: dispatches
- Service routes → Authentication: protects
- Service controller → Service service: calls
- Service controller → Service model: reads/writes
- Service controller → Provider model: reads
- Service controller → Appointment model: updates bookings
- Availability routes → Availability controller: dispatches
- Blocked-time routes → Blocked-time controller: dispatches
- Appointment routes → Appointment controller: dispatches
- Appointment routes → Authentication: protects
- Appointment controller → Appointment service: calls
- Appointment controller → Appointment model: reads/writes
- Appointment controller → Provider model: reads
- Appointment controller → Notification model: creates notices
- Notification routes → Notification controller: dispatches
- Message routes → Message controller: dispatches
- Messaging UI → Booking interface: shown by
- Appointment service → PostgreSQL database: persists bookings
- User model → PostgreSQL database: queries
- Service model → PostgreSQL database: queries
- Provider model → PostgreSQL database: queries
- Appointment model → PostgreSQL database: queries
- Availability controller → Availability model: reads/writes
- Blocked-time controller → Blocked-time model: reads/writes
- Notification controller → Notification model: reads/writes
