# cache-jujan/brick-x-brick_ap5 architecture

> Architecture diagram of the GitHub repository cache-jujan/brick-x-brick_ap5, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cache-jujan/brick-x-brick_ap5
- Repository: https://github.com/cache-jujan/brick-x-brick_ap5

## Overview

Brick x Brick is a construction-management platform for small contractors, with web and mobile clients and an Express API. The main workflow spans project setup, milestones and tasks, field progress updates, structured work or material tickets, and receipt-based expense submission, review, and reporting; blockchain verification supports financial accountability. The graph includes modules and controller-to-service calls evidenced by sampled source. OCR, fraud checks, offline sync, and some storage wiring are README capabilities, but their implementations were not sampled.

Main entry points: [`backend/src/app.js`](https://github.com/cache-jujan/brick-x-brick_ap5/blob/develop/backend/src/app.js) (Express API), [`backend/src/modules/expenses`](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/expenses) (Expense controls), [`backend/src/modules/blockchain`](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/blockchain) (Blockchain audit), [`backend/src/config/db.js`](https://github.com/cache-jujan/brick-x-brick_ap5/blob/develop/backend/src/config/db.js) (PostgreSQL database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_web["Web dashboard<br/>[App.jsx]"]
  node_mobile["Mobile client<br/>[api.js]"]
end

subgraph group_api["API and identity"]
  node_apiapp["Express API<br/>[app.js]"]
  node_auth["Authentication"]
  node_users["User management"]
end

subgraph group_operations["Project operations"]
  node_projects["Projects"]
  node_milestones["Milestones"]
  node_tasks["Tasks"]
  node_updates["Task updates"]
  node_tickets["Project tickets"]
  node_materials["Material requests"]
end

subgraph group_finance["Financial controls"]
  node_expenses["Expense controls"]
  node_reports["Financial reports"]
  node_blockchain["Blockchain audit"]
  node_auditlogs["Audit logs"]
  node_database[("PostgreSQL database<br/>[db.js]")]
end

node_staff(("Contractor staff"))
node_chain[("Private blockchain")]

node_staff -->|"uses"| node_web
node_staff -->|"uses"| node_mobile
node_web -->|"HTTP API"| node_apiapp
node_mobile -.->|"HTTP API"| node_apiapp
node_apiapp -->|"mounts routes"| node_auth
node_apiapp -->|"mounts routes"| node_users
node_apiapp -->|"mounts routes"| node_projects
node_apiapp -->|"mounts routes"| node_milestones
node_apiapp -->|"mounts routes"| node_tasks
node_apiapp -->|"mounts routes"| node_updates
node_apiapp -->|"mounts routes"| node_tickets
node_apiapp -->|"mounts routes"| node_expenses
node_apiapp -->|"mounts routes"| node_reports
node_apiapp -->|"mounts routes"| node_blockchain
node_projects -.->|"persists project data"| node_database
node_expenses -.->|"stores expense data"| node_database
node_reports -.->|"reads financial data"| node_database
node_blockchain -.->|"verifies hashes"| node_chain
node_expenses -.->|"approved expense audit"| node_blockchain

click node_web "https://github.com/cache-jujan/brick-x-brick_ap5/blob/develop/web/src/App.jsx"
click node_mobile "https://github.com/cache-jujan/brick-x-brick_ap5/blob/develop/mobile/services/api.js"
click node_apiapp "https://github.com/cache-jujan/brick-x-brick_ap5/blob/develop/backend/src/app.js"
click node_auth "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/auth"
click node_users "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/users"
click node_projects "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/projects"
click node_milestones "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/milestones"
click node_tasks "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/tasks"
click node_updates "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/task-updates"
click node_tickets "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/tickets"
click node_materials "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/material-requests"
click node_expenses "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/expenses"
click node_reports "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/reports"
click node_blockchain "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/blockchain"
click node_auditlogs "https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/audit-log"
click node_database "https://github.com/cache-jujan/brick-x-brick_ap5/blob/develop/backend/src/config/db.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_mobile toneBlue
class node_apiapp,node_auth,node_users,node_chain toneAmber
class node_projects,node_milestones,node_tasks,node_updates,node_tickets,node_materials toneMint
class node_expenses,node_reports,node_blockchain,node_auditlogs,node_database toneRose
class node_staff toneIndigo
```

## Components

### User clients

- [Web dashboard](https://github.com/cache-jujan/brick-x-brick_ap5/blob/develop/web/src/App.jsx): `web/src/App.jsx`
- [Mobile client](https://github.com/cache-jujan/brick-x-brick_ap5/blob/develop/mobile/services/api.js): `mobile/services/api.js`

### API and identity

- [Express API](https://github.com/cache-jujan/brick-x-brick_ap5/blob/develop/backend/src/app.js): `backend/src/app.js`
- [Authentication](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/auth): `backend/src/modules/auth`
- [User management](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/users): `backend/src/modules/users`

### Project operations

- [Projects](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/projects): `backend/src/modules/projects`
- [Milestones](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/milestones): `backend/src/modules/milestones`
- [Tasks](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/tasks): `backend/src/modules/tasks`
- [Task updates](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/task-updates): `backend/src/modules/task-updates`
- [Project tickets](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/tickets): `backend/src/modules/tickets`
- [Material requests](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/material-requests): `backend/src/modules/material-requests`

### Financial controls

- [Expense controls](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/expenses): `backend/src/modules/expenses`
- [Financial reports](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/reports): `backend/src/modules/reports`
- [Blockchain audit](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/blockchain): `backend/src/modules/blockchain`
- [Audit logs](https://github.com/cache-jujan/brick-x-brick_ap5/tree/develop/backend/src/modules/audit-log): `backend/src/modules/audit-log`
- [PostgreSQL database](https://github.com/cache-jujan/brick-x-brick_ap5/blob/develop/backend/src/config/db.js): `backend/src/config/db.js`

### Other components

- **Contractor staff**
- **Private blockchain**

## Connections

- Contractor staff → Web dashboard: uses
- Contractor staff → Mobile client: uses
- Web dashboard → Express API: HTTP API
- Mobile client → Express API: HTTP API
- Express API → Authentication: mounts routes
- Express API → User management: mounts routes
- Express API → Projects: mounts routes
- Express API → Milestones: mounts routes
- Express API → Tasks: mounts routes
- Express API → Task updates: mounts routes
- Express API → Project tickets: mounts routes
- Express API → Expense controls: mounts routes
- Express API → Financial reports: mounts routes
- Express API → Blockchain audit: mounts routes
- Projects → PostgreSQL database: persists project data
- Expense controls → PostgreSQL database: stores expense data
- Financial reports → PostgreSQL database: reads financial data
- Blockchain audit → Private blockchain: verifies hashes
- Expense controls → Blockchain audit: approved expense audit
