# joaoliveira6704/voltaic-app architecture

> Architecture diagram of the GitHub repository joaoliveira6704/voltaic-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/joaoliveira6704/voltaic-app
- Repository: https://github.com/joaoliveira6704/voltaic-app

## Overview

1. **Repository shape**
   - This is a **monorepo** with three main runtime areas: `frontend/` (Nuxt app), `api/` (Node backend), and `data-gen/` (Python data generator).
   - `compose.yaml` and per-service `Dockerfile`s indicate the system is meant to run as **multiple containers** with clear service boundaries.

2. **Frontend boundary**
   - The `frontend/` package is a **Nuxt-based UI** focused on user-facing screens.
   - The visible pages are mostly **authentication and onboarding**: `login`, `signup`, `recover-password`, plus a landing page.
   - UI is built from reusable components under `app/components/ui/*` and `landing-page/*`, with **Tailwind CSS** providing styling.

3. **Frontend role in the system**
   - The frontend appears to be the **presentation layer only**: it renders forms and views, but the repo structure does not show any backend logic there.
   - Its main data dependency is the API; architecture-wise it should be drawn as a client consuming backend endpoints rather than owning business logic.

4. **Backend entry points**
   - The `api/` service has `server.js` and `app.js`, which are the Node application bootstrap points.
   - The presence of `package.json`, `bun.lock`, and `Dockerfile` suggests the backend can run in a **Node/Bun-oriented runtime**.

5. **API structure**
   - The backend is organized in a classic **controller / route / model** layout:
     - `src/routes/*` exposes HTTP endpoints
     - `src/controllers/*` handles request logic
     - `src/models/*` defines the domain entities
   - This is a strong indicator of a layered REST API rather than a monolithic server-rendered app.

6. **Domain subsystems**
   - The main backend domains are:
     - `auth` for login/session flows
     - `users`
     - `companies`
     - `stations`
     - `tickets`
     - `logs`
   - These are separate vertical slices, likely mapped to distinct API resource groups and corresponding database collections/tables.

7. **Request/data flow**
   - Typical flow is: **frontend UI → route → controller → model/db service → response**.
   - `src/middleware/authMiddleware.js` sits in front of protected routes, while `src/middleware/errorHandler.js` centralizes failure handling.
   - `src/services/db.service.js` is the key persistence boundary; it likely abstracts the actual database connection and query operations away from controllers.

8. **Session and audit behavior**
   - `UserSessions.js` indicates the backend tracks **active sessions** or login state rather than relying on stateless auth alone.
   - `Logs.js` suggests an **audit trail / activity log** subsystem, which is important for tracing user or system actions across tickets, stations, and company operations.

9. **Data bootstrap / ingestion**
   - `api/src/data/dataInjection.js` and `api/src/data/userTest.json` suggest the API includes **seed or import logic** for test/demo data.
   - `data-gen/` is a separate Python toolchain with `main.py` and `users.csv`, likely used to **generate or transform user data** before importing it into the API/database layer.

10. **Infrastructure and deployment**
   - The repo is container-ready:
     - `api/Dockerfile`
     - `data-gen/Dockerfile`
     - `compose.yaml`
   - For an architecture diagram, show these as deployable services coordinated by Compose, with the frontend, API, and data-generation pipeline separated by runtime boundary.

11. **Important architectural boundary**
   - The cleanest system boundary is between **presentation (frontend)** and **business/data services (api)**.
   - A second boundary exists between **runtime application code** and **offline data generation/seeding** (`data-gen` + `api/src/data`), which should be shown as an auxiliary pipeline rather than part of request handling.

12. **What to emphasize in a diagram**
   - Draw the frontend as the user entry point.
   - Draw the API as the central business layer with modules for auth, users, companies, stations, tickets, and logs.
   - Draw persistence behind `db.service.js` and the models.
   - Draw `data-gen` and `dataInjection` as supporting ingestion/seed tooling, not live request handlers.

