How tejaswee-06/bnb26_twopointers_internal_round works
FairDrop is a ticket-drop platform: customers join a fair pre-queue, receive a randomized rank, pass controlled admission, reserve and confirm inventory, then verify the result. The authoritative FastAPI backend owns this flow; the Next.js site proxies live requests, while its separate browser simulator supports an attack lab. An advisory ML service supplies RiskEvents to deterministic policy enforcement, and organizers operate the drop through an admin console. The graph follows documented flows and indexed source references; several frontend and API subsystem internals were not sampled, so their detailed links are omitted.
Main entry points: api FastAPI routes · service.py Policy ingestion · session_service.py Session lifecycle · inventory_repository.py Inventory repository
Components 21
Customer experience
- Customer site
frontend/app/(site) - Live API proxy
frontend/app/api/fd/[...path]/route.ts
Authoritative backend
- FastAPI routes
backend/app/api - Session lifecycle
backend/app/services/session_service.py - Fair drop lifecycle
backend/app/services/drop_service.py - Queue store
backend/app/queue/store.py - Allocation service
backend/app/services/allocation_service.py - Inventory repository
backend/app/repositories/inventory_repository.py - Authoritative database
backend/app/db/database.py - Session records
backend/app/models/session.py - Inventory records
backend/app/models/inventory.py
Risk and policy
- Policy ingestion
backend/app/policy/service.py - Deterministic policy
backend/app/policy/engine.py - ML evidence API
ml_api/main.py - Audit telemetry
backend/app/telemetry/service.py
Operations and simulation
- Organizer console
frontend/app/admin/(console) - Attack simulator
frontend/lib/engine/drop.ts - Resilience controller
backend/app/resilience/controller.py - Expiry worker
backend/app/workers/expiry.py
Other components
- Customer
- Organizer
Connections 26
- Customer → Customer site: uses
- Customer site → Live API proxy: requests live API
- Live API proxy → FastAPI routes: proxies requests
- Organizer → Organizer console: operates
- Organizer console → Live API proxy: uses proxy
- Customer → Attack simulator: runs attack lab
- FastAPI routes → Session lifecycle: handles sessions
- FastAPI routes → Fair drop lifecycle: controls drops
backend/app/api/admin.py - FastAPI routes → Allocation service: requests allocation
backend/app/api/allocation.py - Session lifecycle → Fair drop lifecycle: advances phase
backend/app/services/session_service.py - Session lifecycle → Queue store: reads queue
backend/app/services/session_service.py - Fair drop lifecycle → Queue store: writes ranks
backend/app/services/drop_service.py - Allocation service → Inventory repository: claims inventory
backend/app/services/allocation_service.py - Inventory repository → Inventory records: updates inventory
backend/app/repositories/inventory_repository.py - Inventory repository → Authoritative database: queries records
backend/app/repositories/inventory_repository.py - Session lifecycle → Session records: reads and writes
backend/app/services/session_service.py - Session records → Authoritative database: persists in
backend/app/models/session.py - Allocation service → Policy ingestion: checks policy
backend/app/services/allocation_service.py - Policy ingestion → Deterministic policy: evaluates event
backend/app/policy/service.py - ML evidence API → Policy ingestion: supplies RiskEvents
- Policy ingestion → Authoritative database: stores decisions
backend/app/policy/service.py - Policy ingestion → Queue store: enforces policy
backend/app/policy/service.py - Policy ingestion → Audit telemetry: records activity
- FastAPI routes → Resilience controller: exposes controls
- FastAPI routes → Expiry worker: starts worker
backend/app/main.py - Expiry worker → Inventory repository: expires holds