# cherni-samar/cgd_client architecture

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

- Interactive diagram: https://gitdiagram.com/cherni-samar/cgd_client
- Repository: https://github.com/cherni-samar/cgd_client

## Overview

1. **Project shape**
   - This is a **client-side React + TypeScript app built with Vite**.
   - The repository is organized as a **feature-based UI application**, not a backend or library package.
   - The app appears to be a **single-page marketing/booking experience** with home content, gallery content, and a booking/quote flow.

2. **Application entry and shell**
   - `index.html` is the Vite entry point.
   - `src/main.tsx` boots the React tree.
   - `src/App.tsx` is the top-level composition layer that likely assembles the page shell and feature sections.
   - Global styling is split between `src/index.css` and `src/App.css`.

3. **Cross-cutting state**
   - `src/state/ThemeContext.tsx` provides shared theme state across the app.
   - This is the main global state boundary in the repo; most other logic appears to be feature-local.
   - For an architecture diagram, treat theme as a **cross-cutting provider** wrapping the UI rather than part of any one feature.

4. **Shared layout layer**
   - `src/shared/layout` contains the reusable chrome:
     - `Navbar.tsx`
     - `Hero.tsx`
     - `Footer.tsx`
   - These are not feature-specific and likely frame the app’s main content.
   - They form the outer UI shell that all sections sit inside.

5. **Home feature**
   - `src/features/home/pages/Home.tsx` is the page-level module for the landing experience.
   - `src/features/home/components` contains section components:
     - `Gallery.tsx`
     - `Reviews.tsx`
     - `Services.tsx`
     - `WhyUs.tsx`
   - This feature is mostly composed of content sections and presentation logic, and likely acts as the main visible page.

6. **Gallery feature boundary**
   - `src/features/gallery` is separated from the home UI, which suggests the gallery has its own data access and domain model.
   - It includes:
     - `hooks/useGallery.ts`
     - `services/galleryService.ts`
     - `types/gallery.ts`
   - This indicates a clean split of **view logic**, **data-fetching/adapter logic**, and **typed gallery entities**.

7. **Booking / quote feature boundary**
   - `src/features/booking` has a similar layered structure:
     - `components/BookingForm.tsx`
     - `hooks/useQuote.ts`
     - `services/quoteService.ts`
     - `types/quote.ts`
   - This suggests a small domain flow where the form drives a quote request through a hook, which delegates to a service layer.
   - For architecture, this is the most explicit business flow in the repo.

8. **Data flow pattern**
   - The app follows a consistent pattern:
     - UI components render sections/forms
     - hooks manage state and orchestration
     - services encapsulate data retrieval or submission logic
     - types define the domain contract
   - This keeps feature components mostly presentational and makes the service layer the boundary for external data or business rules.

9. **Shared constants and content**
   - `src/shared/constants/bookingData.ts` provides reusable booking-related content or configuration.
   - This implies some business data is centralized rather than hardcoded inside feature components.
   - It likely feeds the booking UI and reduces duplication between display and form logic.

10. **Assets and static content**
   - `src/assets` is the local asset bucket for images or other UI resources.
   - `public` is available for static files served directly by Vite.
   - These are important for the visual/marketing nature of the app, especially if gallery and hero sections use imagery.

11. **Build and tooling boundary**
   - The app is built with **Vite**, with TypeScript configuration in `tsconfig*.json` and linting in `eslint.config.js`.
   - There is no evidence of a custom runtime or backend in this repo; the architecture is entirely client-side.
   - Any external integration, if present, is isolated behind the `services/` modules.

12. **How to draw the architecture**
   - Draw a browser/client app that loads a Vite-built React tree.
   - Show `main.tsx -> App.tsx -> ThemeContext + shared layout + Home page`.
   - Inside Home, show section components.
   - Separately show feature boundaries for **gallery** and **booking**, each with:
     - component/UI
     - hook/controller
     - service boundary
     - typed model
   - Treat `shared/constants` as a common data source and `assets/public` as static resource inputs.

