Writely v2
A long-form writing platform with a block editor, autosaved drafts and scheduled publishing, built for reading and sharing.
Problem
Writely began as my college blogging app. Version two rebuilds it into a calm place to write, with the tools serious writers expect.
Systems
- Block editor
- Structured Tiptap documents, with code blocks highlighted and formatted by CodeMirror and Prettier, and images from Cloudinary or Unsplash.
- Drafts and scheduling
- Debounced autosave, and posts scheduled for a future time, published by a secured cron job.
- Discovery
- A trending feed ranked by views, likes and comments with time decay, computed in a MongoDB aggregation pipeline. Also tags, search, and following vs global feeds.
- Social graph
- Follows and likes modelled as their own collections, so they scale independently of articles.
- Author pages
- Profiles with an activity heatmap of writing days.
- Sharing
- A generated Open Graph image per article, plus RSS, a sitemap and share links.
- Accounts
- A secure httpOnly session cookie, bcrypt passwords, and email password reset with single-use hashed tokens.
- Protection
- A nonce-based Content Security Policy, a same-origin check on every write, and content validation on articles and comments.
Decisions
- Structured content, not HTML. Articles are stored as editor blocks, so the server accepts only what the editor can produce.
- Trending on read. Scores are computed when the feed loads, so there's no background scoring job to schedule or keep in sync.
- Decisions on record. 8 architecture decision records document each major choice, from the framework to the content format.
Next.js 16TypeScriptMongoDBTiptapCodeMirrorCloudinaryzodVercel Cron
Private repo · walkthrough on request