Skip to content

[Backend] Event-driven indexer service #39

Description

@Gbangbolaoluwagbemiga

Problem

The frontend reconstructs state by polling RPC/Horizon (see #9). This is laggy, RPC-heavy, and can't
power search, leaderboards, or off-chain reputation aggregation. An indexer that consumes the
contract events (#5) solves all of these.

What needs to be done

  • Service that ingests SecureFlow contract events (from [Contract] Emit structured events for all state transitions #5) — e.g. subscribe to Horizon/RPC,
    decode XDR, persist to a database (Supabase already in the stack)
  • Tables for escrows, milestones, applications, ratings, disputes — kept in sync from events
  • Read API for the frontend: list/search jobs, dashboard aggregates, reputation rollups
  • Backfill from genesis + resume from last-processed ledger (idempotent, handles reorgs)

Acceptance criteria

  • Indexer stays in sync with on-chain state (verified against direct contract reads)
  • Frontend dashboards/search read from the indexer, not raw polling
  • Restart resumes without gaps or double-processing

Relevant files

backend/src/, supabase/migrations/, consumes events from #5; unblocks #9

Depends on #5 (events).

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendNode/Supabase backendfeatureNew product capability

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions