# vinayak-gcc/mclaren architecture

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

- Interactive diagram: https://gitdiagram.com/vinayak-gcc/mclaren
- Repository: https://github.com/vinayak-gcc/mclaren

## Overview

##### Main Components

Frontend Layer:
- React Application (Client-Side)
- Pages (Homepage, Cart, Checkout, Login, Register, Order)
- Components (Reusable UI elements)
- Redux Store (State Management)
- Car Slice
- User Slice
- Hooks (Custom hooks)
- UI Libraries (Tailwind CSS, Headless UI)

Backend Services:
- Firebase Authentication
- EmailJS Service
- Redux Persist Storage

**[Client Layer]**
- ↕
**[State Management Layer]**
- ↕
**[External Services Layer]**

##### Detailed Component Breakdown

Client Layer:
- Them to shared components (src/components/*)
- Routing relationships between pages

State Management Layer:
- Redux store (src/app/store.ts)
- Two main slices:
- Car slice (carSlice.ts)
- User slice (userSlice.ts)
- Redux Persist connection

External Services Layer:
- Firebase Authentication
- EmailJS Service
- Local Storage (Redux Persist)

##### Data Flow Representation

- User authentication flow with Firebase
- Cart data flow through Redux
- Email confirmation flow with EmailJS
- Order processing flow
- PDF generation for order screenshots

##### Specific Implementation Details

Technical annotations for:
- TypeScript implementation
- Tailwind CSS styling
- Redux Persist configuration
- Firebase integration points
- EmailJS integration points

##### Component Relationships

How:
- Cart components interact with Redux store
- Authentication status affects available routes
- Order processing connects to multiple services
- Components share common state

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        App["App Component"]
        
        subgraph Pages
            Home["Homepage"]
            Cart["Cart Page"]
            Checkout["Checkout Page"]
            Login["Login Page"]
            Register["Register Page"]
            Order["Order Page"]
        end
        
        subgraph Components
            Nav["Navigation"]
            CarDetail["Car Details"]
            CheckoutForm["Checkout Form"]
            OrderSum["Order Summary"]
        end
        
        subgraph Styling
            TW["Tailwind CSS"]
            HeadlessUI["Headless UI"]
            CSS["Application CSS"]
        end
    end
    
    subgraph "State Management"
        Store["Redux Store"]
        CarSlice["Car Slice"]
        UserSlice["User Slice"]
        ReduxPersist["Redux Persist"]
        CustomHooks["Custom Hooks"]
        StaticData["Cars Data"]
    end
    
    subgraph "External Services"
        Firebase["Firebase Auth"]
        EmailJS["EmailJS Service"]
        LocalStorage["Local Storage"]
    end
    
    %% Component Relationships
    App --> Pages
    App --> Components
    Pages --> Components
    Components --> Store
    Store --> CarSlice
    Store --> UserSlice
    Store --> ReduxPersist
    ReduxPersist --> LocalStorage
    Components --> Firebase
    Components --> EmailJS
    
    %% Styling Relationships
    App --> Styling
    Components --> Styling
    Pages --> Styling
    
    %% Data Flow
    StaticData --> CarSlice
    CustomHooks --> Store
    
    %% Click Events
    click App "https://github.com/vinayak-gcc/McLaren/blob/main/src/App.tsx"
    click Home "https://github.com/vinayak-gcc/McLaren/blob/main/src/pages/HomePage.tsx"
    click Cart "https://github.com/vinayak-gcc/McLaren/blob/main/src/pages/Cart.tsx"
    click Checkout "https://github.com/vinayak-gcc/McLaren/blob/main/src/pages/Checkout.tsx"
    click Login "https://github.com/vinayak-gcc/McLaren/blob/main/src/pages/Login.tsx"
    click Register "https://github.com/vinayak-gcc/McLaren/blob/main/src/pages/Register.tsx"
    click Order "https://github.com/vinayak-gcc/McLaren/blob/main/src/pages/Order.tsx"
    click Nav "https://github.com/vinayak-gcc/McLaren/blob/main/src/components/Navbar.tsx"
    click CarDetail "https://github.com/vinayak-gcc/McLaren/blob/main/src/components/CarDetail.tsx"
    click CheckoutForm "https://github.com/vinayak-gcc/McLaren/blob/main/src/components/CheckOutForm.tsx"
    click OrderSum "https://github.com/vinayak-gcc/McLaren/blob/main/src/components/OrderSummary.tsx"
    click Store "https://github.com/vinayak-gcc/McLaren/blob/main/src/app/store.ts"
    click CarSlice "https://github.com/vinayak-gcc/McLaren/blob/main/src/features/Car/carSlice.ts"
    click UserSlice "https://github.com/vinayak-gcc/McLaren/blob/main/src/features/User/userSlice.ts"
    click CustomHooks "https://github.com/vinayak-gcc/McLaren/blob/main/src/hooks/useReducerState.ts"
    click StaticData "https://github.com/vinayak-gcc/McLaren/blob/main/src/carsData.ts"
    click TW "https://github.com/vinayak-gcc/McLaren/blob/main/tailwind.config.js"
    click CSS "https://github.com/vinayak-gcc/McLaren/blob/main/src/index.css"
    
    classDef page fill:#2196F3,color:white
    classDef component fill:#42A5F5,color:white
    classDef state fill:#4CAF50,color:white
    classDef external fill:#FF9800,color:white
    classDef styling fill:#9E9E9E,color:white
    
    class Home,Cart,Checkout,Login,Register,Order page
    class Nav,CarDetail,CheckoutForm,OrderSum component
    class Store,CarSlice,UserSlice,ReduxPersist,CustomHooks,StaticData state
    class Firebase,EmailJS,LocalStorage external
    class TW,HeadlessUI,CSS styling
```
