Katkat

Design a prompt-sharing platform

AnthropicSoftware Engineer · Technical Screen

Last updated

This question assesses the ability to design a scalable content-sharing platform, focusing on data modeling, efficient retrieval of user-generated prompts, and the handling of concurrent access and permissions.

Prompt-Sharing Platform Design

Design a platform where users can create, store, and share LLM prompts. Users should be able to make their prompts public, private, or shared via secret links.

Functional Requirements

  • Users can create, read, update, and delete (CRUD) their prompts.
  • Users can mark prompts as 'Public' (discoverable) or 'Private' (owner only).
  • Users can generate a 'Shareable Link' for private prompts, allowing anyone with the URL to view the prompt.
  • Users can 'fork' or save a copy of someone else's public prompt to their own library.

Non-Functional Requirements

  • The system should handle high read-to-write ratios (common for prompt libraries).
  • Search functionality must be efficient for public prompts.
  • Access revocation for shared links should be near-instant.

Deliverables

  1. Data Model: Define the primary database schema (SQL vs. NoSQL considerations).
  2. API Design: Outline key endpoints for CRUD operations and accessing shared content.
  3. System Architecture: Describe the high-level components, including caching strategies to handle viral prompts.
  4. Scalability: How would you handle a sudden influx of traffic if a prompt goes viral?

Hints

Hint 1

Consider using a relational database for user and permission metadata, while storing large prompt text in a document store or blob storage.

Hint 2

For shared links, distinguish between a permanent URL and a hashed access token that can be invalidated by the owner.

Hint 3

Use a CDN and caching layer like Redis to serve the most popular public prompts, reducing the load on your primary database.

Follow-up questions

  • How would you implement versioning for prompts so that users can track changes over time?
  • If we add a 'collaborative' feature where multiple users can edit a prompt simultaneously, how would you handle merge conflicts?
  • How would you ensure that a user who has been blocked or removed from a share list loses access to the prompt immediately?