# mohdahsanrazakhan/lawcodes architecture

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

- Interactive diagram: https://gitdiagram.com/mohdahsanrazakhan/lawcodes
- Repository: https://github.com/mohdahsanrazakhan/lawcodes

## Overview

##### Project type and purpose
- This is a React single‐page application (SPA) scaffolded with Vite.
- It’s primarily a content site/blog that fetches posts via the Google Blogger API, serves static JSON “laws” data, and offers client‐side features like bookmarks, history, theme toggling, and full-text search.

##### File structure
- Root files:
- index.html → SPA entry point
- generate-sitemap.js → custom script to regenerate sitemap.xml
- postcss.config.mjs, tailwind.config.js → CSS pipeline
- vite.config.js → build/dev server config
- public/ → purely static assets (favicon, site.webmanifest, robots.txt, prebuilt sitemap.xml)
- src/
- main.jsx & App.jsx → application bootstrap & router setup
- api/blogger.js → API client for Google Blogger
- data/*.json → static JSON datasets for law lookup
- utils/ → bookmark/history management (localStorage), search logic
- context/ThemeContext.jsx → global light/dark mode state
- components/ → reusable UI widgets (Navbar, Footer, Spinner, ThemeToggle, SearchLaw, etc.)
- pages/ → route targets (BlogPosts, Detail, Bookmark, History, About, Terms, etc.)

##### README for additional insights
- Confirms minimal React + Vite setup with hot-module replacement
- Suggests optional ESLint/TypeScript enhancements

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build & Deploy
    subgraph "Build & Deploy"
        direction TB
        ViteBuilder["Vite Dev Server / Builder"]:::build
        PostCSS["postcss.config.mjs"]:::build
        Tailwind["tailwind.config.js"]:::build
        ViteConfig["vite.config.js"]:::build
        SitemapGen["generate-sitemap.js"]:::build
        PublicAssets["Public Assets\n(public/)"]:::build
        IndexHTML["index.html"]:::build
        Bundles["JS/CSS Bundles"]:::build
        WebServer["Web Server / CDN"]:::external
    end

    %% Build Flow
    ViteBuilder -->|bundles| Bundles
    PostCSS -->|processes CSS| Bundles
    Tailwind -->|applies styles| Bundles
    ViteConfig -->|configures build| ViteBuilder
    SitemapGen -->|generates sitemap.xml| PublicAssets
    Bundles -->|deploy| WebServer
    IndexHTML -->|deploy| WebServer
    PublicAssets -->|serve| WebServer

    %% Runtime in Browser
    WebServer -->|serves| Browser["Client Browser"]:::runtime

    subgraph "React SPA" 
        direction TB
        Entry["Application Bootstrap\n(src/main.jsx)"]:::runtime
        Router["Router Setup\n(src/App.jsx)"]:::runtime
        subgraph "Context & Utils"
            direction TB
            ThemeCtx["Theme Context\n(src/context/ThemeContext.jsx)"]:::runtime
            BookmarksUtil["Bookmarks Util\n(src/utils/bookmarks.js)"]:::storage
            HistoryUtil["History Util\n(src/utils/history.js)"]:::storage
            SearchUtil["Search Logic\n(src/utils/search.js)"]:::runtime
        end
        subgraph "UI Components"
            direction TB
            Navbar["Navbar"]:::component
            Footer["Footer"]:::component
            Spinner["Spinner"]:::component
            ThemeToggle["ThemeToggle"]:::component
            SearchLawComp["SearchLaw"]:::component
            SinglePost["SinglePost"]:::component
            PageTracker["PageTracker"]:::component
            NotFound["NotFound"]:::component
        end
        subgraph "Pages"
            direction TB
            BlogPosts["BlogPosts"]:::page
            Detail["Detail"]:::page
            BookmarkPage["Bookmark"]:::page
            HistoryPage["History"]:::page
            About["About"]:::page
            Contact["Contact"]:::page
            Disclaimer["Disclaimer"]:::page
            PrivacyPolicy["PrivacyPolicy"]:::page
            Terms["TermsAndConditions"]:::page
        end
        Entry --> Router
        Router --> ThemeCtx
        Router --> BookmarksUtil
        Router --> HistoryUtil
        Router --> SearchUtil
        Router --> Navbar
        Router --> Footer
        Router --> Spinner
        Router --> ThemeToggle
        Router --> SearchLawComp
        Router --> SinglePost
        Router --> PageTracker
        Router --> NotFound
        Router --> BlogPosts
        Router --> Detail
        Router --> BookmarkPage
        Router --> HistoryPage
        Router --> About
        Router --> Contact
        Router --> Disclaimer
        Router --> PrivacyPolicy
        Router --> Terms
    end

    %% Data & External Services
    subgraph "Data & Services"
        direction TB
        BloggerAPI["Google Blogger API"]:::external
        StaticJSON["Static JSON Datasets"]:::data
        LocalStore["Browser Local Storage"]:::storage
    end

    %% Runtime Interactions
    SearchLawComp -->|loads| StaticJSON
    BlogPosts -->|fetches posts via| BloggerAPI
    Detail -->|fetches post via| BloggerAPI
    SearchUtil -->|reads| StaticJSON
    BookmarksUtil -->|read/write| LocalStore
    HistoryUtil -->|read/write| LocalStore

    %% Click Events
    click IndexHTML "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/index.html"
    click Entry "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/main.jsx"
    click Router "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/App.jsx"
    click ViteConfig "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/vite.config.js"
    click PostCSS "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/postcss.config.mjs"
    click Tailwind "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/tailwind.config.js"
    click SitemapGen "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/generate-sitemap.js"
    click PublicAssets "https://github.com/mohdahsanrazakhan/lawcodes/tree/main/public/"
    click BloggerAPI "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/api/blogger.js"
    click StaticJSON "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/data/crpc.json"
    click StaticJSON "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/data/iea.json"
    click StaticJSON "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/data/ipc.json"
    click ThemeCtx "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/context/ThemeContext.jsx"
    click BookmarksUtil "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/utils/bookmarks.js"
    click HistoryUtil "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/utils/history.js"
    click SearchUtil "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/utils/search.js"
    click Navbar "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/components/Navbar.jsx"
    click Footer "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/components/Footer.jsx"
    click Spinner "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/components/Spinner.jsx"
    click ThemeToggle "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/components/ThemeToggle.jsx"
    click SearchLawComp "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/components/SearchLaw.jsx"
    click SinglePost "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/components/SinglePost.jsx"
    click PageTracker "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/components/PageTracker.jsx"
    click NotFound "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/components/NotFound.jsx"
    click BlogPosts "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/pages/BlogPosts.jsx"
    click Detail "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/pages/Detail.jsx"
    click BookmarkPage "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/pages/Bookmark.jsx"
    click HistoryPage "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/pages/History.jsx"
    click About "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/pages/About.jsx"
    click Contact "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/pages/Contact.jsx"
    click Disclaimer "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/pages/Disclaimer.jsx"
    click PrivacyPolicy "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/pages/PrivacyPolicy.jsx"
    click Terms "https://github.com/mohdahsanrazakhan/lawcodes/blob/main/src/pages/TermsAndConditions.jsx"

    %% Styles
    classDef build fill:#f9f,stroke:#333,stroke-width:1px
    classDef runtime fill:#bbf,stroke:#333,stroke-width:1px
    classDef component fill:#bfb,stroke:#333,stroke-width:1px
    classDef page fill:#dfd,stroke:#333,stroke-width:1px
    classDef external fill:#ffd,stroke:#333,stroke-width:1px
    classDef data fill:#fbf,stroke:#333,stroke-width:1px
    classDef storage fill:#ffb,stroke:#333,stroke-width:1px
```
