Technical & Operations

Technical & Operations Manual

Technical & Operations Architecture Manual

Comprehensive architectural specifications, technology stack, directory layout, environment configuration, local development runbook, automated test suites, and database disaster recovery procedures.

Three-Tier System Architecture

UI

Client Tier

Port 3000
Next.js 15
  • Turbopack compiler with App Router
  • Tailwind CSS + Lucide Icons
  • Bilingual LTR / RTL Architecture
  • PWA Optical Barcode & ePOD Signature
API

Application Tier

Port 4050
NestJS 10
  • Node.js 22 LTS with TypeScript
  • Global ValidationPipe with DTOs
  • JwtAuthGuard & Multi-Tenant RolesGuard
  • Decimal.js minor-unit financial math
DB

Data & Ledger Tier

Port 5432
PostgreSQL 18
  • Prisma ORM 5.22 client mappings
  • Double-entry balanced JournalEntry
  • ACID transaction boundaries ($transaction)
  • Target DB: fromto_shipping_test

Environment Configuration Variables

VariableRequiredDefault ValueDescription
PORTYes4050TCP port on which the NestJS 10 backend listens for incoming HTTP requests.
DATABASE_URLYespostgresql://postgres:admin@localhost:5432/fromto_shipping_test?schema=publicPostgreSQL 18 connection URI for the authoritative test database.
JWT_SECRETYesfromto_secret_key_demo_2026_xyzCryptographic secret string utilized for signing and validating session bearer tokens.
JWT_EXPIRES_INOptional7dLifespan and expiration window for authenticated user tokens.
NEXT_PUBLIC_API_URLOptionalhttp://localhost:4050/api/v1Base URL used by the Next.js frontend client to communicate with backend endpoints.
NODE_ENVOptionaldevelopmentRuntime mode flag controlling stack traces and Turbopack compiler behaviors.

Local Development & Execution Runbook

1. Launch Backend API Service (Port 4050)

node scripts/start-backend.js

2. Launch Frontend Application (Port 3000)

node node_modules/next/dist/bin/next dev --turbopack -p 3000

3. Run Master Domain Acceptance Suites (17 Domain Engines)

node scripts/run-all-verifications.js

4. Audit Financial Invariants & Trial Balance

node scripts/reconcile-database.js

PostgreSQL Database Backup & Recovery

Binary pg_dump Command:

pg_dump -h localhost -p 5432 -U postgres -d fromto_shipping_test -F c -b -v -f "fromto_backup.dump"

Produces a compressed binary custom-format dump including all tables, audit logs, and ledger lines.

Database Restore Command:

pg_restore -h localhost -p 5432 -U postgres -d fromto_shipping_test -v --clean "fromto_backup.dump"

Restores schema and records, dropping old tables with --clean and recreating relational constraints.

Simulated Demo Mode