Skip to main content

Platform Architecture

This page explains how the pieces of Rug Munch Intelligence fit together — useful if you're integrating deeply, evaluating the platform, or self-hosting parts of the stack.

✅ Live-platform facts on this page verified against production on 2026-08-24.

The big picture​

┌────────────────────────────── Clients ──────────────────────────┐
│ rugmunch.io (React web app) │
│ AI agents via MCP (Claude, Cursor, opencode) │
│ Your services via REST / WebSocket │
│ @rugmunchbot (Telegram) │
└──────────────────────────────┬──────────────────────────────────┘
│
┌──────────────────────────────▼──────────────────────────────────┐
│ RMI Backend (FastAPI monolith) │
│ │
│ Interfaces: REST · WebSocket · MCP (JSON-RPC/SSE) · Telegram │
│ Domains: │
│ • Scanner v2 (multi-engine token/wallet risk) │
│ • x402 Tools (pay-per-call security/intel tools) │
│ • RugMaps (entity graphs, fund flows, clusters) │
│ • RugCharts (OHLCV, TA, threat signals) │
│ • Wallet Intelligence (labels, PnL, clusters) │
│ • Alerts (webhooks, SSE stream, Telegram push) │
│ • Auth (better-auth sessions; legacy JWT in maintenance) │
├──────────────────────── x402 Gateway ───────────────────────────┤
│ HTTP 402 → signed micropayment → facilitator settlement │
│ 7 facilitators · 13 payment chains · per-call pricing │
├──────────────────────── DataBus (data layer) ───────────────────┤
│ One interface, many independent providers. Per data type, one │
│ is primary and the rest stand in automatically when it fails. │
│ Degraded sources are reported in X-Degraded-Stores. │
└───────┬──────────────┬───────────────┬──────────────┬───────────┘
│ │ │ │
┌───────▼──────┐ ┌─────▼──────┐ ┌──────▼──────┐ ┌────▼─────────┐
│ ClickHouse │ │ RugBrain │ │ Neo4j │ │ Postgres / │
│ 283M+ rows │ │ (RAG) │ │ entity graph│ │ Redis │
│ transfers, │ │ 57 vector │ │ clusters, │ │ sessions, │
│ swaps, DEX │ │ collections│ │ labels │ │ billing │
└───────▲──────┘ └─────▲──────┘ └─────────────┘ └──────────────┘
│ │
┌───────┴──────┐ ┌─────┴──────────────────────────────────────┐
│ Lite Chain │ │ External providers (28): market data, │
│ Indexer │ │ on-chain state, security intel, entity │
│ free RPCs, │ │ labels — independent sources, no single │
│ 21 networks │ │ vendor in the critical path │
│ in prod │ │ │
└──────────────┘ └────────────────────────────────────────────┘

Design decisions that matter​

Monolith over microservices​

One FastAPI application serves every domain. At our scale this beats a microservice mesh: simpler deploys, no cross-service auth overhead, one OpenAPI spec. Domain boundaries are enforced in code (router modules), not in network hops.

DataBus as the single data layer​

No domain code calls upstream APIs directly. Everything goes through DataBus, which owns provider selection, caching, failover, rate-limit handling, and health tracking. When a provider dies mid-day, your scan doesn't — the next provider in the chain answers, and X-Degraded-Stores tells you which.

Multi-source risk scoring​

Risk scores are ensembles, not single-source opinions: a token is examined across contract, liquidity, holder, deployer and trading structure, and every input carries a confidence tier so a weak source cannot silently outvote a strong one. The response reports the areas it scored and the flags it found (what a rating tells you); the weighting itself is not published.

Pay-per-call via x402, not subscriptions​

The x402 gateway turns HTTP 402 into on-chain settlement. This removes the entire API-key/billing/subscription subsystem for paid usage: your wallet signature is the account.

Free-first data infrastructure​

Lite Chain Indexer proves the platform's raw data layer can run at zero marginal cost on free public RPCs — which is why the platform's unit economics work at $0.01–$0.50 per call.

The product repos​

ProductRepoRoleLicense
RMI backendrmi-backendThe platform (private core)Proprietary core
Web apprmi-frontendrugmunch.io UIProprietary - access on request
Scanner enginerugmunch-scannerDetectors + scoring engineMIT
RugBrainrugbrainRAG intelligence layerMIT
Lite Chain Indexerlite-chain-indexerMulti-chain indexingMIT

RugMaps and RugCharts began as standalone engines and now run as first-class domains inside the backend (/api/v1/rugmaps/*, /api/v1/rugcharts/*).

Reliability posture​

  • Health surfaces everywhere: /health, /live, /ready, per-domain health endpoints (/rugmaps/health, /rugcharts/health, DataBus health).
  • Graceful degradation: endpoints return structured "no data" responses ({"data": null, "reason": "no_data", "sources_tried": [...]}) rather than fabricating values — and empty paid results are refundable.
  • Observability: request IDs (X-Request-ID), response timing headers, degraded-store reporting, rate-limit headers.