Design a Comments Service
MediumSystem design · Social
Design a reusable comments service that other products (blogs, videos, articles) embed. Each host application (tenant) has its own users and rules. Readers see threaded, ranked comments that stay stable while new ones arrive, and tenants moderate through configurable policy.
In scope: tenancy and host-signed identity, the thread data model and pagination, ranking and votes, deletion and moderation, hot threads, and live updates. Out of scope: the host's content pages and the full community model of a social network (see the Reddit problem).
Requirements
- Nested threads with a bounded depth, stored so a subtree is a range scan
- Cursor pagination that stays stable under concurrent writes and changing ranks
- Soft deletion that preserves replies, plus automatic and per-tenant moderation
- Tenant-scoped everything, host-signed identity, and protection against hot-thread write contention