Service Map

ServicePortRuntimeResponsibility
studio5173Vite + React 18 + TypeScriptAll portal UIs — Customer, Agent Desk, Manager Dashboard, Admin Studio
api-gateway8200nginxThe single public entrypoint. Terminates external traffic and routes each /api/v1/* prefix to its owning service. The client-facing paths never changed when services were split out — that is what the gateway is for.
case-service8201 (loopback)Python 3.12 / FastAPIThe application core: authentication & SSO, case CRUD, workflow, SLA, HxNexus AI, and every module API not owned by a service below (HxConnect, HxSync, HxShield, HxFusion, HxDeploy). Bound to loopback — reachable only through the gateway.
analytics-service8202 (loopback)Python 3.12 / FastAPI/api/v1/analytics and /api/v1/process-mining: aggregate queries, saved reports, exports, variant and bottleneck analysis. Holds its own connection pool so read-heavy work does not compete with the case lifecycle.
hxgraph-service8203 (loopback)Python 3.12 / FastAPI/api/v1/graph: graph sync, natural-language query, path finding, impact analysis, report, export and the interactive visualizer.
hxmigrate-service8204 (loopback)Python 3.12 / FastAPIThe migration domain: /api/v1/hxmigrate, /importer, /scout, /scout-ai and /orchestrator — scan a legacy system, import its definitions, plan the move and create the case types.
flow-engine127.0.0.1:8100Python 3.12 / FastAPIDurable workflow / process execution and the Temporal worker.
postgres5432PostgreSQL 16 + pgvectorPrimary data store for all services.
valkey6379Valkey 8Session cache, SSE pub/sub for HxStream, rate limiting.
broker-gw172.31.101.1:8210 (edge)nginxMarketplace Layer 2. The only data path for app containers — scoped, read-only, tenant-pinned, token hash-authenticated, revocable, audited as broker://.
egress-gwinternalCONNECT proxyMarketplace Layer 2. The only outbound path for app containers, and only to admin-granted domains. Off by default. Per-container credentials rotated on each start; audited as egress://.
Supporting infrastructure: Temporal (:7233, UI :8233) for durable timers and workflow orchestration; OpenBao for secrets (renders .env at startup); document storage on local disk by default, or an S3-compatible endpoint you supply; Ollama (:11434) as the local AI model backend for HxNexus. Only Studio (:5173) is reachable from another machine; the gateway (:8200), the case service (:8201) and the engine (:8100) bind 127.0.0.1, and every container port in compose is published loopback-only so Docker cannot open a hole around the firewall.

Infrastructure Changes in v3.2.0

In v3.2.0. An install taking that update keeps its behaviour unless noted; anything that turns something on applies to a new install only.

Request Flow

Browser / Studio (:5173) | | HTTPS (the single public entrypoint) v [ API gateway :8200 ] nginx - routes each /api/v1 prefix to its owner | +- [ case-service :8201 ] everything not listed below | Auth and SSO . Case CRUD . Workflow and SLA . HxNexus AI | +- [ analytics-service :8202 ] /analytics . /process-mining +- [ hxgraph-service :8203 ] /graph +- [ hxmigrate-service :8204 ] /hxmigrate /importer /scout | /scout-ai /orchestrator | all four loopback only, reachable only through the gateway | all four share one database, each with its own connection pool v +- [ PostgreSQL :5432 ] pgvector embeddings +- [ Valkey :6379 ] cache, SSE pub/sub, rate limiting [ Flow engine :8100 ] durable workflow execution + Temporal worker +- [ Temporal :7233 ] Supporting: OpenBao (secrets) . Documents (disk / S3) . Ollama (AI backend)

Ports Are Configuration

The ports above are defaults, not constants. Every one of them can be moved by an install whose machine already uses that number — the gateway's upstreams, the launch commands and the systemd units all read the same table at deploy/ports/velaris-ports.sh, so nothing repeats a literal.

VariableDefaultService
VELARIS_CASE_SERVICE_PORT8200api-gateway
VELARIS_ENGINE_PORT8100flow-engine
VELARIS_CASE_PORT8201case-service
VELARIS_ANALYTICS_PORT8202analytics-service
VELARIS_HXGRAPH_PORT8203hxgraph-service
VELARIS_HXMIGRATE_PORT8204hxmigrate-service
VELARIS_STUDIO_PORT5173studio

Both the installer and the updater check before anything binds. setup-velaris.sh preflights all seven before Docker, the database or any file is touched, and offers an alternative when one is taken. update-velaris.sh preflights too and halts before changing anything — but never prompts and never reassigns, because it runs unattended on a timer.

The check answers three ways rather than two: free, held by Velaris itself (expected — the platform is running while an update runs), or held by something else, which it names. When it cannot determine the owner it says so and still blocks; guessing “free” is the answer that ends in a half-installed platform.

The same applies one layer down: an update syncs Python and Node dependencies and pulls container images, but cannot install an operating-system package. deploy/deps/velaris-deps.sh lists the binaries the platform needs, the installer reads that list rather than keeping its own copy, and the updater halts with the exact install command instead of running a package manager unwatched on someone else’s server.

Two Layers Between the Gateway and a Service

Workload identity answers did this request come through the gateway? Every service binds loopback, but loopback is a network boundary and not an identity — any other process on the host could open a service port and reach an authenticated API. The gateway injects a shared credential and each service refuses anything without it. Health, readiness and metrics stay exempt so supervisors and scrapes keep working. It is inert until configured, so an upgrade cannot switch enforcement on unattended.

Internal mTLS answers a different question — is the thing on the other end who it claims to be, and can anyone read the traffic? — and ships off. On a single host every service talks over loopback behind a loopback-only gateway; there is no wire to listen on, and the cost is a certificate authority you operate forever. It becomes the right answer the moment a service moves to another host, which is why the certificate authority, the per-service certificates and the rotation timer are built and tested rather than designed later under pressure.

The two are independent: a caller holding a valid client certificate but no identity credential is still refused. Encryption is not authorization.

Repository Layout

Everything the services share — settings, the ORM models and session factories, the identity model, the HxGuard decision point, the middleware stack and the LLM core — lives in one installable package that each service depends on. Nothing in it may import an application; that rule is enforced by a test, and it is what keeps a service split cheap.

services/_shared/velaris_shared/
├── config.py               # pydantic-settings — every env var lives here
├── db/                     # SQLAlchemy models, sessions, per-dialect backends
├── auth/                   # JWT, devices, WebAuthn, identity dependencies
├── hxguard/                # The authorization decision point + action catalogue
├── middleware/             # Audit, rate limit, body limit, security headers
├── observability/          # Logging, metrics, tracing
├── app.py                  # The shared middleware stack + JSON error contract
├── llm/                    # Provider backends, egress guard, egress audit
├── analytics/ process_mining/ hxgraph/   # Query libraries shared with their services
└── core/                   # error codes, PII redaction, the module catalogue

services/analytics-service/  services/hxgraph-service/  services/hxmigrate-service/
    # One package each: main.py + api/routers/ + tests/. They depend on
    # velaris_shared and never import case_service.

case-service Directory Layout

services/case-service/case_service/
├── main.py                 # FastAPI app, all router mounts
├── schemas/                # Pydantic v2 request/response schemas
├── api/routers/            # ~95 routers — one per module
│   ├── cases.py            # /api/v1/cases/*
│   ├── auth.py auth_real.py # /api/v1/auth/*
│   ├── hxnexus.py          # HxNexus AI, incl. case-scoped Q&A
│   ├── hxmcp.py            # /api/v1/mcp — HxNexus Operator
│   ├── marketplace.py      # Installs, grants, containers
│   ├── broker.py           # Scoped read-only broker for L2 apps
│   ├── meet.py kyc.py      # HxMeet sessions, recordings, KYC
│   ├── hxreplay.py         # Counterfactual replay
│   ├── costing.py          # Rate cards, timers, billing export
│   ├── hxevolve.py         # Process drift detection + proposals
│   ├── hxdraft.py          # Draft-first configuration
│   ├── hxdbmigrate.py      # Legacy DB migration
│   ├── portal.py portal_customers.py messages.py
│   ├── case_variables.py   # Case Variables v2
│   └── ...                 # hxguard, hxlogs, hxcanvas, hxtest, checkout, …
├── marketplace/            # Grants, runtime, egress host-filter
├── engine/
│   ├── workflow.py         # Stage transition + step completion logic
│   ├── sla.py              # SLA clock, pause/resume, breach detection
│   ├── graph_engine.py     # HxGraph builder + pgvector sync
│   ├── fusion.py           # HxFusion rule evaluation
│   └── shield.py           # HxShield risk scoring background task
└── tests/                  # Phase-scoped suites, SQLite + PostgreSQL

migrations/postgresql/      # Plain .sql, 0001 > 138 (repo root)
migrations/mysql/           # Frozen baseline (PG 001 > 154) + seeds + 155 onward

studio Directory Layout

studio/src/
├── portals/
│   ├── customer/           # Customer Portal (/portal)
│   ├── agent/              # Agent Desk (/agent)
│   ├── manager/            # Manager Dashboard (/manager)
│   └── studio/             # Admin Studio (/)
├── modules/
│   ├── hxnexus/            # AI assistant panel
│   ├── hxstream/           # Activity feed (SSE)
│   ├── hxwork/             # Kanban + sprint board
│   ├── hxbranch/           # Version control UI
│   ├── hxgraph/            # D3.js force graph + browse
│   ├── hxconnect/          # Integration suite tabs
│   ├── hxanalytics/        # BI dashboard
│   ├── hxdeploy/           # Deployment swimlane
│   ├── hxmigrate/          # BPM migration UI
│   ├── hxdbmigrate/        # Legacy database migration
│   ├── hxfusion/           # Adaptive execution rules
│   ├── hxshield/           # Fraud detection + review queue
│   ├── hxreplay/           # Counterfactual replay + costing
│   ├── hxcanvas/           # Whiteboard
│   ├── hxdocs/             # Auto-documentation
│   ├── hxlogs/             # Log explorer
│   ├── hxdbmanager/        # Database administration
│   ├── hxtest/             # Test Suite + HxTest app
│   ├── hxcheckout/         # Checkout flows
│   ├── hxstorefront/       # Storefront admin + public pages
│   ├── marketplace/        # App browse, install, grants
│   ├── process-mining/     # Variants, bottlenecks, HxEvolve insights
│   ├── compliance/         # Certificates + audit anchors
│   └── portal/             # Portal v2 configuration
├── components/             # Shared UI components
├── hooks/                  # React hooks
├── stores/                 # Zustand state stores
├── api/                    # API client functions (typed)
└── branding.ts             # Theme + branding tokens

Tech Stack

LayerTechnologies
FrontendReact 18, TypeScript 5, Vite 5, TailwindCSS, D3.js, Zustand
BackendPython 3.12, FastAPI, SQLAlchemy 2, Pydantic v2, plain SQL migrations
AIAI API (configured model), embedding model / pgvector
DatabasePostgreSQL 16 with pgvector (default); MySQL / MariaDB also supported
Realtime mediaLiveKit (optional, for embedded HxMeet video and screen share)
App isolationDocker with digest-pinned images, internal networks, CONNECT egress proxy
Cache / RealtimeValkey 8 (pub/sub for SSE streams)
AuthJWT RS256 (RSA-2048), bcrypt, WebAuthn passkeys, SSO SAML/OIDC; secrets via OpenBao
Dev toolinguv (Python pkg mgr), ruff (linter), pyright, vitest, playwright

Auth Flow

POST /api/v1/auth/login {email, password} (through the gateway on :8200) | v case-service verifies credentials (bcrypt) | v Issues an access token (JWT) + a refresh token (httpOnly cookie) | v Client stores the access token in localStorage as velaris_token | v Every API request: Authorization: Bearer <access_token> (via the gateway) | v case-service validates the JWT locally (no extra round-trip) Claim extraction: sub=user_id, role, access_group_id, tenant_id | v On 401 (expired): frontend calls POST /api/v1/auth/refresh > new access_token
JWT validation is local. case-service verifies the signature itself — there is no separate auth service and no per-request callback. In RS256 mode (recommended) only case-service holds the private key; other components verify with the public key and cannot mint tokens.
Access tokens last 15 minutes and refresh silently. A 401 triggers a refresh attempt before any logout, a proactive timer rotates the token ahead of expiry, and open tabs stay in sync through cross-tab storage events. Users are not signed out every quarter hour.
MCP tokens are not session tokens. A token minted for an external agent carries token_use=mcp and is rejected platform-wide by the normal user lookup. It works only against the Operator surface, only within its granted scope, and can be revoked instantly.