KatInterview

Build a Multi-User Prompt Editor with Versioning and Execution

System DesignModel answer
MediumModel answerSystem Designcollaborationversioningasync-execution

Last updated

Design a system where teams edit prompts collaboratively, snapshot immutable versions, run them against LLMs, and trace results back to exact inputs.

You're building a platform where teams craft and test LLM prompts together. Multiple users work on a shared draft, create frozen snapshots, send those snapshots to a language model, and review outputs while preserving full traceability to the configuration that produced them.

Requirements

Collaborative editing: Several authenticated project members may edit the same prompt draft at once. The system must handle concurrent modifications and client reconnections without data loss or silent overwrites.

Immutable versions: Users snapshot the draft into numbered versions. A version captures prompt text, any template variables, model settings, and tool definitions. Once created, a version never changes.

Execution: A user selects a version, supplies input variables, and submits a run. The system calls the LLM provider, stores the response, and links it permanently to the version and inputs that produced it.

Traceability: Anyone inspecting a result must see exactly which version, input values, model name, temperature, and other settings were used—even if the draft or project configuration has since changed.

Scope and Assumptions

  • Users belong to a project and are already authenticated; focus on the editor, version, and execution subsystems.
  • You may choose any collaboration strategy (operational transforms, CRDTs, last-write-wins with conflict detection, etc.)—justify your choice.
  • Model calls are expensive, slow (multi-second), and may time out or return errors; treat them as asynchronous external requests.
  • A lost client connection or retry must not create duplicate runs or lose in-flight results.

What to Address

  1. Data model: Define the draft, version, and run entities and their relationships.
  2. Concurrent editing: Explain your conflict resolution approach and when users see each other's changes.
  3. Version immutability: How do you prevent accidental mutation of a version already referenced by past runs?
  4. Asynchronous execution: Describe the lifecycle of a run request, from submission through provider call to result storage, including retries and failures.
  5. Access control: Who can edit, create versions, execute runs, or view results?
  6. Scalability sketch: Identify bottlenecks and suggest how you'd scale collaboration traffic separately from execution.

Provide a high-level architecture, justify key trade-offs, and call out common pitfalls.

Hints

Hint 1

Separate the hot collaboration path from the cold execution and storage path—real-time edits shouldn't block model calls.

Hint 2

Assign each run a unique idempotency key so retries don't spawn duplicate requests or charge twice.

Hint 3

Store the full version snapshot with every run record; never rely on a mutable draft or configuration reference.