Skip to content
Absterrg0Public

Latest commit

 

History

254 Commits

Folders and files

Repository files navigation

SysGeeks: free system design interview practice

sysgeeks.com · Start a free URL shortener practice round · Take a free timed mock interview · Practise system design interview questions on real systems: a URL shortener, a rate limiter, a news feed, a payment system, ride-sharing dispatch, a distributed cache and more. Each one is worked through in stages: you make a design decision, see the engineering reasoning, break the system with a failure, change a constraint, and defend what is left. Free, no signup.

SysGeeks: system design interview practice

System design interview questions

Every question has a stage-by-stage practice version and a full written walkthrough (requirements, estimates, the architecture, tradeoffs, failure modes and alternatives).

Question Practice Answer
Design a URL Shortener Practise it Full walkthrough
Design a Video Processing Pipeline Practise it Full walkthrough
Design an API Rate Limiter Practise it Full walkthrough
Design a News Feed (Twitter Timeline) Practise it Full walkthrough
Design a Distributed Job Queue Practise it Full walkthrough
Design a Product Analytics System Practise it Full walkthrough
Design a Notification System Practise it Full walkthrough
Design a Payment System Practise it Full walkthrough
Design a Ride-Sharing Service (Uber-style) Practise it Full walkthrough
Design a Distributed Cache (Memcache) Practise it Full walkthrough
Design Discord's Message Storage Practise it Full walkthrough
Design a Dropbox-Style File Sync Service Practise it Full walkthrough
Design a Collaborative Editor (Google Docs) Practise it Full walkthrough
Design a Reactive Database (Live Queries) Practise it Full walkthrough
Shard a Live Postgres Database Practise it Full walkthrough

System design concepts

Asynchronous processing, Message queues, Delivery guarantees, Server push: polling, long polling, SSE, WebSockets, Persistent connections, Webhooks, Publish/subscribe, Object storage, Transactions, Append-only logs, Durability, State machines for business state, Online data migrations, Log-structured storage (LSM trees), Columnar storage, Idempotency, Retries, backoff and jitter, Timeouts and unknown outcomes, Reconciliation, Transactional outbox, Concurrency control, Ordering, Conflict resolution and convergence, Generating unique identifiers, Replication, Leases and fencing tokens, Partitioning, Soft state, Consistent hashing, Backpressure and capacity, Caching, Rate limiting, Fan-out on write and fan-out on read, Request coalescing, Load shedding.

How real companies solved these problems

Each system is paired with the engineering blog posts and papers it is built from, linked to the original and credited to its authors.

How it works

An environment for developing engineering judgment. Interview preparation is the reason people arrive; the product is understanding why systems are built the way they are, how they fail, and what changes when constraints change.

The core unit is an Investigation: a real system worked through from requirements. The learner decides, explains why, sees the engineering reasoning, breaks the system, changes its constraints, and defends what is left. Concepts (idempotency, leases, replication, …) exist to support investigations and link back to every stage that uses them.

Assessment comes in three kinds, and the progress view says which one each result rests on. Checked results are compared with an authored key: choices, verdicts and orderings. Self-assessed results are marked by you against specific rubric points. AI-assessed results are graded by a model against the same rubric points, on the learner's own API key, and each one cites the passage of the answer it relied on. The model check on a project is deterministic and never uses AI. Every AI output is labelled; /ai says what is sent, where, and which models you can pick.

Running it

pnpm install
pnpm dev          # http://localhost:3000
pnpm test         # domain + content integrity tests
pnpm typecheck    # next typegen && tsc
pnpm lint
pnpm build

Node 20.9+ and pnpm 10.

Hosting: Cloudflare Workers

Production runs on Cloudflare Workers through OpenNext (wrangler.jsonc, open-next.config.ts).

