KatInterview

Full-Stack Comment CRUD and Async Image Pipeline

System DesignModel answer
MediumModel answerSystem Designcrudasync-jobspagination

Last updated

Build a comment system with sort persistence and an image-generation service that handles long-running GPU jobs with reliable ordering and status delivery.

You are building two independent systems and need to design the full stack for each.

System A: Comment Platform

Design a complete comment system that supports the following:

  • Users can create, read, update, and delete comments on a resource (such as a blog post or document)
  • Comments can be sorted by either creation time or author ID, in ascending or descending order
  • The user's chosen sort configuration must be remembered and applied automatically when they return to the page, even after closing the browser

Specify the API endpoints, database schema, frontend-backend interaction, and how you will implement stable pagination and preference persistence.

System B: Image Generation Pipeline

Design a service that processes image-generation requests using GPU workers. Image generation is computationally expensive and takes anywhere from 10 seconds to several minutes per request.

Your design must handle:

  • Accepting user requests and returning a response immediately, even though processing has not completed
  • Running the generation work asynchronously on a pool of GPU workers
  • Exposing job status and progress to users
  • Delivering the final generated image once complete
  • Preserving a stable, well-defined order of generated images in the user's gallery

Explain your architecture, data model, API design, and how you ensure reliability when workers crash or jobs fail.

Clarifying questions are encouraged. State your scale assumptions.

Hints

Hint 1

For comments, consider what happens when two rows share the same sort value — how do you avoid duplicates or gaps across pages?

Hint 2

Image jobs outlive HTTP timeouts; you need a pattern that decouples request acceptance from work execution.

Hint 3

Think about layered persistence for the sort preference: what survives a refresh? What follows the user across devices?