System Design: Donations Platform for a Three-Day Global Fundraising Campaign
Context
You are to design an internet-scale donations platform for a time-bounded, three-day global fundraising campaign. The platform must handle significant traffic spikes during live events, provide real-time visibility into totals and leaderboards, ensure payment correctness, and remain highly available across regions.
Requirements
Design and specify the following:
-
Functional APIs
-
Create donation (intent), confirm payment, refund.
-
Query: totals and leaderboards (by campaign, country, team, etc.).
-
Data model
-
Core entities (campaign, donation, payment, refund, donor/PII segregation, ledger), indexes, and unique constraints.
-
Idempotency and deduplication
-
Strategy for client retries and provider webhook retries; prevention of double-submits.
-
Real-time totals and leaderboards
-
Running totals with sub-second updates; unique donors, top teams/countries.
-
Risk controls
-
Fraud checks and deduplication heuristics; velocity limits.
-
Traffic protection
-
Rate limiting, backpressure, and load shedding.
-
Webhooks
-
Handling delayed/out-of-order/duplicated payment provider webhooks and reconciliation.
-
Scalability and availability
-
Design for global traffic spikes; multi-region availability; explicit consistency trade-offs.
-
Storage and partitioning
-
OLTP vs. streaming/warehouse; partitioning, replication, and hot campaign handling.
-
Caching
-
Strategy for campaign config, totals, and leaderboards.
-
Streaming and analytics
-
Near-real-time pipelines for metrics and BI.
-
Observability
-
Metrics, logs, traces, dashboards, and alerting.
-
Failure scenarios
-
Payment provider outage, double-submits, partial failures; recovery and user experience.
-
Capacity estimates
-
Back-of-the-envelope RPS/QPS, storage, throughput; latency budgets.
-
Rollout and testing
-
Phased rollout, load tests, chaos/failure drills, and monitoring gates.