# abhinks151/veltrex_backend architecture

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

- Interactive diagram: https://gitdiagram.com/abhinks151/veltrex_backend
- Repository: https://github.com/abhinks151/veltrex_backend

## Overview

Veltrex is a multi-tenant MES API for CNC shop operations. Its user-facing workflow covers authentication and role checks, production resources and shifts, machine-job monitoring, and maintenance-ticket handling; administrators also manage versioned NC programs and subscriptions. NestJS controllers dispatch to application use cases, with Prisma-backed persistence and optional S3 file storage. The graph keeps documented capabilities even where implementation was not sampled; edges without direct excerpt evidence are omitted. The tree lists no fixture source despite the README mentioning fixture management.

Main entry points: [`src/shared/infrastructure/prisma/prisma.service.ts`](https://github.com/abhinks151/veltrex_backend/blob/main/src/shared/infrastructure/prisma/prisma.service.ts) (PostgreSQL database), [`src/app.module.ts`](https://github.com/abhinks151/veltrex_backend/blob/main/src/app.module.ts) (NestJS application), [`src/modules/maintenance/presentation/maintenance.controller.ts`](https://github.com/abhinks151/veltrex_backend/blob/main/src/modules/maintenance/presentation/maintenance.controller.ts) (Maintenance tickets), [`src/modules/ncProgram/presentation/nc-program.controller.ts`](https://github.com/abhinks151/veltrex_backend/blob/main/src/modules/ncProgram/presentation/nc-program.controller.ts) (NC programs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and access"]
  node_app["NestJS application<br/>[app.module.ts]"]
  node_auth["Authentication"]
  node_roles["Role authorization<br/>[roles.guard.ts]"]
end

subgraph group_operations["Shop operations"]
  node_machines["Machine management"]
  node_jobs["Jobs and parts"]
  node_shifts["Production shifts"]
  node_maintenance["Maintenance tickets"]
  node_materials["Raw materials"]
  node_notifications["Notifications"]
end

subgraph group_programs["Programs and files"]
  node_ncprograms["NC programs"]
  node_storage["File storage"]
end

subgraph group_accounts["Accounts and billing"]
  node_tenant["Tenant management"]
  node_profile["User profiles"]
  node_subscription["Subscriptions"]
  node_payments["Razorpay payments"]
  node_admin["System administration"]
end

subgraph group_platform["Shared infrastructure"]
  node_database[("PostgreSQL database<br/>[prisma.service.ts]")]
  node_lookup["Lookup settings"]
  node_redis[("Redis service<br/>[redis.service.ts]")]
end

node_client(("API users"))
node_razorpay["Razorpay"]
node_s3["AWS S3"]

node_client -->|"sends requests"| node_app
node_app -->|"registers module"| node_auth
node_app -->|"registers module"| node_tenant
node_app -->|"registers module"| node_maintenance
node_app -->|"registers module"| node_ncprograms
node_app -->|"registers module"| node_notifications
node_app -.->|"enforces roles"| node_roles
node_maintenance -->|"returns ticket results"| node_client
node_maintenance -->|"checks roles"| node_roles
node_maintenance -.->|"records ticket data"| node_database
node_ncprograms -->|"uploads and reads"| node_storage
node_storage -->|"stores files"| node_s3
node_ncprograms -.->|"stores program records"| node_database
node_machines -.->|"persists machine data"| node_database
node_jobs -.->|"persists job data"| node_database
node_shifts -.->|"persists shift data"| node_database
node_materials -.->|"tracks stock"| node_database
node_tenant -.->|"stores tenant data"| node_database
node_profile -.->|"stores profiles"| node_database
node_subscription -.->|"stores plans"| node_database
node_payments -.->|"processes payments"| node_razorpay
node_admin -.->|"manages system data"| node_database
node_lookup -.->|"stores lookup data"| node_database
node_notifications -.->|"delivers notifications"| node_client
node_app -.->|"uses cache"| node_redis

click node_app "https://github.com/abhinks151/veltrex_backend/blob/main/src/app.module.ts"
click node_auth "https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/auth/presentation"
click node_roles "https://github.com/abhinks151/veltrex_backend/blob/main/src/modules/auth/presentation/guards/roles.guard.ts"
click node_machines "https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/machine"
click node_jobs "https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/job"
click node_shifts "https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/shift"
click node_maintenance "https://github.com/abhinks151/veltrex_backend/blob/main/src/modules/maintenance/presentation/maintenance.controller.ts"
click node_materials "https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/raw-material"
click node_ncprograms "https://github.com/abhinks151/veltrex_backend/blob/main/src/modules/ncProgram/presentation/nc-program.controller.ts"
click node_storage "https://github.com/abhinks151/veltrex_backend/blob/main/src/shared/infrastructure/storage/services/s3-storage.service.ts"
click node_notifications "https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/notification"
click node_tenant "https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/tenant"
click node_profile "https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/profile"
click node_subscription "https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/subscription"
click node_payments "https://github.com/abhinks151/veltrex_backend/blob/main/src/modules/payment/infrastructure/services/razorpay-gateway.service.ts"
click node_admin "https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/super-admin"
click node_database "https://github.com/abhinks151/veltrex_backend/blob/main/src/shared/infrastructure/prisma/prisma.service.ts"
click node_lookup "https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/lookup"
click node_redis "https://github.com/abhinks151/veltrex_backend/blob/main/src/shared/infrastructure/redis/redis.service.ts"

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_app,node_auth,node_roles,node_client toneBlue
class node_machines,node_jobs,node_shifts,node_maintenance,node_materials,node_notifications toneAmber
class node_ncprograms,node_storage toneMint
class node_tenant,node_profile,node_subscription,node_payments,node_admin toneRose
class node_database,node_lookup,node_redis,node_razorpay,node_s3 toneIndigo
```

## Components

### API and access

- [NestJS application](https://github.com/abhinks151/veltrex_backend/blob/main/src/app.module.ts): `src/app.module.ts`
- [Authentication](https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/auth/presentation): `src/modules/auth/presentation`
- [Role authorization](https://github.com/abhinks151/veltrex_backend/blob/main/src/modules/auth/presentation/guards/roles.guard.ts): `src/modules/auth/presentation/guards/roles.guard.ts`

### Shop operations

- [Machine management](https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/machine): `src/modules/machine`
- [Jobs and parts](https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/job): `src/modules/job`
- [Production shifts](https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/shift): `src/modules/shift`
- [Maintenance tickets](https://github.com/abhinks151/veltrex_backend/blob/main/src/modules/maintenance/presentation/maintenance.controller.ts): `src/modules/maintenance/presentation/maintenance.controller.ts`
- [Raw materials](https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/raw-material): `src/modules/raw-material`
- [Notifications](https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/notification): `src/modules/notification`

### Programs and files

- [NC programs](https://github.com/abhinks151/veltrex_backend/blob/main/src/modules/ncProgram/presentation/nc-program.controller.ts): `src/modules/ncProgram/presentation/nc-program.controller.ts`
- [File storage](https://github.com/abhinks151/veltrex_backend/blob/main/src/shared/infrastructure/storage/services/s3-storage.service.ts): `src/shared/infrastructure/storage/services/s3-storage.service.ts`

### Accounts and billing

- [Tenant management](https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/tenant): `src/modules/tenant`
- [User profiles](https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/profile): `src/modules/profile`
- [Subscriptions](https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/subscription): `src/modules/subscription`
- [Razorpay payments](https://github.com/abhinks151/veltrex_backend/blob/main/src/modules/payment/infrastructure/services/razorpay-gateway.service.ts): `src/modules/payment/infrastructure/services/razorpay-gateway.service.ts`
- [System administration](https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/super-admin): `src/modules/super-admin`

### Shared infrastructure

- [PostgreSQL database](https://github.com/abhinks151/veltrex_backend/blob/main/src/shared/infrastructure/prisma/prisma.service.ts): `src/shared/infrastructure/prisma/prisma.service.ts`
- [Lookup settings](https://github.com/abhinks151/veltrex_backend/tree/main/src/modules/lookup): `src/modules/lookup`
- [Redis service](https://github.com/abhinks151/veltrex_backend/blob/main/src/shared/infrastructure/redis/redis.service.ts): `src/shared/infrastructure/redis/redis.service.ts`

### Other components

- **API users**
- **Razorpay**
- **AWS S3**

## Connections

- API users → NestJS application: sends requests (evidence: `README.md`)
- NestJS application → Authentication: registers module (evidence: `src/app.module.ts`)
- NestJS application → Tenant management: registers module (evidence: `src/app.module.ts`)
- NestJS application → Maintenance tickets: registers module (evidence: `src/app.module.ts`)
- NestJS application → NC programs: registers module (evidence: `src/app.module.ts`)
- NestJS application → Notifications: registers module (evidence: `src/app.module.ts`)
- NestJS application → Role authorization: enforces roles
- Maintenance tickets → API users: returns ticket results (evidence: `src/modules/maintenance/presentation/maintenance.controller.ts`)
- Maintenance tickets → Role authorization: checks roles (evidence: `src/modules/maintenance/presentation/maintenance.controller.ts`)
- Maintenance tickets → PostgreSQL database: records ticket data
- NC programs → File storage: uploads and reads (evidence: `src/modules/ncProgram/presentation/nc-program.controller.ts`)
- File storage → AWS S3: stores files (evidence: `src/shared/infrastructure/storage/services/s3-storage.service.ts`)
- NC programs → PostgreSQL database: stores program records
- Machine management → PostgreSQL database: persists machine data
- Jobs and parts → PostgreSQL database: persists job data
- Production shifts → PostgreSQL database: persists shift data
- Raw materials → PostgreSQL database: tracks stock
- Tenant management → PostgreSQL database: stores tenant data
- User profiles → PostgreSQL database: stores profiles
- Subscriptions → PostgreSQL database: stores plans
- Razorpay payments → Razorpay: processes payments
- System administration → PostgreSQL database: manages system data
- Lookup settings → PostgreSQL database: stores lookup data
- Notifications → API users: delivers notifications
- NestJS application → Redis service: uses cache
