Structured writing and collaboration
Mythos
A memo and journaling product built around a custom rich-text editor, where references and tags are structured data rather than plain text.
- Role
- Primary engineer: architecture and full-stack implementation
- Engagement
- Independent contract, more than a year
- Focus
- Editor engineering, content model, backend services
- Scope
- The product foundation I built; later work by others is not shown
memo├─ creatorContent saved via API · 1s debounce│ ├─ heading Objective│ ├─ heading Subjective visible: false│ └─ heading Contexts│ └─ customLink type: reference · role: creator├─ collaboratorContent Yjs · real-time│ ├─ heading Notes│ └─ customLink type: hashtag · role: collaborator├─ entities[] extracted on save├─ tags[] collaboratorTags[]└─ visibility public | link | private
The product
Mythos is a writing product for memos and a daily journal. What sets it apart from a plain notes app is that connections between ideas are part of the data. When you reference another memo or tag an idea in the middle of a sentence, Mythos stores a structured link, not a string that happens to look like one.
Each memo has two parts. The author's own section is theirs alone. Below it is a collaborator section where other people can write together in real time. Memos can be public, shared by link, or private. Each user also has a daily memo with a task list and a timeline, browsed by calendar.
I was the primary engineer on Mythos under an independent contract for more than a year. I built the product from an empty repository: the architecture, the editor, the backend, and the data model. This page covers the foundation I built; the company's later direction and other people's contributions aren't represented here.
The editor
The editor is built on Tiptap, which sits on top of ProseMirror. Off-the-shelf extensions cover formatting. Most of the product's behavior lives in extensions I wrote.
- References and hashtags as nodes. A custom atomic inline node represents both memo references and hashtags. Each one records whether it's a reference or a tag and whether the author or a collaborator wrote it. It renders as a real link, and the cursor treats it as a single unit, so you can't half-delete a reference.
- Suggestion menus. Typing
@searches your memos, paginated and debounced, and offers to create a new memo on the spot. Typing#autocompletes tags ranked by exact match, length, and usage, with an option to create a tag. - Sections that can hide. A custom heading node with a React node view can be toggled visible or hidden, with custom keyboard handling for Enter and arrow keys around it. New memos start from a template of named sections.
- Embeds. A block node for rich embeds, fetched through a server-side Iframely proxy so API keys never reach the browser.
- Editing details. Tab and Shift-Tab handling, task lists tuned for the journal, a floating formatting toolbar, text color, and media insertion.
Structured content
On every save, the server walks the editor's JSON document and extracts the references, author tags, and collaborator tags into indexed fields next to the content. Everything that makes Mythos feel connected reads from those fields: tag search, the references panel, and lists of related memos. None of it has to parse rich text at read time.
Renaming is the hard case for structured links. When a memo's title changes, every reference to it, in other memos and in daily memos, is updated to match, so links never go stale.
I also wrote conversion tooling that turned legacy Draft.js content into a format the new editor could read, including embeds and mentions.
Two editors, one page
The author's section and the collaborator section have different requirements, so they use different persistence models.
- Author section. A local editor that saves through the API with a short debounce. Simple, predictable, and cheap.
- Collaborator section. Real-time co-editing with Yjs through a hosted Hocuspocus service, with live cursors for each collaborator. Until the provider reports it's synced, the page shows a read-only render, so readers never see an empty section flash in.
- Persistence. When the collaboration service saves a document, it calls a webhook. The server verifies its HMAC signature before writing anything.
Running two editors on one page took careful work: keeping the side panel's references and tags current while others type, handling copy and paste of reference nodes, and keeping cursor movement predictable around atomic nodes.
Backend and data
Client
- Next.js App RouterReact, TypeScript
- Tiptap editorsLocal and collaborative
Server
- API routesMemos, journal, tags, references
- AuthFirebase ID tokens verified per request
- WebhookHMAC-verified collaboration saves
Data
- MongoDBMemos, daily memos, users
- RedisRead-through cache
- Tiptap CloudHosted Yjs collaboration
MongoDB stores memos, daily memos, and users. Tag search combines aggregation pipelines across both memo sections and the journal.
Redis is a read-through cache for individual memos and each user's most recent memos, and referenced memos are cached ahead of time. If Redis is slow or down, the app retries once with a short timeout and falls back to the database. The cache makes the app faster, but it never has to be up for the app to work.
Access control is enforced on the server. Only the author can edit, rename, change visibility, or delete. Private memos are refused to everyone else. For signed-out readers, the server removes hidden sections and collaborator content before the response leaves the server, so nothing private reaches the browser.
A decision I reversed
Early on, I modeled memos, references, and tags as a graph in Neo4j to find related memos and decide what to cache. It worked, but it meant a second database to keep in sync with every edit for a question the document store could already answer.
A few weeks later, I replaced it with the extracted entities stored on each memo, plus the Redis cache. That removed a database from the architecture and a whole class of sync bugs, and the product didn't lose a feature. In an early-stage product, the simpler architecture won.
What I owned
- Architecture and technology choices
- The editor and every custom extension
- Content model, API, caching, and access control
- Real-time collaboration and its persistence
- The daily journal, with infinite scroll in both directions and calendar navigation
- Responsive layout and the alpha release work
Stack
Next.js · React · TypeScript · Tiptap / ProseMirror · Yjs · MongoDB · Redis · Firebase Auth