# piyushh2/expense-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/piyushh2/expense-management-system
- Repository: https://github.com/piyushh2/expense-management-system

## Overview

##### Project type and purpose
- This is a SharePoint Framework (SPFx) client-side web-part project named “ems.” It uses TypeScript, React, SCSS, and the SPFx toolchain (Gulp, Webpack) to build a deployable web part for SharePoint Online and Microsoft Teams.

##### File structure
- Top-level config folder: SPFx build and deployment settings (`config.json`, `serve.json`, `sass.json`, `package-solution.json`, Azure Storage deploy manifest).
- `gulpfile.js`: orchestrates tasks like building, packaging, and serving.
- `src/index.ts`: entry point linking SPFx to your web parts.
- `src/webparts/ems`:
- `EmsWebPart.manifest.json`: SPFx metadata (title, description, supported hosts).
- `EmsWebPart.ts`: TypeScript class that bootstraps your React component.
- `components/`: React components (Dashboard, Table, Navbar, etc.), styling (`.scss`), and localization (`loc/en-us.js`).
- Standard Node artifacts (`package.json`, `.eslintrc.js`, `tsconfig.json`).

##### README for additional insights
- Confirms SPFx version 1.20.0.
- Mentions building and serving locally (`npm install`, `gulp serve`).
- Intended use in SharePoint and Teams, likely calling Microsoft Graph or SharePoint REST.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer Environment
    subgraph "Developer Machine" 
        direction TB
        DevTools["Code Editor & Node.js/SPFx Toolchain"]:::dev
        Config["SPFx Build & Deployment Configuration"]:::config
        Gulpfile["Gulp Build Orchestrator"]:::config
        DevTools --> Config
        DevTools --> Gulpfile
    end

    %% Build Pipeline
    subgraph "Build Pipeline" 
        direction TB
        GulpTasks["Gulp Tasks"]:::build
        Webpack["Webpack Bundling"]:::build
        TS_SCSS["TypeScript & SCSS Compilation"]:::build
        GulpTasks --> Webpack --> TS_SCSS --> Package
        TS_SCSS --> Package["Package (.sppkg) & Assets"]:::build
    end

    %% Hosting
    subgraph "CDN / Azure Storage" 
        direction TB
        CDN["Static Asset Host"]:::cdn
    end

    %% SharePoint Online Host
    subgraph "SharePoint Online Page" 
        direction TB
        SPPage["SPFx Framework Loader"]:::runtime
    end

    %% Teams Host
    subgraph "Microsoft Teams" 
        direction TB
        TeamsApp["Teams App Manifest"]:::runtime
    end

    %% Client Browser Runtime
    subgraph "Client Browser" 
        direction TB
        Browser["Browser"]:::runtime
        SPFX["SPFx Web Part (Ems)"]:::runtime
        ReactRoot["React Ems Component"]:::components
        SPFX --> ReactRoot
        ReactRoot --> Navbar
        ReactRoot --> Dashboard
        ReactRoot --> Table
        ReactRoot --> Approvals
        ReactRoot --> ApprovalHistory
        ReactRoot --> Approved
        ReactRoot --> New
        ReactRoot --> Request
        ReactRoot --> Footer
    end

    %% External Services
    subgraph "External Services" 
        direction TB
        SPREST["SharePoint REST API"]:::service
        MSGraph["Microsoft Graph"]:::service
        ReactRoot --> SPREST
        ReactRoot --> MSGraph
    end

    %% Flows
    DevTools -->|runs gulp serve / bundle| GulpTasks
    Package -->|uploads to| CDN
    Browser -->|requests assets| CDN
    SPPage -->|initializes web part| Browser
    TeamsApp -->|references assets| CDN
    Browser -->|hosts via| TeamsApp

    %% React Components
    subgraph "React Component Hierarchy" 
        direction TB
        Navbar["Navbar"]:::components
        Dashboard["Dashboard"]:::components
        Table["Table"]:::components
        Approvals["Approvals"]:::components
        ApprovalHistory["ApprovalHistory"]:::components
        Approved["Approved"]:::components
        New["New"]:::components
        Request["Request"]:::components
        Footer["Footer"]:::components
    end

    %% Click Events
    click Config "https://github.com/piyushh2/expense-management-system/tree/main/config/"
    click Gulpfile "https://github.com/piyushh2/expense-management-system/blob/main/gulpfile.js"
    click Config "https://github.com/piyushh2/expense-management-system/blob/main/config/package-solution.json"
    click Config "https://github.com/piyushh2/expense-management-system/blob/main/config/deploy-azure-storage.json"
    click Config "https://github.com/piyushh2/expense-management-system/blob/main/config/sass.json"
    click Config "https://github.com/piyushh2/expense-management-system/blob/main/config/serve.json"
    click Config "https://github.com/piyushh2/expense-management-system/blob/main/config/write-manifests.json"
    click Index "https://github.com/piyushh2/expense-management-system/blob/main/src/index.ts"
    click EmsManifest "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/EmsWebPart.manifest.json"
    click EmsClass "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/EmsWebPart.ts"
    click EmsShell "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/Ems.tsx"
    click EmsStyles "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/Ems.module.scss"
    click Navbar "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/Navbar.tsx"
    click Dashboard "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/Dashboard.tsx"
    click Table "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/Table.tsx"
    click Approvals "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/Approvals.tsx"
    click ApprovalHistory "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/ApprovalHistory.tsx"
    click Approved "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/Approved.tsx"
    click New "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/New.tsx"
    click Request "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/Request.tsx"
    click Footer "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/Footer.tsx"
    click Props "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/components/IEmsProps.ts"
    click Loc "https://github.com/piyushh2/expense-management-system/blob/main/src/webparts/ems/loc/en-us.js"
    click TeamsApp "https://github.com/piyushh2/expense-management-system/tree/main/teams/"
    click PackageJSON "https://github.com/piyushh2/expense-management-system/blob/main/package.json"
    click TSConfig "https://github.com/piyushh2/expense-management-system/blob/main/tsconfig.json"
    click ESLint "https://github.com/piyushh2/expense-management-system/blob/main/ .eslintrc.js"
    click Gitignore "https://github.com/piyushh2/expense-management-system/blob/main/.gitignore"
    click README "https://github.com/piyushh2/expense-management-system/blob/main/README.md"

    %% Styling
    classDef dev fill:#D0E8FF,stroke:#0066CC,color:#000;
    classDef config fill:#E8F8D8,stroke:#52B63E,color:#000;
    classDef build fill:#FFF5CC,stroke:#E6B800,color:#000;
    classDef cdn fill:#DDEBF7,stroke:#1F4E79,color:#000;
    classDef runtime fill:#E3FCEF,stroke:#2E7D32,color:#000;
    classDef components fill:#FFF0F0,stroke:#D32F2F,color:#000;
    classDef service fill:#FEEFEF,stroke:#CC0000,color:#000;
```