pnpm cf:preview   # build for Workers and serve it locally in workerd
pnpm cf:deploy    # build and deploy to Cloudflare (needs `wrangler login`)
  • Every public page is prerendered and never revalidates. The build output is the whole cache: OpenNext reads it from Workers static assets (static-assets-incremental-cache), so there is no R2, KV or ISR read quota for traffic or bots to use up. Adding revalidate, "use cache" with a lifetime, or on-demand revalidation needs a writable cache (R2) first; see the OpenNext caching docs.
  • Files in public/ are served before Next.js runs, so next.config.ts headers don't apply to them. Repeat any such header in public/_headers.
  • Keep pages light. Don't turn on experimental.inlineCss: it copied the 110 kB stylesheet into every page and RSC payload three times, which is what used up Vercel's ISR reads in November 2026.
  • Build-time values (SITE_URL, the public PostHog key) are in .env.production. There are no runtime secrets: the Worker serves pages and does no AI, auth, database or payment work.
  • Bots: app/robots.ts turns away compliant SEO scrapers and training crawlers. The rest are stopped at Cloudflare's edge (Bot Fight Mode, AI Crawl Control and a rate-limit rule), before they can invoke the Worker.

AI: bring your own key

Everything is free and needs no account. AI features (assessing a written answer, drafting a project from a description, README or public repository, reviewing an architecture, writing tailored questions, and the playground's "Ask AI what your design does") are optional and run in the learner's browser on their own API key. SysGeeks resells nothing and has no AI secrets.

  • Providers: Anthropic, OpenAI, Google Gemini and OpenRouter, through the AI SDK (ai v7 and @ai-sdk/*, @openrouter/ai-sdk-provider). All four accept browser (CORS) calls; Anthropic needs the anthropic-dangerous-direct-browser-access header, and Gemini rejects any request header it doesn't know. The model list and key links are in lib/ai/providers.ts; check them against each provider's model page when updating.
  • The key is stored by lib/store/ai-key-store.ts in localStorage ("this browser") or sessionStorage ("this tab only"), never in the learner state, so a progress export never contains it. The header's key button opens the settings (provider, key, model, test, remove); every AI action shows "Add your API key to use this" until one is saved.
  • Runs live in lib/client/ai-runners.ts, loaded on demand through lib/client/ai.ts so pages that only offer AI stay light. Prompts are in lib/ai/prompts/, the output schemas in lib/ai/schemas.ts; every answer is validated and normalized as before, and an answer that fails the schema is asked for once more. GitHub is read from the browser too (lib/ai/github.ts, unauthenticated, 60 API requests an hour per IP).
  • Results (drafts, reviews, question sets) are saved as aiRuns in the learner store, newest 30 kept, included in export and import, and listed on Review under Your data. Assessments stay on their attempt.
  • The concept catalog the review and question prompts cite is prerendered at /ai/concepts.json, so the content library stays out of the client bundle.

Setup

Nothing beyond pnpm install. .env.example lists the optional build-time values (site URL, PostHog, search verification). pnpm build passes with none of them set.

Architecture in one page

  • Next.js 16 App Router, React 19, Tailwind 4, Zod 4. Content pages are statically generated (generateStaticParams, dynamicParams = false). Only /interview/session, /projects/[id] and /reports/[runId] render on demand; the last two render a shell and read their data from the browser.
  • Curated content is TypeScript data in lib/content/, validated by the Zod schemas in lib/domain/content.ts when the library loads (a malformed document fails the build). lib/content/integrity.ts checks the reference graph (concept ids, competencies, components, flows, prose [[links]]), and lib/content/content.test.ts runs it over the real library.
  • Learner state lives in localStorage behind one module, lib/store/learner-store.ts, exposed through useSyncExternalStore. It is validated on read (lib/domain/learner.ts), unreadable data is copied to a quarantine key rather than discarded, and users can export and import JSON. State transitions are pure functions in lib/domain/learner-state.ts, so a server-backed store could reuse them.
  • Server renders prose, client runs exercises. Authored markdown is rendered on the server (components/prose.tsx) and passed to client components as ready-made nodes (components/exercise/slots.tsx), so the content library never ships in client bundles.
app/                      routes (home, investigations, concepts, companies, practice, interview, projects, understanding)
components/exercise/      the exercise engine: workspace, interactions, rubric self-assessment
components/system-map.tsx SVG architecture maps (curated grid or auto-layout)
lib/domain/               pure domain logic: schemas, evaluation, understanding, interviews, project questions
lib/content/              investigations, concepts, integrity checks, exercise resolution
lib/ai/                   AI prompts, schemas, providers and the GitHub reader (browser-side)
lib/client/               AI runs on the learner's key, loaded on demand
lib/store/                browser persistence: learner state, lesson progress, the AI key

Domain model

Concept Where Notes
Investigation, Stage, Interaction, Competency lib/domain/content.ts Stages carry a phase (model/decide/break/change/defend), dimensions, concepts, an optional injected event, an optional lesson, an interaction and a reveal with takeaways.
System model: components, flows, invariants lib/domain/content.ts Shared shape for curated systems and learners' own projects. Invariants name the components that enforce them and the mechanism. codeLocation evidence is reserved for repository analysis.
Concept lib/domain/content.ts Problem, mechanism, assumptions, alternatives, failure modes, implementations (simplest first), claims, explain prompt.
Attempt, Evidence lib/domain/learner.ts Every answer is an attempt; evidence records a signal (strong/partial/gap), its basis (checked/self-assessed/ai-assessed/mixed), dimensions, concepts and competencies.
Project lib/domain/learner.ts A learner's own architecture model, described by hand today (source: manual), from a repository later (source: repository).
InterviewSession lib/domain/learner.ts A timed arrangement of existing exercises; no separate question bank.

Evidence

lib/domain/evaluate.ts turns a response into evidence. Checked parts come from the key (decision assessment, claim verdicts, sequence agreement, flagged lines). Written parts come from rubric marks, or from an AI assessment that cites the passage it relied on: core points weigh fully and supporting points half, and a strong signal requires that no core point is missed. An exercise's signal is its weakest part.

lib/domain/understanding.ts aggregates only the latest assessed attempt per exercise into standings by dimension, concept and competency, and derives plain-language insights from counts (for example, "Defend is your most reliable dimension… Break is where gaps cluster").

Decision options are assessed as sound (preferable under these constraints), defensible (right under different constraints, and the feedback says which) or flawed (violates a requirement or correctness property). Investigations never pretend there is one correct architecture.

Authoring content

Investigations live in lib/content/investigations/*.ts and are registered in index.ts. Concepts live in lib/content/concepts/*.ts, grouped by domain.

  • Prose fields support a small markdown subset (lib/prose.ts): paragraphs, - /1. lists, > quotes, fenced code, tables, code, bold, emphasis, and [[concept-id]] / [[concept-id|label]] links. Use the md template tag to indent prose with the code.
  • Short fields (option labels, claim statements, rubric points, event text) support inline markdown only.
  • stage.reveals lists components and flows that appear on the system map once the stage is answered; parts no stage reveals are given from the start.
  • Run pnpm test after editing; the integrity test reports dangling references, unused competencies, reserved ids and map visibility mistakes.

The standard for content: never teach terminology without mechanism, never present a design without constraints, never discuss scaling without naming the bottleneck, and never discuss reliability without failure scenarios.

Lessons: teach before you test

A stage should not ask a question the learner has not been given the tools to answer. stage.lesson (and concept.lesson) is a list of small steps shown one chunk at a time, each chunk ending in a check that answers immediately:

  • read: a short paragraph, list, table or code block. One idea per step.
  • choice: one question, exactly one correct option, and a why on every option. A wrong pick explains itself and the learner tries again.
  • estimate: a back-of-envelope number with a tolerance (default ±30%) and the worked arithmetic. Use these for sizing.
  • predict: "what happens when…", answered by the learner (optionally in writing) before the answer is shown.
  • simulation: an interactive model of a mechanism (rate-limit-windows, lease-fencing, cache-stampede, consistent-hashing), with an optional note on what to try. It is not a check; follow it with one that asks about what the learner saw. The models are pure functions in lib/domain/simulations.ts (tested there); the widgets in components/simulations/ only draw them.

Every stage must have a lesson and reveal.takeaways, and every concept must have a lesson (on the concept page it replaces the problem and mechanism prose, so it has to carry the whole mechanism). The integrity test fails otherwise.

The stage's interaction comes after the lesson, and reveal.takeaways (two or three sentences) is what the learner should remember. Lesson checks are practice and are not recorded as evidence; progress through them is kept separately in lib/store/lesson-progress.ts. Written reasoning on decisions and diagnoses is optional; when it is left out the evidence rests on the checked part alone.

Write plainly. Titles say what the stage is about ("Estimate the load", not "Size it before you draw it"). No slogans, no aphorisms to close a paragraph, no "the real problem is…": state the mechanism and the numbers.

Sources and companies

lib/content/sources.ts lists companies and their published writeups (engineering blog posts, papers, talks, code). One company per idea: each company is there for one problem it solved and wrote about. Most are paired with one investigation; research papers such as Google's and Amazon's inform several. The tests check that every company leads to an investigation and every investigation has a company. Company pages, the "Read and practise next" links on investigations and the "Further reading" section of concepts all read from it.

Rules: link the original and credit the authors. A company's context is our own explanation of the idea; a writeup's note is a sentence or two on why to read it. Neither paraphrases the post: the original is the content. Only use numbers the authors reported. Before adding prose based on a source, check it for copied wording: download the sources and look for runs of six or more words shared with our files.

Review, design rounds and self-assessment

  • Review queue (lib/domain/review.ts): each exercise's next review is scheduled from its latest assessed answer: a gap after 1 day, partial after 3, strong after 7, 21, 60 and 180 days in a row. It is derived from attempts alone, so it needs no state of its own. A stage that is due reopens as a fresh question with the earlier answer hidden; the Progress page and the home page list what is due.
  • Design rounds (/investigations/[id]/design, lib/domain/design-round.ts): one system, a blank page, five timed sections (requirements, estimates, design, deep dives, failure and change), then a comparison against a reference assembled by lib/content/design-reference.ts from the investigation itself (requirements, lesson estimates, components, decide/break/change stages). Rounds are saved in learner state (rounds), so export and import include them.
  • Citations (lib/domain/passages.ts): marking a rubric point covered or partly requires picking the sentence (or line of code) in the learner's answer that shows it. Citations are stored on the attempt and shown with the assessment.

Adding an interaction type

A schema in lib/domain/content.ts, a response schema in lib/domain/learner.ts, a case in lib/domain/evaluate.ts, and an input/feedback pair in components/exercise/interactions/, wired into components/exercise/workspace.tsx. Nothing else switches on the kind.

Projects and future repository analysis

lib/domain/project-questions.ts generates questions from a project's model: trace entry-point requests, durability of stateful components, slow dependencies, redelivery of asynchronous flows, enforcement of invariants, the concurrency model, 100x scale, and why workers are separate. Answers are ordinary attempts, so they feed the same evidence model and appear in interviews.

Play (lib/domain/project-play.ts) runs a project under the learner's own numbers: reads and writes per second, payload sizes, a peak multiplier, regions and a p99 target. Reads and writes are found from the drawing (a client to the store it ends at, through the edge when there is one); background work follows async flows and the workers that read what writes leave behind. It checks the design at peak, against any single part losing an instance, and against losing a region, using the same model as the curated playgrounds. Everything runs in the browser.

The playground's p99 (lib/domain/tail-latency.ts) is computed, not sampled: each instance is an M/M/1 queue (the same assumption as the average wait), times at queues in series are independent, and cache hits end a request's trip early, so an operation's time is a mixture of sums of exponentials. compare.ts puts two designs side by side under one traffic level and failure; defend.ts asks follow-ups the model answers.

Repository analysis is designed to fill the same Project shape (source: repository, codeLocation evidence on components and invariants). The question templates, evidence and interview composition then work unchanged.

Releases

Packages

Contributors

Languages