Design a Crypto Portfolio Purchase Experience
Design a Buy modal, purchase submission and version-aware portfolio refresh on top of a supplied trading backend.
Problem statement
For this exercise, assume signed-in users have a cryptocurrency portfolio page and an existing trading backend.
Design the browser and application-adapter experience: a Buy button opens a modal, the user selects a supported coin and enters an amount, Place order submits the purchase, and the portfolio refreshes to reflect the completed result.
The modal, coin/amount selection, order placement and portfolio refresh come from the reported design task; the backend contract, workload and reliability rules below are practice assumptions.
Treat the trading backend as supplied. It owns balances, pricing, buying-power checks and purchase execution. The amount is a positive decimal quantity in the selected coin's units; the supported-coin catalog supplies allowed precision.
A submission has one account-scoped client request ID bound to an immutable coin/amount payload. Repeating that same ID and payload returns the same logical order; changing the payload under it returns a conflict. Order status is pending, completed or rejected.
A timeout may leave the order outcome unknown and is not proof that the purchase failed. The backend supports status lookup by the same request ID and retains these identities for seven days.
A completed order includes a portfolio version. The supplied portfolio API can return a snapshot at least that version or report that it is not ready yet.
The browser must not show a completed purchase against an older snapshot, add a guessed holding optimistically, or replace a newer displayed snapshot with a late older response. During pending, rejected, unavailable or unknown outcomes, show clear status and a safe next action.
Refreshing the page or switching accounts must not accidentally submit the same unresolved intent as a new purchase or display another account's portfolio.
Focus on modal and page state, client/service contracts, request coordination and the frontend-to-backend boundary. Do not design an exchange matching engine, trading strategy, market-data feed, custody system, deposits, selling, cancellation, charts or recommendations.
Visual styling and an exact frontend framework are not prescribed.
What to build
- A user views their portfolio, opens a Buy modal, selects a supported coin and enters an amount with clear input feedback.
- The interface submits one immutable purchase intent and presents pending, completed, rejected or unknown outcomes with a safe recovery path.
- After completion, the page obtains the required portfolio version without stale-response regression, guessed holdings or cross-account leakage.
At scalePractice assumption
- 20,000 active sessions produce peaks of 5,000 portfolio reads and 200 purchase submissions per second.
- The catalog has 200 supported coins and each portfolio has at most 100 holdings; amount precision is supplied per coin.
- A healthy initial portfolio view is usable within two seconds and a completed order becomes visible in its portfolio within five seconds when dependencies are healthy.
- Backend request identities remain recoverable for seven days; a timeout or expired recovery record is not permission to create a replacement purchase.