This document maps the VaultQuest stack and shows how the frontend,
wallet, backend, Soroban contracts, Stellar network, and indexer flow
connect to deliver the create, join, drip, claim, and withdraw
user journeys.
VaultQuest separates the stack into three authoritative layers:
- Soroban contract state — true source of vault balances, deposits, positions, prize eligibility, and claim/withdraw outcomes.
- Backend / indexed state — authoritative history of user intents, reconciled contract events, subscriptions, payout records, and dashboard rollups.
- Frontend local state — optimistic transaction state, form input, and UI-only caching while the network confirms.
flowchart TD
subgraph FRONTEND[VaultQuest frontend]
UI[UI components]
Wallet[stellar-wallet-connect wallet layer]
end
subgraph BACKEND[Backend action ledger]
API[Fastify API\nPOST /actions\nPATCH /actions/:id/submitted\nGET /actions]
Reconcile[Internal reconcile\nPOST /internal/reconcile]
DB[(Postgres ledger)]
end
subgraph INDEXER[Event indexer]
Reader[Contract event poller]\n(Event source)
end
subgraph STELLAR[Soroban / Stellar network]
Horizon[Horizon / RPC endpoint]\n(public or private RPC)
Contract[DripPool Soroban contract]\n(create/join/drip/claim/withdraw)
end
UI -->|intent + query| API
UI -->|wallet transaction| Wallet
Wallet -->|sign & broadcast tx| Horizon
Horizon -->|execute tx| Contract
Contract -->|emit events| Horizon
Horizon -->|event stream| Reader
Reader -->|reconcile payload| Reconcile
Reconcile -->|write index| DB
API -->|read/write actions| DB
UI -->|poll status| API
UI -->|read contract state| Horizon
The following flow applies to the core actions create, join, drip,
claim, and withdraw.
sequenceDiagram
participant User as User
participant Frontend as Frontend
participant Wallet as Wallet
participant Backend as Backend
participant Horizon as Horizon
participant Contract as SorobanContract
participant Indexer as EventIndexer
User->>Frontend: trigger create/join/drip/claim/withdraw
Frontend->>Backend: POST /actions (intent)
Frontend->>Wallet: sign and submit transaction
Wallet->>Horizon: broadcast signed transaction
Horizon->>Contract: execute Soroban call
Contract->>Horizon: emit Soroban event
Indexer->>Horizon: read contract event stream
Indexer->>Backend: POST /internal/reconcile
Backend->>DB: update action history + reconciled state
Frontend->>Backend: GET /actions/:id (poll status)
Frontend->>Horizon: read updated contract state
VaultQuest relies on event-driven reconciliation so that backend intent records and contract state stay aligned.
- A signed transaction is submitted by the frontend wallet to Stellar.
- The Soroban contract executes and emits structured events.
- The indexer reads those events from Horizon / the Soroban RPC.
- The indexer posts a reconciled payload to
POST /internal/reconcile. - The backend matches the event to the pending intent record and updates the ledger.
This makes the backend service a reliable view of user actions even when the frontend reconnects, reloads, or polls later.
The contract is authoritative for:
- Vault totals, prize pool size, and yield accounting.
- User deposit and position state.
- Prize draw results, claim eligibility, and withdraw outcomes.
- Contract event emission for every
create,join,drip,claim, andwithdrawtransaction.
The backend is authoritative for:
- Action intent lifecycle tracking (
pending,submitted,confirmed). - Subscription scheduling and drip history.
- User dashboard rollups and activity history.
- Event reconciliation and privacy-safe action records.
The frontend is authoritative for:
- Optimistic transaction state and pending UX flows.
- Wallet connection state and signed transaction submission.
- Local view state until the backend or contract confirms final results.
VaultQuest deployments are boundary-driven by configuration:
- Wallet + frontend read from browser-safe Horizon/Soroban environment values
such as
NEXT_PUBLIC_HORIZON_URLandPUBLIC_SOROBAN_NETWORK_PASSPHRASE. - The action ledger backend is configured by server-only values such as
DATABASE_URL,INTERNAL_SERVICE_SECRET, andPORT. - Contract IDs and network endpoints are injected per deployment, not hard-coded in application logic.
docs/STATE_MODEL.md— contract, backend, and frontend state ownership and data model definitions.docs/env-inventory.md— frontend and backend configuration boundaries.backend/docs/ARCHITECTURE.md— backend service layout and reconciliation details.