Design a code-snippet sharing service
Move from short links to a product where the stored value is large, most of it expires, and some links must stay secret.
The brief
Developers paste code or logs up to 1 MB, choose an expiry, and get a link. A public link can be shared widely and cached. A private link must be impractical to guess, and it must stop working when it expires or its owner revokes it. Design the first version. Keep full user accounts, comments, version history, and search outside this exercise.
- 2 million new snippets are created per day, and each is read 5 times on average. Peak traffic is 10 times the daily average. Use decimal units and 86,400 seconds per day.
- A snippet averages 20 kB, with a hard limit of 1 MB.
- Half of snippets expire within a day, 40% expire after 30 days, and 10% never expire. Estimate stored text after one year of steady traffic, before replicas and metadata.
- Size keys for five years of creation. Assume an attacker can make 1,000 guesses per second against private links.
- A private link must stop serving within 60 seconds of expiry or revocation. An accepted snippet must survive an application-process crash.
Reading a design isn’t the same as producing one under a clock. Try it timed: the requirement change stays hidden until partway through.
Loading your draft…
State your scope and assumptions. Estimate average and peak create and read rates, bytes written and served per day, stored text after one year, and the key length you need. Keep units visible.
0 / 4,000 charactersName the components and what each stores. Trace one create, one public read, and one private read, including where expiry is checked and where snippet bytes live. An arrow list is enough.
0 / 4,000 charactersChoose a likely bottleneck and the metric that would prove it. Explain what happens if the cleanup job stops for a day, and how a revoked link stops being served within 60 seconds, given any caches you added.
0 / 4,000 charactersRespond to the burn-after-reading change below. Explain how exactly one reader gets the content, how automatic link previews are handled, and what a crash costs.
The requirement changesA customer asks for burn-after-reading links: a snippet is shown to one reader and is then gone. Chat apps and email scanners often fetch links automatically to build previews. What changes in your read path and storage? State what happens if the server crashes just after a snippet is claimed.
0 / 4,000 charactersWrite an initial response in all four sections to unlock the checklist and two worked approaches.
Get critiqued, or get interviewed
SystemKit doesn’t read your answers: they stay in this browser. To get feedback from an AI, copy one of these prompts into a chatbot you already use. Treat what it says as a second opinion, and check anything that sounds too confident.