# gungun2004/streetsofsirsa architecture

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

- Interactive diagram: https://gitdiagram.com/gungun2004/streetsofsirsa
- Repository: https://github.com/gungun2004/streetsofsirsa

## Overview

##### Project type and purpose
- From the file tree and README, this is a full-stack web application built with Create React App for the frontend and Node.js/Express for the backend.
- The frontend (in `src/`, `public/`) is a React single-page application (SPA) that renders pages like Home, Services, Contact, etc., and offers a contact form.
- The backend is split into two small Express services:
- `backend/` handles “contactUs” and “joinTeam” routes.
- `server/` provides an `/api/sendEmail` endpoint to dispatch emails.
- There’s no persistent database in the tree; data flows from frontend forms to backend endpoints and then to an external email service (SMTP or API).

##### File structure
- Top-level:
- `.env`, `package.json` – environment and dependency manifest.
- `client/` & `public/` – standalone static HTML/JS contact page and static assets.
- `src/` – React source code: components, styles, context, pages, tests.
- `backend/` & `server/` – two Express services, each with its own entrypoint (`server.js`, `index.js`) and route handlers.
- Patterns & configs:
- React uses component-based UI (modular CSS), a Context for theming, and React Router for pages.
- Express routes are organized per feature.
- No database layer—data is forwarded to an email provider.

##### README for additional insights
- It’s a standard Create React App with standard scripts for start, test, build, eject.

a. Main components:
- React SPA (Client)
- Static assets server (serves `public/`)
- Express Service A (`backend/server.js` with contactUs & joinTeam routes)
- Express Service B (`server/index.js` for `/api/sendEmail`)
- External Email Service (SMTP or third-party API)
- (Optional) Deployment environment: Node.js host or container/orchestration layer.
b. Component interactions:
1. User’s browser loads the SPA from the Static Assets Server.
2. SPA’s UI pages (Contact, Join Team) call Service A endpoints (`/contactUs`, `/joinTeam`) or directly call Service B’s `/api/sendEmail`.
3. Service A may forward data to Service B or directly invoke the Email Service.
4. Service B formats the email and sends it to the external Email Service.
5. The Email Service delivers to end recipients.
c. Architectural patterns & principles:
- Client-server separation (UI vs API)
- Separation of concerns: Service A handles business routes; Service B is a dedicated email dispatcher.
- Component-based UI with React.
- Environment variables (in `.env`) to decouple credentials (SMTP, API keys).
d. Key technologies:
- Frontend: React, React Router, Context API, CSS Modules
- Backend: Node.js, Express, dotenv
- External: SMTP or SendGrid/Mailgun API
- Build tools: Webpack (via CRA), Babel

