# akumaaaaaa/fe-sistem-informasi-capex architecture

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

- Interactive diagram: https://gitdiagram.com/akumaaaaaa/fe-sistem-informasi-capex
- Repository: https://github.com/akumaaaaaa/fe-sistem-informasi-capex

## Overview

##### Project type and purpose
- This is a full-stack CAPEX Management System, albeit this repo contains only the React/Vite front-end.
- Purpose: Provide a web-based interface for users (admins, karyawan) to log in, perform CRUD on CAPEX records, manage users/accounts, and export reports to PDF.

##### File structure
- Top-level config files:
- `.eslintrc.cjs`, `vite.config.js` – front-end linting & build config
- `package.json` / `package-lock.json` – npm dependencies & scripts
- Public entrypoint: `index.html`
- Source code under `src/`:
- `main.jsx` – React app bootstrap (Vite)
- `App.jsx` – root component & router container
- `assets/` – static images/fonts (probably empty here)
- `components/` – all UI components (dashboards, modals, forms, sidebar, etc.) each with its CSS
- `index.css` – global styles

##### README for additional insights
- Features require authentication, role-based CRUD, PDF export
- Figma link for use-case & wireframes

a. Main components:
- Client (Browser) running the React SPA
- Front-end App (React/Vite)
- API Server (Node.js + Express)
- Database (MongoDB)
- External Tools/Services: Figma (design), Postman (API testing), PDF export library or microservice
b. Relationships & interactions:
1. User interacts with React SPA in browser.
2. SPA makes REST API calls (HTTPS) to Express endpoints for auth, CAPEX data, user management.
3. API Server reads/writes to MongoDB.
4. PDF export: front-end or back-end invokes PDF generation library or external service, returns file.
c. Architectural patterns & design principles:
- Single Page Application (SPA) pattern for front-end.
- MVC-style layering in Node/Express (controllers for routes, services for business logic, models for data).
- Separation of concerns: UI vs API vs data store.
- Role-based access control enforced at API layer.
d. Key technologies/frameworks:
- Front-end: React, Vite, JSX, CSS modules (per component)
- API: Node.js, Express
- Database: MongoDB (likely via Mongoose)
- Auth: JWT or session cookies
- PDF Export: jsPDF or server-side library

