# joshade/appointments-express-frontend architecture

> Architecture diagram of the GitHub repository joshade/appointments-express-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/joshade/appointments-express-frontend
- Repository: https://github.com/joshade/appointments-express-frontend

## Overview

This repository is a single-page React frontend for an appointments system. The architecture is client-side UI plus a thin data-access layer that talks to a separate backend API. The backend is not included here; the frontend is designed to run in the browser and call `BASE_URL/api` endpoints configured in `src/axios.ts`.

1. **Application shell and runtime**
   - The app is bootstrapped from `src/index.tsx` and rendered into the browser DOM.
   - `public/index.html`, `public/manifest.json`, `public/robots.txt`, and `public/_redirects` support static hosting and SPA routing.
   - `src/serviceWorker.ts` indicates PWA-style support, though the main architecture is still a browser SPA.

2. **Global state and store boundary**
   - `src/app/store.ts` is the Redux store composition point.
   - `src/app/hooks.ts` provides typed Redux hooks for dispatch/select usage.
   - Feature state is split into slices under `src/features`, notably `auth`, `customerAuth`, and domain type definitions for appointments, stores, users, and common types.

3. **Server communication layer**
   - `src/axios.ts` centralizes the API base URL and is the main boundary between UI and backend.
   - `src/app/services/appointments.ts` suggests RTK Query or similar service-based fetching for appointment-related endpoints.
   - The readme explicitly says this frontend uses Redux Toolkit and RTK Query, so data fetching/caching is part of the app’s state layer rather than ad hoc component calls.

4. **Authentication and route protection**
   - Authentication is handled through dedicated UI and state modules, including `src/features/auth/authSlice.ts` and `src/features/customerAuth/customerAuthSlice.ts`.
   - Route gating is implemented in `src/components/pages/auth/ProtectedRoute.tsx` and `UnprotectedRoute.tsx`.
   - There are separate login flows for different user types, visible in `Login.tsx`, `LoginCustomer.tsx`, and `Register.tsx`.

5. **Major user-facing domains**
   - **Public marketing/home area:** `src/components/pages/home/*` contains the landing page and sections like features, stats, steps, roles, about, and navigation.
   - **Authenticated dashboard area:** `src/components/Dashboard.tsx`, `CustomerDashboard.tsx`, and `src/components/sidebar/*` define the main logged-in navigation shell.
   - **Customer appointment area:** `src/components/pages/customerview/*` includes viewing appointment lists and appointment details.
   - **Appointment management area:** `src/components/pages/manageappointment/*` includes list/calendar views and appointment cards.
   - **Store management area:** `src/components/pages/managestore/*` handles store info, hours, closure days/times, and store listing.
   - **Role/account management:** `src/components/pages/managerole/*` and `manageaccount/ManageAccount.tsx` cover role assignment and account settings.

6. **UI composition pattern**
   - Pages are built from smaller shared components rather than being monolithic.
   - Shared primitives live in `src/components/shared/*` such as buttons, form controls, modal, scheduler, avatar upload, error notice, and dashboard headers.
   - This indicates a design-system-like layer used across the business domains.

7. **Forms and user input flow**
   - Reusable form helpers are centralized in `src/components/shared/FormElements.tsx`, `TimeInput.tsx`, `Select.tsx`, `Checkbox.tsx`, and `RadioButton.tsx`.
   - Custom hooks in `src/hooks/useForm.ts` and `src/hooks/useSelectStore.ts` encapsulate repeated form and selection logic.
   - Appointment creation is a notable form flow (`src/components/pages/createappointment/*`) with instructions, modal form content, and scheduler integration.

8. **Customer vs. admin separation**
   - The file structure strongly suggests two roles with different experiences:
     - customer-facing views under `CustomerDashboard`, `LoginCustomer`, and `customerview/*`
     - staff/admin-facing management views under `manageappointment`, `managestore`, `managerole`, and `manageaccount`
   - This boundary is reinforced by separate auth slices/types for general auth and customer auth.

