Velaris is a three-service microservices platform with a React single-page application frontend — understand the request flow, data layer design, and authentication mechanics before building integrations or contributing code.
Every user action in a Velaris portal follows this path. The Vite dev server serves the React SPA; API calls go from the browser to a single API gateway (the VITE_API_BASE base URL), which is the only externally exposed door and routes every request to the backend.
Browser (React SPA)
|
| static assets from Vite :5173 (dev) or nginx (prod)
| API calls > /api/v1/...
v
[ API gateway :8200 ] nginx, the single public entrypoint
| routes every /api/v1/* to case-service on loopback :8201
| (analytics, HxGraph, HxMigrate upstreams are pre-wired to split out later)
v
[ case-service :8201 ] FastAPI / Python 3.12, loopback only
| /api/v1/auth/* Auth and SSO (JWT RS256, bcrypt, SAML2 / OIDC, passkeys)
| /api/v1/cases Case lifecycle, workflow, SLA
| /api/v1/graph/* HxGraph (P41 native)
| /api/v1/hxnexus/* HxNexus AI (backed by Ollama)
| /api/v1/mcp HxNexus Operator (JSON-RPC tool surface)
| plus all module APIs
+- [ PostgreSQL :5432 ] JSONB case data, pgvector embeddings, adjacency-list stages
+- [ Valkey :6379 ] session cache, SLA timers, SSE pub/sub, rate limiting
[ Flow engine :8100 ] FastAPI / Python 3.12
durable workflow execution + Temporal worker > [ Temporal :7233 ]
Secrets from OpenBao at startup . documents on disk/S3 . AI backend Ollama :11434
localStorage under the key velaris_token. Every API request includes Authorization: Bearer <access_token> built from that value. The access token TTL is 15 minutes; on a 401 the interceptor attempts a refresh before logging out, and a proactive refresh timer plus cross-tab session sync keeps multiple open tabs on the same rotated token. Logout happens only when the refresh itself fails.
| Service | Port | Runtime | Responsibility |
|---|---|---|---|
api-gateway |
8200 |
nginx | The single externally exposed entrypoint. Routes /api/v1/* to case-service on loopback. Upstreams for analytics, HxGraph, and HxMigrate are pre-wired so those can split into their own services later with no client change. |
case-service |
8201 (loopback) |
Python 3.12 / FastAPI / Uvicorn | The application monolith: authentication, JWT issuance, user / role / SSO management; case lifecycle (create, advance, complete step, assign, close), case type and workflow design APIs, SLA engine, connector invocation, HxGraph endpoints, HxNexus AI, audit logging, HxStream SSE feed, HxDeploy governance. Reachable only via the gateway. |
flow-engine |
8100 |
Python 3.12 / FastAPI / Uvicorn | Durable workflow / process execution and the Temporal worker for SLA timers and long-running orchestration. |
| Frontend (SPA) | 5173 |
Node 20 / Vite / React 18 | All four portals in one SPA. Route-guarded by role. D3.js for HxGraph visualizer. Zustand for state management. TailwindCSS for styling. |
| PostgreSQL | 5432 |
PostgreSQL 16 + pgvector extension | Primary data store for all services. JSONB for case data and form schemas. pgvector for semantic search embeddings. Full-text search via tsvector on case_events. |
| Valkey | 6379 |
Valkey 8 | JWT session cache (fast token validation without DB hit), SLA deadline timers, SSE event pub/sub for HxStream, rate limiting counters |
| Ollama | 11434 |
Local model server | Default AI backend. Keeps HxNexus answers on your own infrastructure — external providers are used only when a tenant explicitly opts in. |
| LiveKit | — | SFU | Optional. Powers embedded HxMeet video and screen share when VELARIS_CASE_MEET_DRIVER=livekit. Bound behind the host firewall; loopback URLs are rewritten to the page host so remote browsers connect. |
| Temporal | 7233 |
Workflow engine | Durable timers and long-running orchestration driven by the flow-engine worker. |
broker-gw |
172.31.101.1:8210 |
nginx | Marketplace Layer 2. The scoped, read-only data path for app containers — token hash-authenticated, tenant-pinned, instantly revocable, every call audited as broker://. |
egress-gw |
internal | CONNECT proxy | Marketplace Layer 2. The only outbound path for app containers, and only to admin-granted domains. Per-container credentials rotated on each start; IP literals and non-global resolutions refused; every attempt audited as egress://. |
Three boundaries carry most of the platform's security weight. Each one fails closed — when a decision cannot be made, access is denied rather than assumed.
| Boundary | Enforced by | Behaviour |
|---|---|---|
| User > platform | HxGuard | A central policy decision point combining role-based and relationship-based rules. Case sharing is expressed as tuples, so a viewer or editor grant is a fact in the store rather than a role hack. Denials are audited. |
| Tenant > tenant | HxVault + tenant scoping | Each tenant holds its own data encryption key, wrapped by a platform KEK. Reads across HxGraph, cases and sealed HxMeet artefacts are tenant-filtered at the query layer, not in the UI. |
| Third-party app > your data | Marketplace L1 / L2 | Layer 1 installs inert connectors under subset-only capability grants with host allowlists and SSRF guards. Layer 2 runs publisher code in digest-pinned hardened containers on an internal network that drops egress by construction — no database credentials are ever issued to the container. |
[ app container ] non-root . read-only fs . cap-drop . seccomp . digest-pinned | no DB credentials, ever | network: velaris-apps (internal: no default route out) | +--> [ broker-gw 172.31.101.1:8210 ] scoped READ-ONLY data, tenant-pinned | token hash-auth . instant revoke . audited as broker:// | +--> [ egress-gw ] CONNECT proxy, OFF by default granted domains only . per-container credentials IP literals refused . audited as egress:// Everything else outbound is dropped by the network, not by policy.
VELARIS_CASE_MARKETPLACE_L2_EGRESS. With the shipped defaults an installed app can read only what its grant allows and can reach nothing at all.Alongside the REST API, case-service exposes a JSON-RPC Model Context Protocol surface at /api/v1/mcp — the HxNexus Operator. It is hand-rolled and stateless, wrapping the same handlers the REST routes use, so a tool call is subject to identical authorization.
| Technology | Version | Role |
|---|---|---|
| React | 18 | Component rendering, concurrent features (Suspense, transitions) |
| TypeScript | 5.x | Type safety across all components, API response types, store definitions |
| Vite | 5.x | Dev server with HMR, optimized production builds, proxy configuration for API calls |
| TailwindCSS | 3.x | Utility-first styling across all portals |
| D3.js | 7.x | HxGraph force-directed visualization, HxAnalytics chart rendering |
| Zustand | 4.x | Global state management (auth state, case queue, notification feed) |
| React Router | 6.x | SPA routing with role-based route guards |
| Technology | Version | Role |
|---|---|---|
| Python | 3.12 | Runtime for all three backend services |
| FastAPI | 0.111+ | HTTP framework: routing, dependency injection, automatic OpenAPI docs |
| SQLAlchemy | 2.x | ORM with async support via asyncpg; used in all services |
| SQL migrations | — | Plain dialect-specific .sql files applied in filename order and tracked in a schema_migrations ledger. No ORM migration framework — see Migrations. |
| Pydantic | v2 | Request/response validation, settings management via pydantic-settings |
| python-jose | 3.x | JWT signing and verification inside case-service |
| bcrypt / passlib | — | Password hashing with salt; used for all stored credentials |
| Technology | Role |
|---|---|
| AI API | Powers HxNexus natural language queries, NLP Builder generation, anomaly explanation, case summaries. Configured via AI_API_KEY. |
| sentence-transformers | Local embedding model for generating vector representations of case data, form schemas, and graph nodes. Model: all-MiniLM-L6-v2 by default. |
| pgvector | PostgreSQL extension storing vector(384) embeddings. Enables cosine similarity search for HxGraph /similar endpoint and semantic case deduplication in HxShield. |
Velaris uses four key data patterns in PostgreSQL that appear repeatedly across the schema. Understanding them is essential for writing migrations and custom queries.
| Pattern | Tables | Why Velaris Uses It |
|---|---|---|
| JSONB for form data | cases.data, forms.schema, connectors.config |
Form schemas evolve independently per case type version. JSONB allows flexible, schemaless storage while supporting GIN index queries like data @> '{"status": "approved"}'. |
| Adjacency list for stage graph | stages, stage_transitions |
Stages form a directed acyclic graph (with loopback edges). stage_transitions stores (from_stage_id, to_stage_id, guard_condition, trigger_type). Traversal is handled in Python, not via recursive SQL. |
| Event sourcing (light) | case_events |
Every state change, step completion, assignment, note, and connector invocation is appended as an immutable event row with event_type, actor_id, payload (JSONB), and created_at. The timeline in the Agent Portal renders directly from this table. |
| pgvector embeddings | graph_node_embeddings, case_embeddings |
HxGraph nodes and case summaries are embedded as vector(384). Cosine similarity queries (<=> operator) power the /graph/similar endpoint and HxShield duplicate detection. |
Auth is built into case-service (reached via the API gateway on :8200; case-service itself listens on loopback :8201) — there is no separate auth service. The /api/v1/auth/* and /api/v1/auth/real/* routers are registered alongside all other case-service routers. The access token is stored in localStorage under velaris_token and sent as Authorization: Bearer on every API request.
Browser gateway :8200 > case-service :8201 Valkey :6379
│ │ │
│ POST /api/v1/auth/login │ │
│ { username, password } │ │
│ --------------------------> │ │
│ │ bcrypt.verify(password) │
│ │ Look up user in DB │
│ │ Sign JWT (expire_days) │
│ │ Store session in Valkey -->│
│ 200 OK { access_token } │ │
│ <------------------------- │ │
│ localStorage.setItem( │ │
│ "velaris_token", token) │ │
│ │ │
│ Subsequent API calls: │ │
│ Authorization: Bearer {token} │ │
│ --------------------------> │ Decode JWT (no network) │
│ │ HS256: verify auth_secret │
│ │ RS256: verify public key │
│ │ Extract user + roles │
│ │ Forward to handler │
│ │ │
│ POST /api/v1/auth/logout │ │
│ --------------------------> │ Delete Valkey session ---->│
│ localStorage.removeItem( │ Token invalidated │
│ "velaris_token") │ │
│ <-------------------------- │ │
auth_secret; any service holding it can also mint tokens. In RS256 mode (recommended for production), only case-service holds the private key — other services verify with the public key only and cannot mint tokens. Switch to RS256 by setting VELARIS_CASE_AUTH_RSA_PRIVATE_KEY and VELARIS_CASE_AUTH_RSA_PUBLIC_KEY. Case-service logs a startup warning when running in HS256 mode.