##### Detailed capture of essential architectural elements
- Major React components (e.g., AdminDashboard, KaryawanDashboard, Sidebar, CRUD modals) grouped under “React Application.”
- On the API side, show routes for `/auth`, `/capex`, `/users`, `/summaries`.
- Session or token flow: login → token issuance → protected API calls.
- Distinguish data flows:
1. User logs in → POST /auth/login → token returned
2. User fetches CAPEX list → GET /capex → JSON payload
3. User triggers PDF export → GET /capex/export → PDF file

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Browser / Client"
        direction TB
        FE_BROWSER["Web Browser"]:::external
        subgraph "React Application" 
            direction TB
            MAIN["main.jsx"]:::frontend
            APP["App.jsx"]:::frontend
            INDEX_HTML["index.html"]:::frontend
            INDEX_CSS["index.css"]:::frontend
            ASSETS["assets/"]:::frontend
            subgraph "UI Components"
                direction TB
                LOGIN["Login Component"]:::frontend
                REGISTER["Register Component"]:::frontend
                ADMIN_DASH["AdminDashboard"]:::frontend
                KARYAWAN_DASH["KaryawanDashboard"]:::frontend
                SIDEBAR["Sidebar Navigation"]:::frontend
                CAPEX_LIST["CAPEX List & CRUD"]:::frontend
                CREATE_SUMMARY["Create Summary Modal"]:::frontend
                UPDATE_CAPEX["Update CAPEX Modal"]:::frontend
                DELETE_SUMMARY["Delete Summary Modal"]:::frontend
                UPDATE_SUMMARY["Update Summary Modal"]:::frontend
                MANAGE_ACCOUNTS["Manage Accounts"]:::frontend
                CREATE_USER["Create User Modal"]:::frontend
                UPDATE_USER["Update User Modal"]:::frontend
                DELETE_USER["Delete User Modal"]:::frontend
                PERFORMANCE["Performance Reporting"]:::frontend
            end
        end
    end

    %% Backend Layer
    subgraph "Backend / API Server"
        direction TB
        API_SERVER["Express API Server"]:::backend
        subgraph "Controllers"
            direction TB
            AUTH_CTRL["/auth Controller"]:::backend
            CAPEX_CTRL["/capex Controller"]:::backend
            USERS_CTRL["/users Controller"]:::backend
            SUMMARY_CTRL["/summaries Controller"]:::backend
        end
        subgraph "Services & Models"
            direction TB
            BUSINESS_SVC["Business Services"]:::backend
            DATA_MODELS["Data Models (Mongoose)"]:::backend
        end
    end

    %% Database
    DB["MongoDB Database"]:::database

    %% External Tools
    subgraph "External Tools / Services"
        direction TB
        FIGMA["Figma"]:::external
        POSTMAN["Postman"]:::external
        PDF_LIB["PDF Generation Service"]:::external
    end

    %% Relationships
    FE_BROWSER -->|loads| INDEX_HTML
    INDEX_HTML -->|boots| MAIN
    MAIN -->|renders| APP
    APP --> UI_COMPONENTS
    FE_BROWSER -->|interacts with| LOGIN
    FE_BROWSER -->|interacts with| ADMIN_DASH
    FE_BROWSER -->|interacts with| KARYAWAN_DASH
    APP -->|HTTP requests| API_SERVER
    API_SERVER -->|calls| AUTH_CTRL
    API_SERVER -->|calls| CAPEX_CTRL
    API_SERVER -->|calls| USERS_CTRL
    API_SERVER -->|calls| SUMMARY_CTRL
    AUTH_CTRL --> BUSINESS_SVC
    CAPEX_CTRL --> BUSINESS_SVC
    USERS_CTRL --> BUSINESS_SVC
    SUMMARY_CTRL --> BUSINESS_SVC
    BUSINESS_SVC --> DATA_MODELS
    DATA_MODELS --> DB
    API_SERVER -->|generates PDF| PDF_LIB
    FIGMA -.->|designs| UI_COMPONENTS
    POSTMAN -.->|tests API| API_SERVER

    %% Click Events
    click INDEX_HTML "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/index.html"
    click MAIN "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/main.jsx"
    click APP "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/App.jsx"
    click INDEX_CSS "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/index.css"
    click ASSETS "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/tree/main/src/assets/"
    click LOGIN "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/login.jsx"
    click REGISTER "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/register.jsx"
    click ADMIN_DASH "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/admindashboard.jsx"
    click KARYAWAN_DASH "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/karyawandashboard.jsx"
    click SIDEBAR "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/sidebar.jsx"
    click CAPEX_LIST "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/capex.jsx"
    click CREATE_SUMMARY "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/createsummarymodal.jsx"
    click UPDATE_CAPEX "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/updatecapexmodal.jsx"
    click DELETE_SUMMARY "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/deletesummarymodal.jsx"
    click UPDATE_SUMMARY "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/updatesummarymodal.jsx"
    click MANAGE_ACCOUNTS "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/manageaccounts.jsx"
    click CREATE_USER "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/createusermodal.jsx"
    click UPDATE_USER "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/updateusermodal.jsx"
    click DELETE_USER "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/deleteusermodal.jsx"
    click PERFORMANCE "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/src/components/performance.jsx"
    click ESLINT "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/.eslintrc.cjs"
    click VITE "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/vite.config.js"
    click PACKAGE "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/package.json"
    click LOCK "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/package-lock.json"
    click GITIGNORE "https://github.com/akumaaaaaa/fe-sistem-informasi-capex/blob/main/.gitignore"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#2196F3,color:#0D47A1;
    classDef backend fill:#E8F5E9,stroke:#43A047,color:#1B5E20;
    classDef database fill:#FFF3E0,stroke:#FB8C00,color:#E65100,stroke-width:2px,shape:cylinder;
    classDef external fill:#F3E5F5,stroke:#8E24AA,color:#4A148C,stroke-dasharray: 5 5;
    class UI_COMPONENTS,BUSINESS_SVC,DATA_MODELS,SUMMARY_CTRL,CAPEX_CTRL,USERS_CTRL,AUTH_CTRL backend
    class FE_BROWSER,FIGMA,POSTMAN,PDF_LIB external
```
