SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 37
Design a wiki-style document management system
Teams keep their docs in a workspace of nested pages: specs, runbooks, meeting notes. People open a page, edit it, and save; others browse, search, and occasionally need to see who changed what last week or roll a page back after a bad edit.
Requirements
- Create, read, edit, move and delete pages arranged in a tree within a workspace.
- Keep every saved revision with author and time, show diffs, and restore any old revision.
- Permissions are set on a page and inherited by its subpages unless a subpage overrides them.
- Two people saving the same page must never silently overwrite each other's changes.
- Search page titles and content within a workspace.
Constraints and assumptions
- 2 million monthly active users across 50,000 workspaces; 5 million pages in total.
- 200,000 page saves a day and 20 million page views a day; average page 20 KB.
- Page trees are at most about 10 levels deep; a large workspace has 100,000 pages.
- Search must never return a page the user cannot open, and new saves should be searchable within 1 minute.
- Revisions are kept forever.
Out of scope for the first sketch
Real-time co-editing with live cursors · Comments and notifications · File attachments
Draw your design
Rough math and notes
SYSTEM DESIGN SKETCHBOOK / FOLLOW-UPS
Design a wiki-style document management system
Finish your first sketch before answering these. Cross out freely.
- Two people open revision 12 of a page and both click save. What does the second person see?
- Someone vandalizes a page. How do you restore it, and what happens to the bad revision?
- Access to a top-level page is revoked for a group. What happens to its 3,000 subpages and to search results?
- An announcement page gets 10,000 views per second. What serves it?
Compare afterwards: worked approaches and reading at sketchbook /questions/document-management/review