##### Detail
- Environment variables feeding into both Express services.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and static server
    user["User Browser"]:::user
    user -->|"loads SPA"| static["Static Assets Server"]:::frontend
    static -->|"serves index.html"| SPA

    %% React SPA subgraph
    subgraph "React SPA" 
        direction TB
        index["src/index.js"]:::frontend
        App["src/App.js"]:::frontend
        ThemeContext["src/context/ThemeContext.js"]:::frontend
        GlobalCSS["src/styles/global.css"]:::frontend

        subgraph "Pages"
            Home["Home.js"]:::frontend
            Services["Services.js"]:::frontend
            ContactUsPage["ContactUs.js"]:::frontend
            Team["Team.js"]:::frontend
            Reviews["Reviews.js"]:::frontend
            Journey["OurJourney.js"]:::frontend
        end

        subgraph "Components"
            Navbar["Navbar.js"]:::frontend
            Footer["Footer.js"]:::frontend
            Carousel["Carousel.js"]:::frontend
            HomeCarousel["HomeCarousel.js"]:::frontend
            Card["Card.js"]:::frontend
            ChatIcon["ChatIcon.js"]:::frontend
            HorizontalScroll["HorizontalScroll.js"]:::frontend
            ThemeSwitcher["ThemeSwitcher.js"]:::frontend
        end

        index -->|"renders"| App
        App --> ThemeContext
        App --> GlobalCSS
        App --> Pages
        App --> Components
    end

    %% Backend services
    subgraph "Express Service A" 
        direction TB
        AEntry["backend/server.js"]:::backend
        ContactRoute["backend/routes/contactUs.js"]:::backend
        JoinRoute["backend/routes/joinTeam.js"]:::backend
        EmailTest["backend/test-email.js"]:::backend
        AEntry --> ContactRoute
        AEntry --> JoinRoute
    end

    subgraph "Express Service B"
        direction TB
        BEntry["server/index.js"]:::backend
        SendEmail["server/api/sendEmail.js"]:::backend
        BEntry --> SendEmail
    end

    %% External service
    EmailService["External Email Service"]:::external

    %% SPA to backend interactions
    ContactUsPage -->|"POST /contactUs"| ContactRoute
    Team -->|"POST /joinTeam"| JoinRoute
    SPA -->|"POST /api/sendEmail"| SendEmail

    %% Service A to Service B/email
    ContactRoute -->|"forwards data"| SendEmail
    JoinRoute -->|"forwards data"| SendEmail
    SendEmail -->|"send email via SMTP/API"| EmailService

    %% Click events
    click index "https://github.com/gungun2004/streetsofsirsa/blob/main/src/index.js"
    click App "https://github.com/gungun2004/streetsofsirsa/blob/main/src/App.js"
    click ThemeContext "https://github.com/gungun2004/streetsofsirsa/blob/main/src/context/ThemeContext.js"
    click GlobalCSS "https://github.com/gungun2004/streetsofsirsa/blob/main/src/styles/global.css"
    click Home "https://github.com/gungun2004/streetsofsirsa/blob/main/src/pages/Home/Home.js"
    click Services "https://github.com/gungun2004/streetsofsirsa/blob/main/src/pages/Services/Services.js"
    click ContactUsPage "https://github.com/gungun2004/streetsofsirsa/blob/main/src/pages/ContactUs/ContactUs.js"
    click Team "https://github.com/gungun2004/streetsofsirsa/blob/main/src/pages/Team/Team.js"
    click Reviews "https://github.com/gungun2004/streetsofsirsa/blob/main/src/pages/Reviews/Reviews.js"
    click Journey "https://github.com/gungun2004/streetsofsirsa/blob/main/src/pages/OurJourney/OurJourney.js"
    click Navbar "https://github.com/gungun2004/streetsofsirsa/blob/main/src/components/Navbar/Navbar.js"
    click Footer "https://github.com/gungun2004/streetsofsirsa/blob/main/src/components/Footer/Footer.js"
    click Carousel "https://github.com/gungun2004/streetsofsirsa/blob/main/src/components/Carousel/Carousel.js"
    click HomeCarousel "https://github.com/gungun2004/streetsofsirsa/blob/main/src/components/Carousel/HomeCarousel.js"
    click Card "https://github.com/gungun2004/streetsofsirsa/blob/main/src/components/Card/Card.js"
    click ChatIcon "https://github.com/gungun2004/streetsofsirsa/blob/main/src/components/ChatIcon/ChatIcon.js"
    click HorizontalScroll "https://github.com/gungun2004/streetsofsirsa/blob/main/src/components/HorizontalScroll/HorizontalScroll.js"
    click ThemeSwitcher "https://github.com/gungun2004/streetsofsirsa/blob/main/src/components/ThemeSwitcher/ThemeSwitcher.js"
    click AEntry "https://github.com/gungun2004/streetsofsirsa/blob/main/backend/server.js"
    click ContactRoute "https://github.com/gungun2004/streetsofsirsa/blob/main/backend/routes/contactUs.js"
    click JoinRoute "https://github.com/gungun2004/streetsofsirsa/blob/main/backend/routes/joinTeam.js"
    click EmailTest "https://github.com/gungun2004/streetsofsirsa/blob/main/backend/test-email.js"
    click BEntry "https://github.com/gungun2004/streetsofsirsa/blob/main/server/index.js"
    click SendEmail "https://github.com/gungun2004/streetsofsirsa/blob/main/server/api/sendEmail.js"

    %% Styles
    classDef frontend fill:#d0e8ff,stroke:#025bff,stroke-width:1px
    classDef backend fill:#d4edda,stroke:#28a745,stroke-width:1px
    classDef external fill:#ffe5b4,stroke:#ff8c00,stroke-width:1px
    classDef user fill:#f0f0f0,stroke:#888,stroke-width:1px
```
