# ravneet0628/insurance-site architecture

> Architecture diagram of the GitHub repository ravneet0628/insurance-site, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ravneet0628/insurance-site
- Repository: https://github.com/ravneet0628/insurance-site

## Overview

##### Project type and purpose
- From the file tree and README, this is a **single‐page application (SPA)** for an insurance broker website.
- It’s purely a **frontend** project (React + TypeScript + Tailwind) built with **Vite**, producing a static site deployed to a CDN (e.g., Cloudflare Pages).

##### File structure
- Top‐level directories and files:
- public/ – static assets (images, favicon, index.html)
- src/ – all TypeScript source code
- components/ – reusable UI building blocks (Accordion, Hero, Navbar, etc.)
- pages/ – page‐level React components (HomePage, AboutPage, ContactPage)
- content/ – content‐as‐code (data, hooks, types, utils) to drive pages
- utils/ – low‐level helpers (api.ts)
- __tests__/ & test/ – unit and integration tests (Vitest + Testing Library)
- config files – vite.config.ts, tsconfig.json, ESLint/Prettier, package.json
- Patterns:
- **Component-based** architecture with a design system (Layout, UI elements)
- **Content stratification**: content/data separate from UI
- **Routing**: React Router DOM for page navigation
- **Build & deploy**: Vite builds to a static `dist` directory for CDN

##### README for additional insights
- Confirms tech stack (React 19, TypeScript, Tailwind, Vite)
- Mentions **lazy‐loaded routes** (code splitting) and **SEO** meta tags
- Deployment recommended to **Cloudflare Pages**, but any static host applies

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Development & Build Pipeline
    subgraph "Development & Build"
        direction TB
        Dev["Developer / Local Machine"]:::build
        Repo["GitHub Repo"]:::build
        CI["CI/CD Pipeline (ESLint, Vitest)"]:::build
        ViteDev["Vite Dev Server (vite.config.ts)"]:::build
        ViteBuild["Vite Build → dist"]:::build

        subgraph "Source Code"
            direction TB
            Main["Entry: src/main.tsx"]:::build
            App["Root App & Routing: src/App.tsx"]:::build
            ComponentsDir["UI Components: src/components/"]:::build
            PagesDir["Page Components: src/pages/"]:::build
            ContentDir["Content Layer: src/content/"]:::build
            Utils["API Utils: src/utils/api.ts"]:::build
            PublicDir["Static Assets: public/"]:::build
            IndexHTML["HTML Template: index.html"]:::build
        end

        Dev -->|"push code"| Repo
        Repo -->|"trigger build"| CI
        CI -->|"run lint & tests"| CI
        CI -->|"build prod"| ViteBuild
        Dev -->|"run dev"| ViteDev

        Main --> ViteDev
        App --> ViteDev
        ComponentsDir --> ViteDev
        PagesDir --> ViteDev
        ContentDir --> ViteDev
        Utils --> ViteDev
        PublicDir --> ViteDev
        IndexHTML --> ViteDev

        Main --> ViteBuild
        App --> ViteBuild
        ComponentsDir --> ViteBuild
        PagesDir --> ViteBuild
        ContentDir --> ViteBuild
        Utils --> ViteBuild
        PublicDir --> ViteBuild
        IndexHTML --> ViteBuild
    end

    %% Deployment
    ViteBuild -->|"deploy dist"| CDN["CDN / Cloudflare Pages"]:::deploy

    %% Runtime in Browser
    subgraph "Runtime (Browser)" 
        direction TB
        Browser["Browser (User Agent)"]:::runtime
        Router["React Router v6"]:::runtime
        Pages["Page Components"]:::runtime
        Components["UI Components"]:::runtime
        ContentLayer["Content Layer (hooks & data)"]:::content
        Assets["Static Assets (images, CSS)"]:::content
    end

    CDN -->|"HTTP GET /index.html"| Browser
    Browser -->|"GET JS/CSS bundles"| CDN
    Browser -->|"GET static assets"| CDN

    Browser --> Router
    Router -->|"render route"| Pages
    Pages --> Components
    Pages --> ContentLayer
    Components --> ContentLayer
    Router -->|"lazy load chunk"| CDN

    %% Click Events
    click Main "https://github.com/ravneet0628/insurance-site/blob/main/src/main.tsx"
    click App "https://github.com/ravneet0628/insurance-site/blob/main/src/App.tsx"
    click ComponentsDir "https://github.com/ravneet0628/insurance-site/tree/main/src/components/"
    click PagesDir "https://github.com/ravneet0628/insurance-site/tree/main/src/pages/"
    click ContentDir "https://github.com/ravneet0628/insurance-site/tree/main/src/content/"
    click Utils "https://github.com/ravneet0628/insurance-site/blob/main/src/utils/api.ts"
    click PublicDir "https://github.com/ravneet0628/insurance-site/tree/main/public/"
    click IndexHTML "https://github.com/ravneet0628/insurance-site/blob/main/index.html"

    click CDN "https://github.com/ravneet0628/insurance-site/blob/main/vite.config.ts"
    click CI "https://github.com/ravneet0628/insurance-site/blob/main/eslint.config.js"
    click ViteDev "https://github.com/ravneet0628/insurance-site/blob/main/vite.config.ts"
    click ViteBuild "https://github.com/ravneet0628/insurance-site/blob/main/package.json"

    %% Styles
    classDef build fill:#bbdefb,stroke:#1e88e5,color:#0d47a1;
    classDef deploy fill:#90caf9,stroke:#1565c0,color:#ffffff;
    classDef runtime fill:#c8e6c9,stroke:#2e7d32,color:#1b5e20;
    classDef content fill:#ffe0b2,stroke:#ef6c00,color:#e65100;
    classDef optional stroke-dasharray: 5 5;
```