Main entry points: [`frontend/app`](https://github.com/joaoliveira6704/voltaic-app/tree/develop/frontend/app) (Nuxt app), [`api/src/routes`](https://github.com/joaoliveira6704/voltaic-app/tree/develop/api/src/routes) (Routes), [`compose.yaml`](https://github.com/joaoliveira6704/voltaic-app/blob/develop/compose.yaml) (Compose stack), [`api/app.js`](https://github.com/joaoliveira6704/voltaic-app/blob/develop/api/app.js) (App setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_frontend["Frontend"]
  node_node_frontend_app["Nuxt app<br/>ui runtime"]
  node_node_frontend_pages["Auth pages"]
  node_node_frontend_components["UI kit<br/>components"]
  node_node_frontend_tailwind["Tailwind<br/>styling<br/>[tailwind.css]"]
end

subgraph group_group_api["API"]
  node_node_api_entry["API entry<br/>node runtime<br/>[server.js]"]
  node_node_api_app["App setup<br/>app wiring<br/>[app.js]"]
  node_node_api_routes["Routes"]
  node_node_api_controllers["Controllers<br/>request logic"]
  node_node_api_models[("Models")]
  node_node_api_db["DB service<br/>persistence boundary<br/>[db.service.js]"]
  node_node_api_middleware["Middleware<br/>cross-cutting"]
  node_node_api_domains["Domain modules<br/>auth/users/ops<br/>[authController.js]"]
  node_node_api_seed["Seed data<br/>import data<br/>[dataInjection.js]"]
end

subgraph group_group_data["Data tooling"]
  node_node_data_gen["Data gen<br/>python tool<br/>[main.py]"]
end

subgraph group_group_deploy["Deployment"]
  node_node_compose["Compose stack<br/>deployment<br/>[compose.yaml]"]
end

node_node_users(("Users<br/>actor"))

node_node_users -->|"uses"| node_node_frontend_app
node_node_frontend_app -->|"renders"| node_node_frontend_pages
node_node_frontend_app -->|"composes"| node_node_frontend_components
node_node_frontend_app -->|"styles with"| node_node_frontend_tailwind
node_node_frontend_app -.->|"calls"| node_node_api_routes
node_node_api_entry -->|"starts"| node_node_api_app
node_node_api_app -->|"mounts"| node_node_api_routes
node_node_api_app -->|"applies"| node_node_api_middleware
node_node_api_routes -->|"dispatches to"| node_node_api_controllers
node_node_api_controllers -->|"implements"| node_node_api_domains
node_node_api_domains -->|"reads/writes"| node_node_api_models
node_node_api_models -->|"uses"| node_node_api_db
node_node_api_controllers -.->|"queries"| node_node_api_db
node_node_api_middleware -.->|"guards"| node_node_api_routes
node_node_api_seed -.->|"loads"| node_node_api_db
node_node_data_gen -.->|"feeds"| node_node_api_seed
node_node_compose -.->|"runs"| node_node_frontend_app
node_node_compose -.->|"runs"| node_node_api_entry
node_node_compose -.->|"runs"| node_node_data_gen

click node_node_frontend_app "https://github.com/joaoliveira6704/voltaic-app/tree/develop/frontend/app"
click node_node_frontend_pages "https://github.com/joaoliveira6704/voltaic-app/tree/develop/frontend/app/pages"
click node_node_frontend_components "https://github.com/joaoliveira6704/voltaic-app/tree/develop/frontend/app/components"
click node_node_frontend_tailwind "https://github.com/joaoliveira6704/voltaic-app/blob/develop/frontend/app/assets/css/tailwind.css"
click node_node_api_entry "https://github.com/joaoliveira6704/voltaic-app/blob/develop/api/server.js"
click node_node_api_app "https://github.com/joaoliveira6704/voltaic-app/blob/develop/api/app.js"
click node_node_api_routes "https://github.com/joaoliveira6704/voltaic-app/tree/develop/api/src/routes"
click node_node_api_controllers "https://github.com/joaoliveira6704/voltaic-app/tree/develop/api/src/controllers"
click node_node_api_models "https://github.com/joaoliveira6704/voltaic-app/tree/develop/api/src/models"
click node_node_api_db "https://github.com/joaoliveira6704/voltaic-app/blob/develop/api/src/services/db.service.js"
click node_node_api_middleware "https://github.com/joaoliveira6704/voltaic-app/tree/develop/api/src/middleware"
click node_node_api_domains "https://github.com/joaoliveira6704/voltaic-app/blob/develop/api/src/controllers/authController.js"
click node_node_api_seed "https://github.com/joaoliveira6704/voltaic-app/blob/develop/api/src/data/dataInjection.js"
click node_node_data_gen "https://github.com/joaoliveira6704/voltaic-app/blob/develop/data-gen/main.py"
click node_node_compose "https://github.com/joaoliveira6704/voltaic-app/blob/develop/compose.yaml"

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_node_frontend_app,node_node_frontend_pages,node_node_frontend_components,node_node_frontend_tailwind toneBlue
class node_node_api_entry,node_node_api_app,node_node_api_routes,node_node_api_controllers,node_node_api_models,node_node_api_db,node_node_api_middleware,node_node_api_domains,node_node_api_seed toneAmber
class node_node_data_gen toneMint
class node_node_compose toneRose
class node_node_users toneNeutral
```

## Components

### Frontend

Nuxt presentation layer

- [Nuxt app](https://github.com/joaoliveira6704/voltaic-app/tree/develop/frontend/app): ui runtime · Presentation layer and routed screens · `frontend/app`
- [Auth pages](https://github.com/joaoliveira6704/voltaic-app/tree/develop/frontend/app/pages): pages · Landing, login, signup, and recovery views · `frontend/app/pages`
- [UI kit](https://github.com/joaoliveira6704/voltaic-app/tree/develop/frontend/app/components): components · Reusable landing and form components · `frontend/app/components`
- [Tailwind](https://github.com/joaoliveira6704/voltaic-app/blob/develop/frontend/app/assets/css/tailwind.css): styling · Utility CSS theme and styling layer · `frontend/app/assets/css/tailwind.css`

### API

Node backend and domain modules

- [API entry](https://github.com/joaoliveira6704/voltaic-app/blob/develop/api/server.js): node runtime · Application bootstrap and server startup · `api/server.js`
- [App setup](https://github.com/joaoliveira6704/voltaic-app/blob/develop/api/app.js): app wiring · Backend composition and middleware wiring · `api/app.js`
- [Routes](https://github.com/joaoliveira6704/voltaic-app/tree/develop/api/src/routes): http routes · HTTP endpoint definitions for each domain · `api/src/routes`
- [Controllers](https://github.com/joaoliveira6704/voltaic-app/tree/develop/api/src/controllers): request logic · Per-domain request handling and orchestration · `api/src/controllers`
- [Models](https://github.com/joaoliveira6704/voltaic-app/tree/develop/api/src/models): domain models · Persistent entities and collections · `api/src/models`
- [DB service](https://github.com/joaoliveira6704/voltaic-app/blob/develop/api/src/services/db.service.js): persistence boundary · Shared database access and query abstraction · `api/src/services/db.service.js`
- [Middleware](https://github.com/joaoliveira6704/voltaic-app/tree/develop/api/src/middleware): cross-cutting · Auth and centralized error handling · `api/src/middleware`
- [Domain modules](https://github.com/joaoliveira6704/voltaic-app/blob/develop/api/src/controllers/authController.js): auth/users/ops · Auth, users, companies, stations, tickets, and logs · `api/src/controllers/authController.js`
- [Seed data](https://github.com/joaoliveira6704/voltaic-app/blob/develop/api/src/data/dataInjection.js): import data · Built-in test data injection and fixtures · `api/src/data/dataInjection.js`

### Data tooling

Offline generation and seed/import helpers

- [Data gen](https://github.com/joaoliveira6704/voltaic-app/blob/develop/data-gen/main.py): python tool · Offline user-data generation pipeline · `data-gen/main.py`

### Deployment

Containerized multi-service runtime

- [Compose stack](https://github.com/joaoliveira6704/voltaic-app/blob/develop/compose.yaml): deployment · Multi-container orchestration for the services · `compose.yaml`

### Other components

- **Users**: actor · End users of the app

## Connections

- Users → Nuxt app: uses · Users interact with the UI
- Nuxt app → Auth pages: renders · Routes page-level auth and landing views
- Nuxt app → UI kit: composes · Pages are built from shared UI components
- Nuxt app → Tailwind: styles with · Tailwind provides presentation styling
- Nuxt app → Routes: calls · UI consumes backend endpoints
- API entry → App setup: starts · Server bootstraps the application
- App setup → Routes: mounts · App wires in HTTP routes
- App setup → Middleware: applies · Auth and error handling are registered globally
- Routes → Controllers: dispatches to · Routes delegate request handling
- Controllers → Domain modules: implements · Controllers cover the main business domains
- Domain modules → Models: reads/writes · Domain logic operates on persistent entities
- Models → DB service: uses · Models rely on shared persistence access
- Controllers → DB service: queries · Controllers may coordinate database operations through the service layer
- Middleware → Routes: guards · Protected routes run through auth middleware
- Seed data → DB service: loads · Seed and import code populates the datastore
- Data gen → Seed data: feeds · Generated data is prepared for API import
- Compose stack → Nuxt app: runs · Compose starts the frontend container
- Compose stack → API entry: runs · Compose starts the API container
- Compose stack → Data gen: runs · Compose can include the data-generation container
