PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/Bobyard

Design a client-side comment system

Last updated: Mar 29, 2026

Quick Overview

This question evaluates front-end engineering competencies including client-side data modeling, state management, UI behavior for nested comment trees, sorting/filtering semantics, and persistence using localStorage.

  • medium
  • Bobyard
  • System Design
  • Software Engineer

Design a client-side comment system

Company: Bobyard

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

## Scenario You are asked to build a **client-side comment system** (no backend required). The focus is on data modeling, UI behavior, and persistence. ## Requirements 1. **Create and display comments** - A user can add a new top-level comment with: `id`, `author` (optional), `text`, `createdAt`. - Render a list of comments. 2. **Filter and sort comments** - Provide a way to **sort** comments (e.g., `Newest first` / `Oldest first`). - Provide a way to **filter** comments (e.g., by keyword in `text`, or show only comments from a given author). - Sorting/filtering should apply to the rendered list. 3. **Nested comments (replies)** - Each comment can have replies (nested comments), forming a tree. - Users can reply to any comment. - Nested comments should also respect the current sort/filter behavior (define your rules). 4. **Persistence with `localStorage`** - Persist the comment data so a page refresh restores the comments. - Also persist the user’s **current sort choice** (and filter choice if applicable). ## Constraints / clarifications - Assume a single browser tab (no multi-user concurrency). - You may choose any UI approach (vanilla JS, React, etc.), but your design should be framework-agnostic. - Explain how you would structure the state, how you would store it in `localStorage`, and how you would handle updates efficiently. ## Deliverables (in interview) - Data model (types / JSON structure) - Key functions/APIs (add comment, reply, set sort/filter, load/save) - Explanation of rendering strategy for nested comments - Edge cases and tradeoffs

Quick Answer: This question evaluates front-end engineering competencies including client-side data modeling, state management, UI behavior for nested comment trees, sorting/filtering semantics, and persistence using localStorage.

Related Interview Questions

  • Design comments and async image generation - Bobyard (medium)
Bobyard logo
Bobyard
Mar 1, 2026, 12:00 AM
Software Engineer
Technical Screen
System Design
3
0

Scenario

You are asked to build a client-side comment system (no backend required). The focus is on data modeling, UI behavior, and persistence.

Requirements

  1. Create and display comments
    • A user can add a new top-level comment with: id , author (optional), text , createdAt .
    • Render a list of comments.
  2. Filter and sort comments
    • Provide a way to sort comments (e.g., Newest first / Oldest first ).
    • Provide a way to filter comments (e.g., by keyword in text , or show only comments from a given author).
    • Sorting/filtering should apply to the rendered list.
  3. Nested comments (replies)
    • Each comment can have replies (nested comments), forming a tree.
    • Users can reply to any comment.
    • Nested comments should also respect the current sort/filter behavior (define your rules).
  4. Persistence with localStorage
    • Persist the comment data so a page refresh restores the comments.
    • Also persist the user’s current sort choice (and filter choice if applicable).

Constraints / clarifications

  • Assume a single browser tab (no multi-user concurrency).
  • You may choose any UI approach (vanilla JS, React, etc.), but your design should be framework-agnostic.
  • Explain how you would structure the state, how you would store it in localStorage , and how you would handle updates efficiently.

Deliverables (in interview)

  • Data model (types / JSON structure)
  • Key functions/APIs (add comment, reply, set sort/filter, load/save)
  • Explanation of rendering strategy for nested comments
  • Edge cases and tradeoffs

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Bobyard•More Software Engineer•Bobyard Software Engineer•Bobyard System Design•Software Engineer System Design
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.