9. **Shared domain model layer**
   - Type definitions are organized by domain under `src/features/*Types.ts`.
   - These types likely act as the contract between API responses, Redux state, and form/UI props.
   - This reduces coupling between components and backend payload shapes.

10. **Styling and presentation**
   - Tailwind CSS is the primary styling system, configured via `tailwind.config.js` and `src/styles/tailwind.css`.
   - `src/App.css` appears to be supplemental app-level styling.
   - The architecture is therefore component-driven with utility-first styling rather than CSS modules or a large custom stylesheet hierarchy.

11. **Navigation and layout**
   - Reusable layout/navigation pieces include `Sidebar`, `GridLayout`, and top navigation components under the auth/home sections.
   - `ErrorPage.tsx` provides a terminal route/view for invalid states or routing errors.

12. **Overall data flow**
   - User action in a page/component
   - form or UI state managed locally or through Redux
   - async call through axios or RTK Query service to the backend API
   - response stored in Redux/cache or passed directly into components
   - shared components render the result in dashboard/list/detail views

13. **What to show in an architecture diagram**
   - A browser SPA at the top
   - Redux Toolkit store and RTK Query service layer in the middle
   - Separate feature modules for auth, customer auth, appointments, stores, and users
   - A backend API boundary reached through `axios.ts`
   - UI grouped into public home, auth, customer dashboard, and admin management areas

14. **Notable operational detail**
   - The readme instructs changing `src/axios.ts` to point at the deployed backend and to keep `/api` in the URL. That makes the backend endpoint configuration an explicit deployment concern for the frontend.

