Skip to content

Architecture

IQVflex is the single Node-RED flow split into independent components without any loss of functionality.

iqvflex/
├── frontend/  (dashboard/)   React + TypeScript + Vite
├── backend/                  Node.js + Express (JavaScript, ES Modules)
└── e2e/                      End-to-end tests (Playwright)

Data flow

React + TypeScript Frontend
          │
          ▼
     Node.js Backend
       │         │
       │         └────────► Go Integration API (external)
       │                         │
       │                         ▼
       │                     Response
       │                         │
       ◄─────────────────────────┘
       │
       ▼
    MongoDB

The frontend never connects directly to MongoDB or to the Go service's IP/port. The only address it knows is the Node.js backend address, given via VITE_API_BASE_URL. In a Docker deployment this value is left empty and the frontend reaches the backend through the nginx proxy on the same origin.

Backend layers

Route  →  Validation / Middleware  →  Controller  →  Service  →  Repository  →  Model / MongoDB

For the Go integration:

Route → Controller → Integration Service → Go API → Integration Service → Controller → Frontend
Folder Responsibility
src/routes Endpoint definitions, middleware and controller wiring only
src/controllers Receive requests, call services, produce HTTP responses
src/services Business logic; Go API calls live in goApi.service.js / integration.service.js
src/repositories All MongoDB access (findOne, updateOne, aggregate, …)
src/models Data models, normalization, filter/document construction
src/middlewares requestId, auth, notFound, central error handler
src/validations Request body / query validation
src/config env.js, database.js, goApi.js — infrastructure/configuration

process.env is accessed only inside src/config/env.js; the rest of the code never reads environment variables directly.

Repository layout (root)

ERP/
├── install.sh / install.ps1
├── update.sh  / update.ps1
├── uninstall.sh / uninstall.ps1
├── docker-compose.yml          # mongo + backend + frontend
├── docker-compose.prod.yml     # hardened production override
├── .env.example                # template (contains no real secrets)
├── VERSION                     # canonical version
├── scripts/
│   ├── common.sh / common.ps1  # shared functions
│   └── static-server.mjs       # native-mode static server
├── dashboard/                  # frontend + Dockerfile + nginx.conf
├── iqvflex/backend/            # backend + Dockerfile
├── iqvflex/e2e/                # end-to-end tests
├── docs/                       # this documentation (MkDocs)
└── .github/workflows/          # CI/CD pipelines

Code and runtime data are kept separate: data/, logs/, backups/ and .env are not version-controlled.

Versioning

The single canonical version source is the repository root VERSION file (SemVer, MAJOR.MINOR.PATCH). Scripts read the version only from this file and tag Docker images with it. Versions in dashboard/package.json and iqvflex/backend/package.json are component-level and are not the product version.