How cherni-samar/cgd_client works
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: App.tsx App.tsx · Home.tsx Home · Gallery.tsx Gallery section · useGallery.ts useGallery
Components 22
App shell
Vite entry, React bootstrap, and global UI composition.
- index.html · HTML entry loaded by Vite.
index.html - main.tsx · Mounts the React application.
src/main.tsx - App.tsx · Top-level app composition and page assembly.
src/App.tsx
Shared layer
Reusable chrome, constants, and cross-cutting state.
- ThemeContext · Cross-cutting theme provider for the app.
src/state/ThemeContext.tsx - Navbar · Shared navigation shell.
src/shared/layout/Navbar.tsx - Hero · Shared hero section for the page shell.
src/shared/layout/Hero.tsx - Footer · Shared page footer.
src/shared/layout/Footer.tsx - booking data · Centralized booking-related copy or configuration.
src/shared/constants/bookingData.ts
Home feature
Landing-page sections assembled from presentation components.
- Home · Main home-page composition.
src/features/home/pages/Home.tsx - Gallery section · Gallery presentation section on the home page.
src/features/home/components/Gallery.tsx - Reviews · Customer reviews section.
src/features/home/components/Reviews.tsx - Services · Services overview section.
src/features/home/components/Services.tsx - Why Us · Value-proposition section.
src/features/home/components/WhyUs.tsx
Gallery feature
Gallery domain split into UI, hook, service, and types.
- useGallery · Orchestrates gallery state and data loading.
src/features/gallery/hooks/useGallery.ts - galleryService · Gallery data access and adapter boundary.
src/features/gallery/services/galleryService.ts - gallery types · Typed gallery entities and contracts.
src/features/gallery/types/gallery.ts
Booking feature
Quote/booking flow split into UI, hook, service, and types.
- BookingForm · User-facing quote request form.
src/features/booking/components/BookingForm.tsx - useQuote · Coordinates booking form state and quote flow.
src/features/booking/hooks/useQuote.ts - quoteService · Quote submission and business boundary.
src/features/booking/services/quoteService.ts - quote types · Typed quote request/response contract.
src/features/booking/types/quote.ts
Connections 21
- 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.