Main entry points: [`src/components/shared/Button.tsx`](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/shared/Button.tsx) (Shared UI), [`src/app/store.ts`](https://github.com/joshade/appointments-express-frontend/blob/master/src/app/store.ts) (Redux store), [`src/App.tsx`](https://github.com/joshade/appointments-express-frontend/blob/master/src/App.tsx) (App shell), [`src/app/services/appointments.ts`](https://github.com/joshade/appointments-express-frontend/blob/master/src/app/services/appointments.ts) (Appointments API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_shell["Shell"]
  node_node_index(("App entry<br/>bootstrap<br/>[index.tsx]"))
  node_node_app["App shell<br/>router shell<br/>[App.tsx]"]
  node_node_public_html["Static host<br/>hosting assets<br/>[index.html]"]
  node_node_sw["Service worker<br/>pwa runtime<br/>[serviceWorker.ts]"]
end

subgraph group_group_state["State & Data"]
  node_node_store[("Redux store<br/>state container<br/>[store.ts]")]
  node_node_hooks["Redux hooks<br/>typed hooks<br/>[hooks.ts]"]
  node_node_axios["API client<br/>http boundary<br/>[axios.ts]"]
  node_node_appointments_api["Appointments API<br/>rtk query service<br/>[appointments.ts]"]
  node_node_auth_slice["Auth state<br/>redux slice<br/>[authSlice.ts]"]
  node_node_customer_auth_slice["Customer auth<br/>redux slice"]
  node_node_types["Domain types<br/>type contracts<br/>[commonTypes.ts]"]
end

subgraph group_group_public["Public Site"]
  node_node_home["Home pages<br/>public pages<br/>[Home.tsx]"]
end

subgraph group_group_auth["Auth"]
  node_node_auth_pages["Auth pages<br/>[Login.tsx]"]
  node_node_protected["Route gates<br/>route guards<br/>[ProtectedRoute.tsx]"]
end

subgraph group_group_customer["Customer Area"]
  node_node_customer_view["Customer views<br/>customer workflow"]
end

subgraph group_group_admin["Admin Area"]
  node_node_create_appt["Create appt<br/>booking flow"]
  node_node_manage_appt["Manage appt<br/>admin workflow"]
  node_node_manage_store["Manage store<br/>admin workflow<br/>[ManageStore.tsx]"]
  node_node_manage_role["Manage roles<br/>admin workflow<br/>[ManageRole.tsx]"]
  node_node_manage_account["Account settings<br/>profile management<br/>[ManageAccount.tsx]"]
end

subgraph group_group_shared["Shared UI"]
  node_node_dashboard["Dashboards<br/>logged-in shell<br/>[Dashboard.tsx]"]
  node_node_sidebar["Sidebar nav<br/>navigation<br/>[Sidebar.tsx]"]
  node_node_shared_ui["Shared UI<br/>component kit<br/>[Button.tsx]"]
end

node_node_index -->|"boots"| node_node_app
node_node_app -->|"uses"| node_node_store
node_node_app -->|"routes"| node_node_protected
node_node_app -->|"renders"| node_node_dashboard
node_node_index -.->|"hosted by"| node_node_public_html
node_node_index -.->|"registers"| node_node_sw
node_node_store -->|"exposes"| node_node_hooks
node_node_store -->|"contains"| node_node_auth_slice
node_node_store -->|"contains"| node_node_customer_auth_slice
node_node_store -.->|"typed by"| node_node_types
node_node_appointments_api -->|"calls"| node_node_axios
node_node_auth_pages -->|"gated by"| node_node_protected
node_node_auth_pages -->|"updates"| node_node_auth_slice
node_node_auth_pages -->|"updates"| node_node_customer_auth_slice
node_node_home -->|"composes"| node_node_shared_ui
node_node_dashboard -->|"navigates"| node_node_sidebar
node_node_dashboard -->|"composes"| node_node_shared_ui
node_node_create_appt -->|"uses"| node_node_shared_ui
node_node_create_appt -->|"fetches"| node_node_appointments_api
node_node_manage_appt -->|"fetches"| node_node_appointments_api
node_node_manage_store -->|"uses"| node_node_shared_ui
node_node_manage_role -->|"uses"| node_node_shared_ui
node_node_manage_account -->|"uses"| node_node_shared_ui
node_node_customer_view -->|"fetches"| node_node_appointments_api
node_node_customer_view -->|"uses"| node_node_shared_ui
node_node_public_html -.->|"loads"| node_node_app

click node_node_index "https://github.com/joshade/appointments-express-frontend/blob/master/src/index.tsx"
click node_node_app "https://github.com/joshade/appointments-express-frontend/blob/master/src/App.tsx"
click node_node_public_html "https://github.com/joshade/appointments-express-frontend/blob/master/public/index.html"
click node_node_sw "https://github.com/joshade/appointments-express-frontend/blob/master/src/serviceWorker.ts"
click node_node_store "https://github.com/joshade/appointments-express-frontend/blob/master/src/app/store.ts"
click node_node_hooks "https://github.com/joshade/appointments-express-frontend/blob/master/src/app/hooks.ts"
click node_node_axios "https://github.com/joshade/appointments-express-frontend/blob/master/src/axios.ts"
click node_node_appointments_api "https://github.com/joshade/appointments-express-frontend/blob/master/src/app/services/appointments.ts"
click node_node_auth_slice "https://github.com/joshade/appointments-express-frontend/blob/master/src/features/auth/authSlice.ts"
click node_node_customer_auth_slice "https://github.com/joshade/appointments-express-frontend/blob/master/src/features/customerAuth/customerAuthSlice.ts"
click node_node_types "https://github.com/joshade/appointments-express-frontend/blob/master/src/features/commonTypes.ts"
click node_node_home "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/home/Home.tsx"
click node_node_auth_pages "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/auth/Login.tsx"
click node_node_protected "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/auth/ProtectedRoute.tsx"
click node_node_dashboard "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/Dashboard.tsx"
click node_node_sidebar "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/sidebar/Sidebar.tsx"
click node_node_shared_ui "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/shared/Button.tsx"
click node_node_create_appt "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/createappointment/CreateAppointment.tsx"
click node_node_manage_appt "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/manageappointment/ManageAppointment.tsx"
click node_node_manage_store "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/managestore/ManageStore.tsx"
click node_node_manage_role "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/managerole/ManageRole.tsx"
click node_node_manage_account "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/manageaccount/ManageAccount.tsx"
click node_node_customer_view "https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/customerview/viewappointments/ViewAppointments.tsx"

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_node_index,node_node_app,node_node_public_html,node_node_sw,node_node_dashboard,node_node_sidebar,node_node_shared_ui toneBlue
class node_node_store,node_node_hooks,node_node_axios,node_node_appointments_api,node_node_auth_slice,node_node_customer_auth_slice,node_node_types toneAmber
class node_node_home toneMint
class node_node_auth_pages,node_node_protected toneRose
class node_node_customer_view toneIndigo
class node_node_create_appt,node_node_manage_appt,node_node_manage_store,node_node_manage_role,node_node_manage_account toneTeal
```

## Components

### Shell

Browser entrypoints, static hosting, and app bootstrap.

- [App entry](https://github.com/joshade/appointments-express-frontend/blob/master/src/index.tsx): bootstrap · React DOM bootstrap for the SPA. · `src/index.tsx`
- [App shell](https://github.com/joshade/appointments-express-frontend/blob/master/src/App.tsx): router shell · Top-level application composition and route wiring. · `src/App.tsx`
- [Static host](https://github.com/joshade/appointments-express-frontend/blob/master/public/index.html): hosting assets · SPA hosting and PWA support files. · `public/index.html`
- [Service worker](https://github.com/joshade/appointments-express-frontend/blob/master/src/serviceWorker.ts): pwa runtime · Service worker support for browser caching/offline behavior. · `src/serviceWorker.ts`

### State & Data

Redux store, API boundary, and domain types.

- [Redux store](https://github.com/joshade/appointments-express-frontend/blob/master/src/app/store.ts): state container · Central Redux store composition point. · `src/app/store.ts`
- [Redux hooks](https://github.com/joshade/appointments-express-frontend/blob/master/src/app/hooks.ts): typed hooks · Typed dispatch and selector helpers. · `src/app/hooks.ts`
- [API client](https://github.com/joshade/appointments-express-frontend/blob/master/src/axios.ts): http boundary · Central axios configuration and backend base URL boundary. · `src/axios.ts`
- [Appointments API](https://github.com/joshade/appointments-express-frontend/blob/master/src/app/services/appointments.ts): rtk query service · Service layer for appointment-related backend calls. · `src/app/services/appointments.ts`
- [Auth state](https://github.com/joshade/appointments-express-frontend/blob/master/src/features/auth/authSlice.ts): redux slice · General authentication state and actions. · `src/features/auth/authSlice.ts`
- [Customer auth](https://github.com/joshade/appointments-express-frontend/blob/master/src/features/customerAuth/customerAuthSlice.ts): redux slice · Customer-specific authentication state. · `src/features/customerAuth/customerAuthSlice.ts`
- [Domain types](https://github.com/joshade/appointments-express-frontend/blob/master/src/features/commonTypes.ts): type contracts · Shared feature types for appointments, stores, users, and common models. · `src/features/commonTypes.ts`

### Public Site

Landing pages and unauthenticated marketing views.

- [Home pages](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/home/Home.tsx): public pages · Landing page sections and top navigation. · `src/components/pages/home/Home.tsx`

### Auth

Sign-in, sign-up, and route protection.

- [Auth pages](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/auth/Login.tsx): auth pages · Login, customer login, register, and auth gating views. · `src/components/pages/auth/Login.tsx`
- [Route gates](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/auth/ProtectedRoute.tsx): route guards · Protected and unprotected route wrappers plus auth loading. · `src/components/pages/auth/ProtectedRoute.tsx`

### Customer Area

Customer-facing appointment views.

- [Customer views](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/customerview/viewappointments/ViewAppointments.tsx): customer workflow · Customer appointment list and appointment detail pages. · `src/components/pages/customerview/viewappointments/ViewAppointments.tsx`

### Admin Area

Staff-facing management workflows.

- [Create appt](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/createappointment/CreateAppointment.tsx): booking flow · Appointment creation flow with instructions, modal form, and scheduler. · `src/components/pages/createappointment/CreateAppointment.tsx`
- [Manage appt](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/manageappointment/ManageAppointment.tsx): admin workflow · Appointment list and calendar management views. · `src/components/pages/manageappointment/ManageAppointment.tsx`
- [Manage store](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/managestore/ManageStore.tsx): admin workflow · Store information, hours, and closure management. · `src/components/pages/managestore/ManageStore.tsx`
- [Manage roles](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/managerole/ManageRole.tsx): admin workflow · Role assignment and role detail management. · `src/components/pages/managerole/ManageRole.tsx`
- [Account settings](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/pages/manageaccount/ManageAccount.tsx): profile management · Account management and profile-related settings. · `src/components/pages/manageaccount/ManageAccount.tsx`

### Shared UI

Reusable components and layout primitives.

- [Dashboards](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/Dashboard.tsx): logged-in shell · Main dashboard shells for staff and customers. · `src/components/Dashboard.tsx`
- [Sidebar nav](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/sidebar/Sidebar.tsx): navigation · Sidebar layout and menu data for authenticated areas. · `src/components/sidebar/Sidebar.tsx`
- [Shared UI](https://github.com/joshade/appointments-express-frontend/blob/master/src/components/shared/Button.tsx): component kit · Reusable controls, forms, modals, scheduler, and notices. · `src/components/shared/Button.tsx`

## Connections

- App entry → App shell: boots · Browser entry mounts the app shell.
- App shell → Redux store: uses · App composes the Redux store boundary.
- App shell → Route gates: routes · Top-level routing relies on auth guards.
- App shell → Dashboards: renders · Authenticated areas are shown through dashboard shells.
- App entry → Static host: hosted by · SPA is served from static hosting files.
- App entry → Service worker: registers · Bootstrapping includes service worker support.
- Redux store → Redux hooks: exposes · Typed hooks wrap store access for components.
- Redux store → Auth state: contains · Redux store includes auth state.
- Redux store → Customer auth: contains · Redux store includes customer auth state.
- Redux store → Domain types: typed by · Feature types define store and UI contracts.
- Appointments API → API client: calls · RTK Query service uses the shared HTTP client boundary.
- Auth pages → Route gates: gated by · Login and registration flows are controlled by route wrappers.
- Auth pages → Auth state: updates · General auth pages interact with auth state.
- Auth pages → Customer auth: updates · Customer login flow interacts with customer auth state.
- Home pages → Shared UI: composes · Landing sections are built from shared UI primitives.
- Dashboards → Sidebar nav: navigates · Logged-in shells use the sidebar navigation.
- Dashboards → Shared UI: composes · Dashboard pages rely on common headers and controls.
- Create appt → Shared UI: uses · Booking flow is assembled from shared forms and scheduler UI.
- Create appt → Appointments API: fetches · Appointment creation and related data use the appointments service.
- Manage appt → Appointments API: fetches · Management views read appointment data through the service layer.
- Manage store → Shared UI: uses · Store management is built from reusable forms and tables.
- Manage roles → Shared UI: uses · Role management reuses shared form controls.
- Account settings → Shared UI: uses · Account settings are composed from common UI primitives.
- Customer views → Appointments API: fetches · Customer appointment pages read appointment data through the service layer.
- Customer views → Shared UI: uses · Customer detail/list views use shared components.
- Static host → App shell: loads · Static host delivers the SPA bundle.
