Conduit is a high-performance, event-driven microservices ecosystem designed for real-time fintech data processing, anomaly detection, and automated remediation.
- Node.js >= 20.0.0
- Docker & Docker Compose
- Kafka Cluster (via Docker)
# Install dependencies
npm install
# Start infrastructure (Kafka, Postgres, Redis, TimescaleDB)
docker-compose up -d
# Run all services in development mode
npm run dev:all- 1. System Architecture
- 2. Kafka Topic Design
- 3. Ingestion Service
- 4. Incident Service
- 5. Remediation Service
- 6. Metrics Service
- 7. Query Service
- 8. WebSocket Service
- 9. Tech Stack & Structure
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENTS β
β (Web Dashboard Β· Mobile Β· Partner APIs Β· CLI) β
βββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββ
β HTTPS (REST) β WSS (persistent)
βΌ βΌ
ββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββ
β β API GATEWAY (:4000) β β β¦ WEBSOCKET SERVICE (:4006) β
β β β β
β β’ Auth / Rate Limit β β β’ Real-time Fan-out β
β β’ Request Routing β β β’ Client Room Management β
ββββββββ¬βββββββββββββ¬ββββββββββ ββββββββββββ²ββββββββββββββββββββββββ
β β β Consume
β HTTP β HTTP β
βΌ βΌ β
ββββββββββββββ βββββββββββββββ β
β β‘ INGEST β β β₯ QUERY β β
β SERVICE β β SERVICE β β
β (:4001) β β (:4004) β β
β β β β β
β β’ Write Gt β β β’ Read Modelβ β
βββββββ¬βββββββ ββββββββ²βββββββ β
β β β
β Produce β Read (Materialized) β
βΌ β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β’ KAFKA EVENT BUS β
β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββ
β β conduit.events β β conduit.metrics β β conduit β β conduit ββ
β β .ingested β β .computed β β .incidents β β .remediations ββ
β ββββββββββ¬βββββββββ ββββββββββ²βββββββββ βββββββββ¬ββββββββββ βββββββββ²βββββββββββ
β β β β β β
βββββββββββββΌββββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββββΌβββββββββββ
β β β β
ββββββββ΄βββββββ βββββββ΄βββββββ ββββββββ΄βββββββ ββββββββ΄βββββββ
β Consume β β Produce β β Consume β β Produce β
βΌ βΌ β β βΌ βΌ β β
ββββββββββββ βββββββββββββ β ββββββββββββ βββββββββββββ β
β β£ METRIC β β β€ INCID. ββ β β β§ REMED. β β β€ INCID. ββ β
β SERVICE β β SERVICE ββ β β SERVICE β β SERVICE ββ β
β (:4003) β β (:4005) ββ β β (Auto) β β (CRUD) ββ β
ββββββββββββ ββββββββββββ β ββββββββββββ ββββββββββββ β
β β β
ββββββββββ΄ββββββββββββββββββββββββββββββββ
| Service | Primary Responsibility | CQRS Role | Communication |
|---|---|---|---|
| API Gateway | Perimeter security, routing | Entry Point | HTTP (Inbound) |
| Ingestion | Write validation, enrichment | Command | Kafka (Outbound) |
| Kafka Bus | Persistent event log | Message Hub | Event Stream |
| Metrics | Pure aggregation / windowing | Processor | Kafka (In/Out) |
| Incident | Detection / Status CRUD | Processor | Kafka (In/Out) + HTTP (Reads) |
| Remediation | Autonomous corrective actions | Actor | Kafka (In/Out) |
| Query | High-perf materialized reads | Query | HTTP (Outbound) |
| WebSocket | Live state synchronization | Push | WSS (Outbound) |
| Topic | Partitions | Key | Retention | Compression | Cleanup Policy |
|---|---|---|---|---|---|
conduit.events.ingested |
12 | tenantId |
7 days | Snappy | delete |
conduit.metrics.computed |
6 | tenantId |
3 days | Snappy | compact+delete |
conduit.incidents.events |
6 | tenantId |
30 days | Snappy | delete |
conduit.ml.predictions |
6 | tenantId |
14 days | Snappy | delete |
conduit.remediations |
3 | tenantId |
30 days | Snappy | delete |
| Group ID | Service | Subscribed Topics |
|---|---|---|
conduit-metrics-group |
Metrics Service | events.ingested |
conduit-query-group |
Query Service | events.ingested, metrics.computed, incidents.events, ml.predictions |
conduit-incident-group |
Incident Service | events.ingested, metrics.computed, ml.predictions |
conduit-websocket-group |
WebSocket Service | events.ingested, metrics.computed, incidents.events, remediations, ml.predictions |
conduit-remediation-group |
Remediation Service | incidents.events |
The entry point for all raw events. Optimized for high throughput and durability.
- Persistent Producer: Zero TCP/TLS handshake overhead per request.
- Redis Idempotency:
SETNXwith 24h TTL to prevent duplicate processing. - Batch Support:
POST /ingest/batchfor up to 500 events in one round-trip. - Snappy Compression: Optimized for network throughput.
Anomaly detection and lifecycle management engine.
DETECTED β ACTIVE β RESOLVED
- Detected: Initial trigger from threshold breach or ML anomaly.
- Active: Acknowledged by operator or auto-escalated.
- Resolved: Condition cleared or manual fix confirmed.
- Threshold Detector: Monitored via
metrics.computed(Error Rate, P95, Success Rate). - ML Detector: Monitored via
ml.predictions(Anomaly Score, Label Classification).
Autonomous corrective actor that executes fixes when high-severity incidents are detected.
- Exponential Backoff: 2s Γ 2^n + jitter, max 3 retries.
- Action Registry:
auto_rollback(Error Rate)scale_out(Latency)health_check_sweep(Success Rate)adaptive_throttle(ML Anomaly)
Pure aggregation pipeline for windowed statistical snapshots.
- Sliding Window: 1-minute window with p50/p95/p99 percentiles.
- Dual-Write Path:
- Hot Path: Instant Kafka snapshots for live dashboards.
- Cold Path: TimescaleDB hypertable with tiered retention (7d raw β 90d agg).
The read-side of the CQRS pattern. Optimized for sub-200ms materialized views.
- PostgreSQL: Structured events, incidents, and remediations.
- MongoDB: Schema-less ML predictions and feature vectors.
- Redis: Hot-path metrics and 30s query cache.
Scalable real-time push service using Redis Pub/Sub for horizontal fan-out.
- Horizontal Scaling: Redis Pub/Sub fanz messages to all pods.
- Backpressure: Drops clients exceeding 64KB buffer to protect the event loop.
- Latency Tracking: End-to-end SLA tracking in every message envelope.
| Component | Technology |
|---|---|
| Language | Node.js (ESM) |
| Messaging | Apache Kafka |
| Databases | PostgreSQL, TimescaleDB, MongoDB, Redis |
| Testing | Jest |
.
βββ packages/ # Shared libraries (Kafka, Errors, Auth)
βββ services/ # Microservices
β βββ api-gateway/ # Entry Point
β βββ ingestion-service/ # Command Side
β βββ incident-service/ # Logic/State
β βββ metrics-service/ # Processing
β βββ remediation-service/ # Acting
β βββ query-service/ # Query Side
β βββ websocket-service/ # Real-time Push
βββ infra/ # Docker & DB Config
βββ ...
Conduit β Hardened for Production.