Sharding & Routing
6 capabilities
Every record lands in one of 32,767 deterministic slots. Add a server and traffic routes itself.
32,767 slots, XXHash, 4 invocation types
Inside
-
XXHash slot sharding across 32,767 slots
Range [1, 32767] PostgreSQL smallint positive; same algorithm in proxy, app, and DB layers
-
DatabaseManager query builder
2,843 lines, 100+ methods; auto slot assignment, parameterized #-placeholders, upsert with detected unique fields
-
Slot-aware cluster calls
ShardedSingle, ShardedMulticast, ShardedBatched, Broadcast - all in a single API; O(log n) slot lookup
-
At-least-once retry with deterministic ensure keys
Durable _replays table; 20-batch tick, 1,000 max retries; 5s initial delay, 15s graceful drain
-
Etcd-backed platform discovery
32K+ line entities file; 30s lock TTL; sequential entity-graph load on startup
-
3-tier leader election
Per-container, per-domain, and per-feature leaders - cert rotation, backups, and coordination never collide
WebSocket & Real-time
5 capabilities
1,308-line gateway, 100ms batched push, 4-state subscription lifecycle.
100ms batches, pub/sub topics, 4-state lifecycle
Inside
-
WebSocket gateway with topic pub/sub
1,308-line gateway, 806-line topic manager; 3-level subscription tree; 100ms batched push
-
Two-phase aggregation pipeline
100ms in-memory aggregation worker + 5,000-item batched persistence every 5min + 500ms broadcast
-
4-state watch lifecycle
Pending → Committed → RePending → Unwatched; exponential backoff 2s-20s; reconnect on auth change
-
Debounced diff broadcasting
500ms handler + 500ms global level prevents request storms on multi-tab idle re-activation
-
Self-hosted snapshot manager
4,364 lines; temporal sampling (hourly / daily), spatial binning (per-market, per-asset), gap healing
Security & PKI
7 capabilities
Our own certificate authority, mTLS by default, three token types - and a danger token locked to one operation on one resource.
Own PKI, mTLS default, AAD-bound secrets
Inside
-
Token barriers for real-time revocation
450-line manager, 60s eviction worker; per-user / per-IP / per-pool revocation
-
Three-tier token system
Outer 60min-24h, inner 5-20min self-renewing, danger 10min locked to one operation on one resource
-
AES-256-GCM with AAD context binding
404-line SecretManager; AAD = id:name; a secret for container A cannot decrypt as B
-
CFSSL internal PKI with ECDSA P-384
592-line wrapper; 5-year CA, 3-year child certs; no internet PKI dependency
-
mTLS certificate distribution
602-line handler, 6 cert types; SHA256-signed timestamp with ±10s window
-
Dual-layer permission model
516-line permission core; platform hierarchy crossed with pool hierarchy
-
Ray-ID error tracking
Every internal error carries a ray ID returned to the client for distributed-fleet tracing
Cluster & State
5 capabilities
4 granularity levels of state across container, feature, app-feature, and application. Drain one shard while the rest keeps trading.
4-level state machines, 16-state app lifecycle
Inside
-
4-level state machines
Platform / Feature / ApplicationFeature / Application states; 16 transitions on Application (Init → Deploying → … → Exited)
-
Traefik mTLS mesh
530-line Traefik wrapper, 710-line proxy manipulator; mTLS by default (RequireAndVerifyClientCert)
-
3-tier rate limiting
API, WebSocket, Static tiers each with separate burst / average / period configurable in PlatformInfo
-
Heartbeat metrics every 60s
715-line ticks manager; CPU user / system, memory RSS / heap, event-loop lag, warn / error counters - no Prometheus dependency
-
Cluster class with 1,088 lines
Four invocation types over mTLS - ShardedSingle, ShardedMulticast, ShardedBatched, Broadcast - in one API
AI Provider Layer
5 capabilities
Aggregated catalog, encrypted secret vending, per-provider circuit breaker, three-tier memory.
Circuit breaker, AAD-bound secrets, three-tier memory
Inside
-
Multi-provider LLM transport
1,896-line provider helper; 5 failures / 60s opens breaker, 30s half-open; full-jitter exponential backoff
-
Aggregated AI catalog
1,680-line admin handler; orchestrator flavors Miro1 (default) / Piro1 / Piro2 / Local
-
Encrypted secret vending
Provider secrets AES-256-GCM, column-side; catalog changes broadcast to every shard under 1s
-
Three-tier memory
Session (16K chars / 40 entries), user (10K / 60), pool (10K / 60) - independent sharding axes
-
MCP gateway
Session-scoped servers wired into 14 sibling clusters; tools split by permission level (Associate / Moderator)
HTTP & API Framework
5 capabilities
Every list endpoint speaks the same query language. One SDK pattern works across every resource.
Versioned /v1, 14-cluster reach, scoped keys
Inside
-
Versioned /v1 partner API
1 service reaching 14 sibling clusters; 10 outer handlers under /platform-api/:anyKey/v1
-
API key scoping by feature group
Public groups (assets, markets, exchanges, blockchain) open data; private (trading, vaults, strategies, nodes, pools) require scoped keys
-
API key lifecycle integrated with user / pool
Delete a user or pool and their API keys revoke in the same operation - no orphan credentials
-
Standardized list-endpoint framework
1,203-line handler framework; 10-500 pagination, 256-char search cap, typed error responses
-
Excel export with formulas
188-line helper; live formulas, total-row support, in-memory buffer - no third-party service
Data & Aggregation
5 capabilities
Same engine pulls Binance ticker data, Uniswap gas prices, and Fed policy rates.
Hot 100ms + cold 5min, 16+ fetcher types
Inside
-
Two-phase aggregation pipeline
Hot data 100ms in-memory; cold data 5,000-row batches every 5min; broadcast every 500ms
-
Multi-type fetcher fleet
16+ types: CEX market data, DEX (gas, portfolio, token), TradFi (Fed policy, inflation, bond benchmark, M2)
-
Snapshot manager 4,364 lines
Self-hosted time-series engine that any service can opt into; gap healing built-in
-
DatabaseManager
2,843 lines, 100+ methods; auto slot assignment; approximate count/size from pg_class to avoid full table scans
-
Compound sharding for trading pairs
Each pair sharded by both legs - VWAP, best-ask, best-bid, spread co-located and synced within 100ms
Build & Tooling
4 capabilities
Distributed certificate generation, automated container scaling, daily backups - we wrote the operations layer too.
Own load balancer, no Prometheus, daily backups
Inside
-
Codebase linter enforces house style
Built-in validate.config rules: no collections, no console, const usage - machine-checked at every commit
-
Distributed cert generation and management
Including Let's Encrypt; cert rotation hot-reload across the fleet
-
Automated container scaling up / down
Cluster management + networking + resilience + database replication, daily automated backups
-
Context-aware load balancer
In-house Go modifications; DNS-level routing of sharded containers (Users, Pools, Strategies, Exchanges, Markets)