# sumitsinghraghuwanshi1245/demigod architecture

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

- Interactive diagram: https://gitdiagram.com/sumitsinghraghuwanshi1245/demigod
- Repository: https://github.com/sumitsinghraghuwanshi1245/demigod

## Overview

##### Project Type and Purpose
- This is a full-stack web application built with Next.js (App Router) that delivers multiple event-driven landing pages (e.g., wedding, corporate, media & marketing, checkout, thank-you pages). It uses SSR/SSG and client-side React components (AOS, React-Slick, Leaflet maps, etc.) to render dynamic UIs, and is intended to be deployed on Vercel (or any Node server) with CDN caching static assets.

##### File Structure Analysis
- Root Level
- Configuration: .env, next.config.js, ecosystem.config.js (PM2)
- Package management: package.json, package-lock.json, bun.lockb
- CI/CD/Deployment: .gitignore, README.md
- public/
- Static assets served directly: images, videos, PDFs, AVIFs
- src/app/
- App router layout (layout.js, globals.css)
- Route directories for each page: about-us/, checkout/, contact-us/, landingpage/, media&marketing/, wedding-planners/, etc.
- src/app/component/
- Reusable React components organized by domain (homepage, events, corporate, weddingpage, mnm, onboarding, common header/footer, utils, context)
- src/context/
- Global React Context (AppContext.js) for state management
- Build/Dev tools
- jsconfig.json / tsconfig.json (path aliases, TS support)
- .eslintrc.json (linting)

##### Architectural Patterns & Key Technologies
- Next.js App Router: File-system routing, SSR/SSG at route-level
- Client-side hydration: React components, dynamic imports (AOSInit, Leaflet map, sliders)
- Global State: React Context (AppContext)
- Static Asset Delivery: public/ directory + Vercel CDN
- External Services & Libraries: Leaflet for maps, React-Slick for carousels, AOS for animations
- Deployment: Vercel Serverless Functions or Node/PM2 via ecosystem.config.js

##### Main System Components
A. End User Browser – sends HTTP requests, executes client-side React
B. CDN (e.g., Vercel Edge) – caches static assets under public/ and pre-rendered HTML
C. Next.js Serverless/Node Server –
1. App Router handles route requests
2. SSR/SSG pipelines render HTML and JSON payloads
3. API routes (if any) or other server logic
D. React Runtime – hydrates components, uses Context for state
E. External Libraries/Services – Leaflet map tile servers, analytics, third-party scripts

##### Relationships & Data Flow
1. Browser → CDN
- Requests page URL → CDN returns cached HTML/static if available
2. Browser → Next.js Server
- On cache miss or dynamic route → Serverless function executes, SSR/SSG renders HTML + initial state JSON
3. Browser ←→ React Client
- Hydration: React mounts components in client
- Dynamic loads: fetch additional data via fetch() calls (to API routes or external services)
4. React Context
- Provides global state across components
5. Static Assets
- public/ served via CDN (images, videos)

##### Important Architectural Patterns
- SSR vs SSG: indicate which routes are pre-rendered at build (e.g., landing pages) vs those rendered per-request
- State Management: highlight Context usage for cross-page state (e.g., checkout steps)

##### Elements to Enforce Detail
- Clear labels (component names, file paths for key modules: layout.js, AppContext.js)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    subgraph "User Layer"
        Browser["End User Browser"]:::compute
    end

    %% Edge/Cache Layer
    subgraph "Edge/Cache Layer"
        CDN["CDN / Edge Cache"]:::storage
    end

    %% Server Layer
    subgraph "Server Layer"
        subgraph "Next.js Server"
            AppRouter["App Router & Layout"]:::compute
            NextConfig["next.config.js"]:::compute
            Ecosystem["ecosystem.config.js"]:::compute
            subgraph "Routing & SSR/SSG"
                AU["About Us Page"]:::compute
                CO["Checkout Page"]:::compute
                CU["Contact Us Page"]:::compute
                LP["Landing Page"]:::compute
                MM["Media & Marketing Page"]:::compute
                WP["Wedding Planners Page"]:::compute
                TY["Thank You Page"]:::compute
                SI["Sign-in Page"]:::compute
            end
        end
    end

    %% Client Layer
    subgraph "Client Layer"
        ReactClient["React Runtime & Hydration"]:::compute
        Context["React Context (AppContext)"]:::compute
    end

    %% Static Assets
    subgraph "Static Assets"
        Assets["public/ Static Assets"]:::assets
    end

    %% External Services
    subgraph "External Services"
        Leaflet["Leaflet Tile Server"]:::external
        Analytics["3rd-party Analytics"]:::external
    end

    %% Connections
    Browser -->|"HTTPS Request"| CDN
    CDN -->|"Cache Hit / Static HTML"| Browser
    CDN -->|"Cache Miss"| AppRouter
    AppRouter -->|"Render via SSR/SSG"| Browser
    Browser -->|"Hydrate"| ReactClient
    ReactClient -->|"Init Context"| Context
    ReactClient -->|"fetch dynamic data (API)"| AppRouter
    ReactClient -->|"fetch tiles"| Leaflet
    ReactClient -->|"load analytics scripts"| Analytics
    Browser -->|"GET assets"| Assets
    Assets -->|"served via CDN"| CDN

    %% Click Events
    click AppRouter "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/src/app/layout.js"
    click AU "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/src/app/about-us/page.jsx"
    click CO "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/src/app/checkout/page.jsx"
    click CU "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/src/app/contact-us/page.jsx"
    click LP "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/src/app/landingpage/page.jsx"
    click MM "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/src/app/media&marketing/page.jsx"
    click WP "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/src/app/wedding-planners/page.jsx"
    click TY "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/src/app/thankyou/page.jsx"
    click SI "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/src/app/signin/page.jsx"
    click Context "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/src/context/AppContext.js"
    click Assets "https://github.com/sumitsinghraghuwanshi1245/demigod/tree/main-dev/public/"
    click NextConfig "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/next.config.js"
    click Ecosystem "https://github.com/sumitsinghraghuwanshi1245/demigod/blob/main-dev/ecosystem.config.js"

    %% Styles
    classDef compute fill:#cce5ff,stroke:#004085,color:#004085;
    classDef storage fill:#d4edda,stroke:#155724,color:#155724;
    classDef external fill:#fff3cd,stroke:#856404,color:#856404;
    classDef assets fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
```
