Skip to the guide

Design a Q&A site (like Stack Overflow)

IntermediateCase study11 pages

The interviewer asks you to design the classes behind a site where people ask questions, answer them and vote. Picture a question wall in a classroom. Each card has coloured stickers for its topics, and a box for each colour holds the card numbers. Under each card, a grid of names lets each classmate tick up or down beside their own name, and change it later, but never on their own card. A points book has a rule sheet saying what each tick is worth.

In code, the grids are Votes, the points book is Reputation, each line of the rule sheet is a ReputationRule, and the sticker boxes are TagIndex. It is also asked as "design Stack Overflow", and the closest other case study is the library system, which also searches and prices with a list of rules. Interviewers like it because a vote looks like a counter and isn't one.

Below is a full 45-minute round on the LLD framework. At each Guess before you read on, stop and answer first. The full runnable project is a download in Java, JavaScript and Python.

Run the full project

This design as a project you can run, with its tests and a demo. You only need Java 21, Node 24 or Python 3.13. The README says how to run it.

Step 1 · Clarify the requirements and cut the scope

Minutes 0–5 · How this step works

Interviewer: Design a Q&A site.

You: What can people do?

Interviewer: Ask a question with tags, answer it, comment, vote questions and answers up or down, accept one answer, and search by tag. Comments are plain text, with no votes.

You: What are the rules for a vote?

Interviewer: One vote per person per post. They can change it or take it back, and nobody votes on their own post.

You: How do points work?

Interviewer: An upvote gives the post's author 10 points, and a downvote takes 2. An accepted answer gives its author 15, but accepting your own answer earns nothing.