# misaelmamangun/sm-exam architecture

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

- Interactive diagram: https://gitdiagram.com/misaelmamangun/sm-exam
- Repository: https://github.com/misaelmamangun/sm-exam

## Overview

##### Project type and purpose
- This is a single-page, front-end web application (React + TypeScript) built and served by Vite.
- It has no backend code in this repo; it’s purely client-side. The primary purpose is to compile, bundle, and deliver a React SPA with HMR (Hot Module Replacement).

##### File structure
- Top-level config files:
- vite.config.ts (build & dev server config)
- tsconfig.*.json (TypeScript settings)
- eslint.config.js (lint rules)
- tailwind.config.js / postcss.config.js (CSS pipeline)
- Public assets:
- public/index.html (app shell)
- src/assets (images, static files)
- Source code:
- src/main.tsx → application entry point
- src/App.tsx → root React component
- src/components → UI building blocks (Modal, Pagination, SearchBar, TableList)
- src/helpers → utility modules (currency formatter)
- src/schemas → static JSON schema (e.g., products.json)

##### Extract insights from README
- Emphasizes minimal Vite+React setup with HMR and ESLint.
- Mentions plugin options (@vitejs/plugin-react vs. swc).
- Encourages type-aware linting for production.

##### Main components & their interactions
a. Components:
- Developer’s workstation: writes TSX, CSS, JSON, config.
- Build tool (Vite with plugins) for dev and production builds.
- Browser runtime: loads index.html → JS/CSS bundles → React app.
- Static asset server: serves public files & compiled bundles.
- Tailwind/PostCSS pipeline: processes CSS at build time.
b. Relationships & data flow:
1. Developer commits code → `npm run dev` or `npm run build`.
2. Vite reads vite.config.ts, tsconfig, PostCSS/Tailwind configs →
- In dev: spins up local server with HMR.
- In prod: outputs optimized JS/CSS bundles + assets.
3. Browser fetches index.html → loads bundles → React runtime mounts `<App />`.
4. React components use helpers & schemas to render UI.
c. Architectural patterns & principles:
- Modular component hierarchy (App → components/*).
- Separation of concerns: UI vs. utilities vs. static schemas.
- Build pipeline abstraction (Vite plugins handle TSX, CSS transformations).
d. Key technologies: React 18, TypeScript, Vite, Tailwind CSS, PostCSS, ESLint.

##### Detail without overcomplicating
- Don’t hesitate to break out sub-components (e.g., Tailwind → PostCSS → CSS).
- Both dev (HMR) and prod (minification, tree-shaking) flows.
- Every config file only if it influences the build/runtime (e.g., vite.config.ts, tailwind.config.js).

- Clearly delineates development vs. production workflows
- Highlights major build-time and runtime components
- Illustrates how React components, utilities, and static schemas fit into the client application

## Diagram (Mermaid)

```mermaid
flowchart TB
    Developer["Developer"]:::dev
    subgraph "Build & Dev Server"
        Vite["Vite Build & Dev Server"]:::build
        TSConf["TypeScript Configuration"]:::config
        ESLint["ESLint Configuration"]:::config
        PostCSS["Tailwind/PostCSS Pipeline"]:::build
        NPM["Package Manifests"]:::config
    end

    Developer --> Vite
    TSConf --> Vite
    ESLint --> Vite
    PostCSS --> Vite
    NPM --> Vite

    subgraph "Modes"
        Dev["Development Mode (HMR)"]:::build
        Prod["Production Mode (Bundles)"]:::build
    end

    Vite --> Dev
    Vite --> Prod

    subgraph "Static Asset Server"
        Assets["Public Files & Bundles"]:::store
    end

    Dev --> Assets
    Prod --> Assets

    Assets --> Browser

    subgraph "Browser (Runtime)"
        HTML["index.html"]:::browser
        Main["main.tsx"]:::browser
        App["React Root (App.tsx)"]:::browser
        CSS["Global Styles (index.css)"]:::browser
        Env["Vite Env Types (vite-env.d.ts)"]:::browser
        subgraph "UI Component Tree"
            Helpers["Utilities (currency.ts)"]:::browser
            Schemas["Schemas (products.json)"]:::browser
            Components["Components Directory"]:::browser
            Modal["Modal"]:::browser
            Pagination["Pagination"]:::browser
            SearchBar["SearchBar"]:::browser
            TableList["TableList"]:::browser
        end
        HTML --> Main
        Main --> App
        App --> Helpers
        App --> Schemas
        App --> Components
        App --> CSS
        App --> Env
        Components --> Modal
        Components --> Pagination
        Components --> SearchBar
        Components --> TableList
    end

    classDef dev fill:#ccf,stroke:#333;
    classDef build fill:#bbf,stroke:#333;
    classDef config fill:#fdb,stroke:#333;
    classDef store fill:#f96,stroke:#333;
    classDef browser fill:#cfc,stroke:#333;

    click Vite "https://github.com/misaelmamangun/sm-exam/blob/main/vite.config.ts"
    click TSConf "https://github.com/misaelmamangun/sm-exam/blob/main/tsconfig.json"
    click TSConf "https://github.com/misaelmamangun/sm-exam/blob/main/tsconfig.app.json"
    click TSConf "https://github.com/misaelmamangun/sm-exam/blob/main/tsconfig.node.json"
    click ESLint "https://github.com/misaelmamangun/sm-exam/blob/main/eslint.config.js"
    click PostCSS "https://github.com/misaelmamangun/sm-exam/blob/main/tailwind.config.js"
    click PostCSS "https://github.com/misaelmamangun/sm-exam/blob/main/postcss.config.js"
    click NPM "https://github.com/misaelmamangun/sm-exam/blob/main/package.json"
    click NPM "https://github.com/misaelmamangun/sm-exam/blob/main/package-lock.json"
    click Assets "https://github.com/misaelmamangun/sm-exam/tree/main/public/"
    click HTML "https://github.com/misaelmamangun/sm-exam/blob/main/public/index.html"
    click Main "https://github.com/misaelmamangun/sm-exam/blob/main/src/main.tsx"
    click App "https://github.com/misaelmamangun/sm-exam/blob/main/src/App.tsx"
    click CSS "https://github.com/misaelmamangun/sm-exam/blob/main/src/index.css"
    click Env "https://github.com/misaelmamangun/sm-exam/blob/main/src/vite-env.d.ts"
    click Helpers "https://github.com/misaelmamangun/sm-exam/blob/main/src/helpers/currency.ts"
    click Schemas "https://github.com/misaelmamangun/sm-exam/blob/main/src/schemas/products.json"
    click Components "https://github.com/misaelmamangun/sm-exam/tree/main/src/components/"
    click Modal "https://github.com/misaelmamangun/sm-exam/blob/main/src/components/Modal.tsx"
    click Pagination "https://github.com/misaelmamangun/sm-exam/blob/main/src/components/Pagination.tsx"
    click SearchBar "https://github.com/misaelmamangun/sm-exam/blob/main/src/components/SearchBar.tsx"
    click TableList "https://github.com/misaelmamangun/sm-exam/blob/main/src/components/TableList.tsx"
```