Main entry points: [`src/App.tsx`](https://github.com/cherni-samar/cgd_client/blob/main/src/App.tsx) (App.tsx), [`src/features/home/pages/Home.tsx`](https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/pages/Home.tsx) (Home), [`src/features/home/components/Gallery.tsx`](https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/components/Gallery.tsx) (Gallery section), [`src/features/gallery/hooks/useGallery.ts`](https://github.com/cherni-samar/cgd_client/blob/main/src/features/gallery/hooks/useGallery.ts) (useGallery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_shell["App shell"]
  node_n_index["index.html<br/>vite entry<br/>[index.html]"]
  node_n_main["main.tsx<br/>react bootstrap<br/>[main.tsx]"]
  node_n_app["App.tsx<br/>root composition<br/>[App.tsx]"]
end

subgraph group_grp_shared["Shared layer"]
  node_n_theme["ThemeContext<br/>global state<br/>[ThemeContext.tsx]"]
  node_n_nav["Navbar<br/>layout chrome<br/>[Navbar.tsx]"]
  node_n_hero["Hero<br/>layout chrome<br/>[Hero.tsx]"]
  node_n_footer["Footer<br/>layout chrome<br/>[Footer.tsx]"]
  node_n_booking_data["booking data<br/>shared content<br/>[bookingData.ts]"]
end

subgraph group_grp_home["Home feature"]
  node_n_home_page["Home<br/>landing page<br/>[Home.tsx]"]
  node_n_home_gallery["Gallery section<br/>home section<br/>[Gallery.tsx]"]
  node_n_home_reviews["Reviews<br/>home section<br/>[Reviews.tsx]"]
  node_n_home_services["Services<br/>home section<br/>[Services.tsx]"]
  node_n_home_whyus["Why Us<br/>home section<br/>[WhyUs.tsx]"]
end

subgraph group_grp_gallery["Gallery feature"]
  node_n_gallery_hook["useGallery<br/>gallery hook<br/>[useGallery.ts]"]
  node_n_gallery_service["galleryService<br/>gallery service<br/>[galleryService.ts]"]
  node_n_gallery_types["gallery types<br/>gallery model<br/>[gallery.ts]"]
end

subgraph group_grp_booking["Booking feature"]
  node_n_booking_form["BookingForm<br/>booking ui<br/>[BookingForm.tsx]"]
  node_n_quote_hook["useQuote<br/>booking hook<br/>[useQuote.ts]"]
  node_n_quote_service["quoteService<br/>booking service<br/>[quoteService.ts]"]
  node_n_quote_types["quote types<br/>booking model<br/>[quote.ts]"]
end

subgraph group_grp_static["Static inputs"]
  node_n_assets[("assets<br/>static media")]
  node_n_public[("public<br/>static files")]
end

node_n_index -->|"loads"| node_n_main
node_n_main -->|"renders"| node_n_app
node_n_app -->|"wraps"| node_n_theme
node_n_app -->|"composes"| node_n_nav
node_n_app -->|"composes"| node_n_hero
node_n_app -->|"mounts"| node_n_home_page
node_n_app -->|"composes"| node_n_footer
node_n_app -->|"uses"| node_n_booking_data
node_n_home_page -->|"includes"| node_n_home_gallery
node_n_home_page -->|"includes"| node_n_home_reviews
node_n_home_page -->|"includes"| node_n_home_services
node_n_home_page -->|"includes"| node_n_home_whyus
node_n_home_gallery -.->|"drives"| node_n_gallery_hook
node_n_gallery_hook -->|"fetches"| node_n_gallery_service
node_n_gallery_hook -->|"types"| node_n_gallery_types
node_n_booking_form -->|"submits to"| node_n_quote_hook
node_n_quote_hook -->|"delegates"| node_n_quote_service
node_n_quote_hook -->|"types"| node_n_quote_types
node_n_quote_service -->|"returns"| node_n_quote_types
node_n_home_gallery -.->|"uses"| node_n_assets
node_n_hero -.->|"uses"| node_n_public

click node_n_index "https://github.com/cherni-samar/cgd_client/blob/main/index.html"
click node_n_main "https://github.com/cherni-samar/cgd_client/blob/main/src/main.tsx"
click node_n_app "https://github.com/cherni-samar/cgd_client/blob/main/src/App.tsx"
click node_n_theme "https://github.com/cherni-samar/cgd_client/blob/main/src/state/ThemeContext.tsx"
click node_n_nav "https://github.com/cherni-samar/cgd_client/blob/main/src/shared/layout/Navbar.tsx"
click node_n_hero "https://github.com/cherni-samar/cgd_client/blob/main/src/shared/layout/Hero.tsx"
click node_n_footer "https://github.com/cherni-samar/cgd_client/blob/main/src/shared/layout/Footer.tsx"
click node_n_booking_data "https://github.com/cherni-samar/cgd_client/blob/main/src/shared/constants/bookingData.ts"
click node_n_home_page "https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/pages/Home.tsx"
click node_n_home_gallery "https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/components/Gallery.tsx"
click node_n_home_reviews "https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/components/Reviews.tsx"
click node_n_home_services "https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/components/Services.tsx"
click node_n_home_whyus "https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/components/WhyUs.tsx"
click node_n_gallery_hook "https://github.com/cherni-samar/cgd_client/blob/main/src/features/gallery/hooks/useGallery.ts"
click node_n_gallery_service "https://github.com/cherni-samar/cgd_client/blob/main/src/features/gallery/services/galleryService.ts"
click node_n_gallery_types "https://github.com/cherni-samar/cgd_client/blob/main/src/features/gallery/types/gallery.ts"
click node_n_booking_form "https://github.com/cherni-samar/cgd_client/blob/main/src/features/booking/components/BookingForm.tsx"
click node_n_quote_hook "https://github.com/cherni-samar/cgd_client/blob/main/src/features/booking/hooks/useQuote.ts"
click node_n_quote_service "https://github.com/cherni-samar/cgd_client/blob/main/src/features/booking/services/quoteService.ts"
click node_n_quote_types "https://github.com/cherni-samar/cgd_client/blob/main/src/features/booking/types/quote.ts"
click node_n_assets "https://github.com/cherni-samar/cgd_client/tree/main/src/assets"
click node_n_public "https://github.com/cherni-samar/cgd_client/tree/main/public"

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_n_index,node_n_main,node_n_app toneBlue
class node_n_theme,node_n_nav,node_n_hero,node_n_footer,node_n_booking_data toneAmber
class node_n_home_page,node_n_home_gallery,node_n_home_reviews,node_n_home_services,node_n_home_whyus toneMint
class node_n_gallery_hook,node_n_gallery_service,node_n_gallery_types toneRose
class node_n_booking_form,node_n_quote_hook,node_n_quote_service,node_n_quote_types toneIndigo
class node_n_assets,node_n_public toneTeal
```

## Components

### App shell

Vite entry, React bootstrap, and global UI composition.

- [index.html](https://github.com/cherni-samar/cgd_client/blob/main/index.html): vite entry · HTML entry loaded by Vite. · `index.html`
- [main.tsx](https://github.com/cherni-samar/cgd_client/blob/main/src/main.tsx): react bootstrap · Mounts the React application. · `src/main.tsx`
- [App.tsx](https://github.com/cherni-samar/cgd_client/blob/main/src/App.tsx): root composition · Top-level app composition and page assembly. · `src/App.tsx`

### Shared layer

Reusable chrome, constants, and cross-cutting state.

- [ThemeContext](https://github.com/cherni-samar/cgd_client/blob/main/src/state/ThemeContext.tsx): global state · Cross-cutting theme provider for the app. · `src/state/ThemeContext.tsx`
- [Navbar](https://github.com/cherni-samar/cgd_client/blob/main/src/shared/layout/Navbar.tsx): layout chrome · Shared navigation shell. · `src/shared/layout/Navbar.tsx`
- [Hero](https://github.com/cherni-samar/cgd_client/blob/main/src/shared/layout/Hero.tsx): layout chrome · Shared hero section for the page shell. · `src/shared/layout/Hero.tsx`
- [Footer](https://github.com/cherni-samar/cgd_client/blob/main/src/shared/layout/Footer.tsx): layout chrome · Shared page footer. · `src/shared/layout/Footer.tsx`
- [booking data](https://github.com/cherni-samar/cgd_client/blob/main/src/shared/constants/bookingData.ts): shared content · Centralized booking-related copy or configuration. · `src/shared/constants/bookingData.ts`

### Home feature

Landing-page sections assembled from presentation components.

- [Home](https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/pages/Home.tsx): landing page · Main home-page composition. · `src/features/home/pages/Home.tsx`
- [Gallery section](https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/components/Gallery.tsx): home section · Gallery presentation section on the home page. · `src/features/home/components/Gallery.tsx`
- [Reviews](https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/components/Reviews.tsx): home section · Customer reviews section. · `src/features/home/components/Reviews.tsx`
- [Services](https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/components/Services.tsx): home section · Services overview section. · `src/features/home/components/Services.tsx`
- [Why Us](https://github.com/cherni-samar/cgd_client/blob/main/src/features/home/components/WhyUs.tsx): home section · Value-proposition section. · `src/features/home/components/WhyUs.tsx`

### Gallery feature

Gallery domain split into UI, hook, service, and types.

- [useGallery](https://github.com/cherni-samar/cgd_client/blob/main/src/features/gallery/hooks/useGallery.ts): gallery hook · Orchestrates gallery state and data loading. · `src/features/gallery/hooks/useGallery.ts`
- [galleryService](https://github.com/cherni-samar/cgd_client/blob/main/src/features/gallery/services/galleryService.ts): gallery service · Gallery data access and adapter boundary. · `src/features/gallery/services/galleryService.ts`
- [gallery types](https://github.com/cherni-samar/cgd_client/blob/main/src/features/gallery/types/gallery.ts): gallery model · Typed gallery entities and contracts. · `src/features/gallery/types/gallery.ts`

### Booking feature

Quote/booking flow split into UI, hook, service, and types.

- [BookingForm](https://github.com/cherni-samar/cgd_client/blob/main/src/features/booking/components/BookingForm.tsx): booking ui · User-facing quote request form. · `src/features/booking/components/BookingForm.tsx`
- [useQuote](https://github.com/cherni-samar/cgd_client/blob/main/src/features/booking/hooks/useQuote.ts): booking hook · Coordinates booking form state and quote flow. · `src/features/booking/hooks/useQuote.ts`
- [quoteService](https://github.com/cherni-samar/cgd_client/blob/main/src/features/booking/services/quoteService.ts): booking service · Quote submission and business boundary. · `src/features/booking/services/quoteService.ts`
- [quote types](https://github.com/cherni-samar/cgd_client/blob/main/src/features/booking/types/quote.ts): booking model · Typed quote request/response contract. · `src/features/booking/types/quote.ts`

### Static inputs

Assets and public files consumed by the client app.

- [assets](https://github.com/cherni-samar/cgd_client/tree/main/src/assets): static media · Imported local UI assets. · `src/assets`
- [public](https://github.com/cherni-samar/cgd_client/tree/main/public): static files · Files served directly by Vite. · `public`

## Connections

- index.html → main.tsx: loads · Browser entry loads the React bootstrap.
- main.tsx → App.tsx: renders · Bootstraps the root application component.
- App.tsx → ThemeContext: wraps · Provides global theme state to the UI.
- App.tsx → Navbar: composes · Includes shared navigation chrome.
- App.tsx → Hero: composes · Includes shared hero chrome.
- App.tsx → Home: mounts · Primary page content is the home experience.
- App.tsx → Footer: composes · Includes shared footer chrome.
- App.tsx → booking data: uses · Consumes shared booking content/config.
- Home → Gallery section: includes · Landing page includes gallery section.
- Home → Reviews: includes · Landing page includes reviews section.
- Home → Services: includes · Landing page includes services section.
- Home → Why Us: includes · Landing page includes value-proposition section.
- Gallery section → useGallery: drives · Gallery section likely relies on gallery orchestration.
- useGallery → galleryService: fetches · Hook delegates data access to service boundary.
- useGallery → gallery types: types · Hook uses gallery domain contracts.
- BookingForm → useQuote: submits to · Form is wired through quote orchestration.
- useQuote → quoteService: delegates · Hook delegates submission/business logic.
- useQuote → quote types: types · Hook uses quote domain contracts.
- quoteService → quote types: returns · Service works with quote request/response types.
- Gallery section → assets: uses · Gallery presentation consumes local media.
- Hero → public: uses · Shared hero can draw from static public assets.
