Skip to content

[Docs] Document event-indexing and real-time data flow in ARCHITECTURE.md #466

@ogazboiz

Description

@ogazboiz

Join the discussion on Telegram

Why this matters

docs/ARCHITECTURE.md exists but does not explain the backend's event-indexing and real-time data path, which is the most confusing part of the system for new contributors. Specifically, the docs don't cover:

  • How on-chain events flow: Soroban RPC → SorobanEventWorker (backend/src/workers/soroban-event-worker.ts) → Prisma StreamEvent/Stream tables → SSE broadcast → frontend useStreamEvents.
  • The dedup model (@@unique([transactionHash, eventType])) and the indexer cursor/IndexerState mechanism.
  • How the read path falls back to live RPC when DB rows are stale (isStale in backend/src/services/sorobanService.ts).
  • The custodial vs. wallet-signed action split (top-up uses a server KEEPER_SECRET_KEY; withdraw/pause/resume currently only simulate server-side and the real tx is signed by the frontend).
  • Which secrets are required to run the full stack end to end.

Without this, contributors duplicate work or wire actions incorrectly.

Acceptance criteria

  • Add an "Event indexing & real-time updates" section to docs/ARCHITECTURE.md with a simple data-flow diagram (RPC → worker → DB → SSE → UI).
  • Document the dedup constraint, the IndexerState cursor, and the stale-read RPC fallback.
  • Document the action signing model (which calls are server-submitted vs. wallet-signed) so contributors don't mis-wire endpoints.
  • List the required env/secrets to run the full flow, linking to backend/.env.example.

Files to touch

  • docs/ARCHITECTURE.md

Out of scope

  • Code changes to the indexer or signing model.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programdocsDocumentationgood first issueGood for newcomers

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions