# vito-ctrl/constructionxpert architecture

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

- Interactive diagram: https://gitdiagram.com/vito-ctrl/constructionxpert
- Repository: https://github.com/vito-ctrl/constructionxpert

## Overview

##### Project type and purpose
- This is a full-stack web application split into two top-level folders:
- client/ – A Vite-powered React front end using Tailwind CSS and custom components (pages for Home, Projects, Resources, Tasks, plus reusable UI pieces like Navbar, Button, etc.).
- server/ – A Node.js/Express REST API following an MVC-style pattern (controllers for Projects, Resources, Tasks; models to define your data; an index.js to wire up routes).
- The purpose: provide CRUD functionality for Projects, Resources, and Tasks entities via a SPA that talks to an Express-based API, which in turn persists data to a database.

##### File structure
- client/src/components/… holds React components organized by feature (common, projects, resources, tasks).
- client/src/pages/Home.jsx is your landing page; App.jsx ties routes to pages.
- client/vite.config.js + package.json define your front-end build and dependencies.
- server/controllers/*.js implement HTTP handlers for each entity.
- server/models/*.js define your data schema (likely Mongoose or similar).
- server/index.js configures Express, mounts routers, and connects to the database.

##### Detailed breakdown of components (optional nodes
- Front-end:
- Home page (Home.jsx)
- Projects module (Projects.jsx, ProjectList, ProjectCard, Delete/Update components)
- Resources module (similar structure)
- Tasks module (TaskList, TaskCard, TaskForm, Update/Delete)
- Common UI (Navbar, Footer, Button)
- Back-end:
- Routes (defined in index.js or imported router files)
- Controllers (ProjectControllers.js, ResourcesControllers.js, TasksControllers.js)
- Models (ProjectModels.js, ResourcesModels.js, TaskModels.js)
- DB connection (in index.js)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Actor
    Browser["User / Browser"]:::external

    %% Front-end Container
    subgraph "Front-end (client/)"
        direction TB
        Main["React Entrypoint\n(main.jsx)"]:::ui
        App["App & Routing\n(App.jsx)"]:::ui
        subgraph "Pages"
            direction TB
            Home["Home Page\n(Home.jsx)"]:::ui
        end
        subgraph "Projects Module"
            direction TB
            PContainer["Projects Container\n(Projects.jsx)"]:::ui
            PList["ProjectList\n(ProjectList.jsx)"]:::ui
            PCard["ProjectCard\n(ProjectCard.jsx)"]:::ui
            PDelete["DeleteProject\n(Deleteproject.jsx)"]:::ui
            PUpdate["UpdateProject\n(UpdateProject.jsx)"]:::ui
        end
        subgraph "Resources Module"
            direction TB
            RContainer["Resources Container\n(Resources.jsx)"]:::ui
            RList["ResourceList\n(ResourceList.jsx)"]:::ui
            RCard["ResourceCard\n(ResourceCard.jsx)"]:::ui
            RDelete["DeleteResources\n(DeleteResources.jsx)"]:::ui
            RUpdate["UpdateResources\n(UpdateResources.jsx)"]:::ui
        end
        subgraph "Tasks Module"
            direction TB
            TContainer["Tasks Container\n(Tasks.jsx)"]:::ui
            TList["TaskList\n(TaskList.jsx)"]:::ui
            TCard["TaskCard\n(TaskCard.jsx)"]:::ui
            TForm["TaskForm\n(TaskForm.jsx)"]:::ui
            TDelete["DeleteTasks\n(DeleteTasks.jsx)"]:::ui
            TUpdate["UpdateTasks\n(UpdateTasks.jsx)"]:::ui
        end
        subgraph "Common UI"
            direction TB
            Navbar["Navbar\n(Navbar.jsx)"]:::ui
            Button["Button\n(Button.jsx)"]:::ui
            Footer["Footer\n(Footer.jsx)"]:::ui
        end
        subgraph "Styling & Config"
            direction TB
            GlobalCSS["Global CSS\n(index.css, App.css)"]:::config
            FeatureCSS["Feature CSS\n(add.css, delete.css, update.css, view.css)"]:::config
            Tailwind["Tailwind Config\n(tailwind.config.js)"]:::config
            PostCSS["PostCSS Config\n(postcss.config.js)"]:::config
            ESLint["ESLint Config\n(eslint.config.js)"]:::config
            Vite["Vite Config\n(vite.config.js)"]:::config
            FrontPkg["Package Definition\n(package.json)"]:::config
        end
    end

    %% Backend Container
    subgraph "Back-end (server/)"
        direction TB
        Express["Express Server\n(index.js)"]:::api
        subgraph "Controllers"
            direction TB
            CProj["ProjectControllers.js"]:::api
            CRes["ResourcesControllers.js"]:::api
            CTask["TasksControllers.js"]:::api
        end
        subgraph "Models"
            direction TB
            MProj["ProjectModels.js"]:::api
            MRes["ResourcesModels.js"]:::api
            MTask["TaskModels.js"]:::api
        end
        ServerPkg["Package Definition\n(package.json)"]:::config
    end

    %% Database
    DB["Database\n(MongoDB)"]:::db

    %% Connections
    Browser --> Main
    Main --> App
    App --> Home
    App --> PContainer
    App --> RContainer
    App --> TContainer
    App --> Navbar
    App --> Footer

    App -->|"/api/... HTTP requests"| Express
    Express --> CProj
    Express --> CRes
    Express --> CTask
    CProj --> MProj
    CRes --> MRes
    CTask --> MTask
    MProj --> DB
    MRes --> DB
    MTask --> DB

    %% Click Events - Front-end
    click Main "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/main.jsx"
    click App "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/App.jsx"
    click Home "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/pages/Home.jsx"
    click PContainer "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/projects/Projects.jsx"
    click PList "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/projects/ProjectList.jsx"
    click PCard "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/projects/ProjectCard.jsx"
    click PDelete "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/projects/Deleteproject.jsx"
    click PUpdate "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/projects/UpdateProject.jsx"
    click RContainer "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/resources/Resources.jsx"
    click RList "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/resources/ResourceList.jsx"
    click RCard "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/resources/ResourceCard.jsx"
    click RDelete "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/resources/DeleteResources.jsx"
    click RUpdate "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/resources/UpdateResources.jsx"
    click TContainer "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/tasks/Tasks.jsx"
    click TList "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/tasks/TaskList.jsx"
    click TCard "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/tasks/TaskCard.jsx"
    click TForm "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/tasks/TaskForm.jsx"
    click TDelete "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/tasks/DeleteTasks.jsx"
    click TUpdate "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/tasks/UpdateTasks.jsx"
    click Navbar "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/common/Navbar.jsx"
    click Button "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/common/Button.jsx"
    click Footer "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/common/Footer.jsx"
    click GlobalCSS "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/index.css"
    click FeatureCSS "https://github.com/vito-ctrl/constructionxpert/blob/main/client/src/components/style/add.css"
    click Tailwind "https://github.com/vito-ctrl/constructionxpert/blob/main/client/tailwind.config.js"
    click PostCSS "https://github.com/vito-ctrl/constructionxpert/blob/main/client/postcss.config.js"
    click ESLint "https://github.com/vito-ctrl/constructionxpert/blob/main/client/eslint.config.js"
    click Vite "https://github.com/vito-ctrl/constructionxpert/blob/main/client/vite.config.js"
    click FrontPkg "https://github.com/vito-ctrl/constructionxpert/blob/main/client/package.json"

    %% Click Events - Back-end
    click Express "https://github.com/vito-ctrl/constructionxpert/blob/main/server/index.js"
    click CProj "https://github.com/vito-ctrl/constructionxpert/blob/main/server/controllers/ProjectControllers.js"
    click CRes "https://github.com/vito-ctrl/constructionxpert/blob/main/server/controllers/ResourcesControllers.js"
    click CTask "https://github.com/vito-ctrl/constructionxpert/blob/main/server/controllers/TasksControllers.js"
    click MProj "https://github.com/vito-ctrl/constructionxpert/blob/main/server/models/ProjectModels.js"
    click MRes "https://github.com/vito-ctrl/constructionxpert/blob/main/server/models/ResourcesModels.js"
    click MTask "https://github.com/vito-ctrl/constructionxpert/blob/main/server/models/TaskModels.js"
    click ServerPkg "https://github.com/vito-ctrl/constructionxpert/blob/main/server/package.json"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#036,stroke-width:1px
    classDef api fill:#90EE90,stroke:#060,stroke-width:1px
    classDef db fill:#FFA500,stroke:#A60,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#EEEEEE,stroke:#999,stroke-width:1px
```
