Skip to content

Backend Overview

Main services

  • ft.api.app - public API (/api/v1/... + health + metrics).
  • ft.admin_panel.app - independent operational UI/API for service state.
  • Workers (ft.worker) - background processing pipeline.

Data flow

flowchart LR
    A[Polygon/Ton Adapters] --> B[ingest.raw_events]
    B --> C[ledger.normalized_events]
    C --> D[market tables]
    D --> E[projection tables]
    C --> F[system.outbox_events]
    F --> G[Redis Streams]
    G --> H[Worker consumers]

Worker tasks

  • normalizer_polygon - consumes polygon raw stream and normalizes events.
  • normalizer_ton - consumes ton raw stream and normalizes events.
  • state_updater - updates ownership/market state from normalized stream.
  • projection_updater - updates read models from ownership-changed stream.
  • outbox_publisher - publishes pending outbox records, writes to DLQ on failures.

Stream names

  • chain.polygon.raw_events
  • chain.ton-mainnet.raw_events
  • ledger.normalized
  • ledger.ownership_changed

Key modules

  • Ingestion adapters: src/ft/ingest/polygon, src/ft/ingest/ton
  • Pipeline logic: src/ft/pipeline
  • Worker runtime + Redis streams: src/ft/worker
  • SQLAlchemy models: src/ft/core/models
  • SQL migrations: migrations/*.sql