# omkar-murala/flash architecture

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

- Interactive diagram: https://gitdiagram.com/omkar-murala/flash
- Repository: https://github.com/omkar-murala/flash

## Overview

##### Project type and purpose
- This is a full-stack, server-rendered React web application built with Next.js (App Router).
- It exposes static/SSG pages (home, contact), dynamic client-side interactions (scroll effects, brand carousel), and a single serverless API endpoint (/api/form) to process contact-form submissions via an email utility.

##### File structure
- Top-level configuration and build files:
– next.config.mjs, tsconfig.json, tailwind.config.ts, postcss.config.mjs
- Public/static assets:
– public/
- Source code under src/:
– app/: Next.js “app” directory with page.tsx (home), contactus/page.tsx, layout.tsx, globals.css, and nested API route at app/api/form/route.ts
– components/: UI building blocks (Navbar, Brandscroll, Scroll effect)
– util/: helper function mail.ts used by the API route

##### Key insights from README
- Bootstrapped with Create-Next-App
- Uses next/font for custom fonts
- Deployed on Vercel (serverless functions for API routes + static page hosting)

##### Main components & interactions
a. Browser (Client)
b. CDN / Edge Cache (e.g., Vercel’s global CDN)
c. Next.js Application
– Static/SSG pages served from edge cache
– SSR/Serverless functions for dynamic page rendering (if any)
– API Route serverless function at /api/form
– React components in the “app/” and “components/” folders
d. Styling Pipeline
– Tailwind CSS + PostCSS during build
e. Utility Layer
– mail.ts: encapsulates email-provider integration (SMTP/SendGrid/etc.)
f. External Service
– Email Service Provider

##### Architectural patterns & design principles
- Separation of concerns: UI components (components/), page layouts (app/), business logic (util/)
- Next.js App Router pattern: file-based routing for pages and API routes
- Serverless architecture for backend/API logic
- CDN caching for static assets and SSG pages

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients and CDN
    Browser["Client Browser"]:::infra
    CDN["CDN / Edge Cache"]:::infra
    Browser -->|"HTTP GET/POST"| CDN

    %% Static Assets to CDN
    StaticAssets["public/ (Static Assets)"]:::infra
    StaticAssets --> CDN
    click StaticAssets "https://github.com/omkar-murala/flash/tree/main/public/"

    %% Main Application
    subgraph "Next.js Application (Vercel Serverless)"
        direction TB

        subgraph "UI Layer" 
            direction TB
            HomePage["Home Page\n(src/app/page.tsx)"]:::frontend
            ContactPage["Contact Us Page\n(src/app/contactus/page.tsx)"]:::frontend
            Layout["App Layout\n(src/app/layout.tsx)"]:::frontend
            Globals["Global Styles\n(src/app/globals.css)"]:::frontend
            Navbar["Navbar Component"]:::frontend
            Brand["Brand Carousel"]:::frontend
            ScrollEffect["Scroll Effect"]:::frontend

            HomePage --> Layout
            ContactPage --> Layout
            Layout --> Globals
            Layout --> Navbar
            Layout --> Brand
            Layout --> ScrollEffect

            click HomePage "https://github.com/omkar-murala/flash/blob/main/src/app/page.tsx"
            click ContactPage "https://github.com/omkar-murala/flash/blob/main/src/app/contactus/page.tsx"
            click Layout "https://github.com/omkar-murala/flash/blob/main/src/app/layout.tsx"
            click Globals "https://github.com/omkar-murala/flash/blob/main/src/app/globals.css"
            click Navbar "https://github.com/omkar-murala/flash/blob/main/src/components/navbar/Navbar.tsx"
            click Brand "https://github.com/omkar-murala/flash/blob/main/src/components/Brandscroll/Brand.tsx"
            click ScrollEffect "https://github.com/omkar-murala/flash/blob/main/src/components/scrolleffect/Scroll.tsx"
        end

        subgraph "API Layer"
            direction TB
            APIRoute["API Route\n/api/form"]:::backend
            click APIRoute "https://github.com/omkar-murala/flash/blob/main/src/app/api/form/route.ts"
        end

        subgraph "Styling Pipeline"
            direction TB
            NextConfig["next.config.mjs"]:::infra
            Tailwind["tailwind.config.ts"]:::infra
            PostCSS["postcss.config.mjs"]:::infra

            click NextConfig "https://github.com/omkar-murala/flash/blob/main/next.config.mjs"
            click Tailwind "https://github.com/omkar-murala/flash/blob/main/tailwind.config.ts"
            click PostCSS "https://github.com/omkar-murala/flash/blob/main/postcss.config.mjs"
        end

        %% Internal arrows
        CDN -->|"Serve Pages"| HomePage
        CDN -->|"Serve Pages"| ContactPage
        CDN -->|"Invoke Serverless"| APIRoute
        APIRoute -->|"uses"| MailUtil
    end

    %% Utility and External
    MailUtil["Email Utility\nmail.ts"]:::util
    click MailUtil "https://github.com/omkar-murala/flash/blob/main/src/util/mail.ts"
    ExternalEmail["External Email Service"]:::util

    MailUtil -->|"SMTP/SendGrid"| ExternalEmail

    classDef frontend fill:#add8e6,stroke:#000,stroke-width:1px
    classDef backend fill:#90ee90,stroke:#000,stroke-width:1px
    classDef util fill:#d3d3d3,stroke:#000,stroke-width:1px
    classDef infra fill:#f0e68c,stroke:#000,stroke-width:1px
```
