The first post built docs you attach to events and to-dos: written in blocks, stored as Markdown, and editable in part by your connected Claude. As docs piled up they got hard to find. The docs home needed to keep pages neatly organized, the way Notion does.
Over the next two days, seven PRs turned docs into pages: subpages and a tree, a docs home, icons and covers, attaching docs while creating an event, past versions, and links that open the app.
A tree from one parent
The page tree keeps just one parent (parent_id) per doc (#895). The order among siblings isn't stored. Like Notion, a new page goes at the end, so the order is creation order. An order that isn't stored can't be changed differently on two devices.
The server builds the tree too. It lists docs depth-first and tags each one with its depth and number of direct children, and the web and iOS apps draw them in that order and only fold.
A move checks two things. The new parent and everything above it must not include the doc itself (a cycle), and after the move the deepest point must not go past the depth limit.
/** Can this be the parent: the doc must not be in the chain above (a cycle), and its deepest descendant (height) must stay within MAX_DOC_DEPTH */
export function docParentOk(id: string | null, chain: readonly string[], height: number): void {
if (id && chain.includes(id)) throw new DocError("invalid_parent");
if (chain.length + height > MAX_DOC_DEPTH) throw new DocError("invalid_parent");
}
The chain above and the deepest point below are each read with one recursive SQL query. The depth limit is 6 (the top is 0, so seven levels). Notion has no limit, but ikie's tree has to stay readable in a sidebar, so we stopped there. Only the owner moves or deletes. Deleting a doc doesn't delete its subpages; they move to the top. A doc whose parent isn't visible (someone else's, or deleted) also sits at the top, and even if old data had a cycle, each doc is placed only once.
The docs home stores only two things
The docs home has recently viewed docs, favourites, upcoming events with their docs, and all pages (#897 web, #899 iOS). Only two new facts are stored for it.
| What you see | Stored? | How |
|---|---|---|
| Recently viewed | When opened (doc_visit) | One row per person per doc, updated on every open. Latest 8 |
| Favourites | When added (doc_favorite) | In the order added |
| Upcoming events | No | Computed for today and tomorrow with the same day read as the board. 5 |
| Page tree | No | Computed from parent_id |
| Preview | No | 140 characters from the start of the text with Markdown stripped |
Upcoming events borrows Notion home's "Upcoming events". It shows only your own events that haven't ended, in start order. Other people's events, declined invites and to-dos are left out, and a multi-day event appears once. If an event has no doc, "Take notes" sits in its place.
Store only what a person did (opened it, added it), and compute the rest when it's shown. A computed list has no state to keep in sync.
Icons and covers
An icon is one emoji. The server uses Intl.Segmenter to check that it's one grapheme, that it's a pictograph, flag or keycap, and that it's at most 16 code units. That way skin tones and family emoji, several code points shown as one character, are accepted. The web uses emoji-mart as the picker, which the editor (BlockNote) already uses, and iOS uses a text field that brings up the emoji keyboard, as iOS apps usually do.
A cover is one of eight colours (design tokens, step 5 of the Radix colours) or an image uploaded to that doc. Images take the same path as photos in docs (#837). They live in private storage, the server rotates them upright and strips EXIF such as location before converting to WebP, and each view gets a short-lived URL. Changing only the icon or cover goes through the same queue as text saves, so if it collides with another save (409) it reads again and resends.
Attach docs while creating an event
Drag a doc onto the timeline and you get an event with that doc attached (#906). The create request carries up to ten doc ids, and creating the event and attaching docs happen in one transaction. If any doc can't be attached (missing, or not visible to you), the event isn't created either, so no half state with an event but no doc is left behind. Attachments aren't sent to external calendars.
Past versions: a link deleted by mistake
On October 21 a link in a doc was deleted by mistake, and there was no way to bring it back. Docs needed something like Notion's page history.
The editor's ⌘Z works only while that screen is open. Close it and reopen, and the deleted text is gone. So #924 keeps the doc as it was before an edit as a past version, lets you view it, and restores the one you pick.
The hard part was when to keep one. The editor saves as soon as your hands stop, so keeping a version on every save would flood the list in no time. Here's the rule.
/** Keep the doc as it was before this edit: the first edit, a long time since the last one, or a different person or app */
export function revisionDue(facts: DocRevisionFacts, editor: DocEditor): boolean {
if (facts.lastSavedAgoMs === null || facts.lastSavedAgoMs >= DOC_REVISION_GAP_MS) return true;
return facts.editedBy !== editor.userId || facts.editedClient !== (editor.client ?? null);
}
| Time | Who | Keep a past version? |
|---|---|---|
| 9:00 | Me, web | Yes (first edit to this doc) |
| 9:00–9:08 | Me, web, many saves | No (same person and app, still writing) |
| 9:12 | Me, web | Yes (10 minutes since the last one) |
| 9:13 | Connected Claude | Yes (a different app is editing) |
| 9:14 | Me, iPhone | Yes (changed again) |
The last two rows are what the rule is for. My text right before Claude edits my doc is always kept. Changing only the icon or cover keeps nothing. The ten minutes are measured with the database clock, not the app's.
A whole version (title and text) is kept, not a diff. Each doc keeps the latest 100, and older ones are deleted in the same transaction. A version's number is the revision the doc already has (the number that detects the 409 conflicts from the first post), so the same version is never kept twice.
A restore can be undone too. Restoring locks the doc, keeps the current version first, then writes the old title and text. Anything another device changed in between is also in the past versions. Only people who can edit the doc see past versions. Someone with read-only access shouldn't see text that was already deleted.
The list shows who edited each version, and where (#925): "Me", the person's name, "Someone else" when the name is unknown but the app is known, and "on the web", "on iPhone" or "by a connected app". Versions edited before this feature have no record of who, so they show only the time.
The more often autosave runs, the more past versions belong where the time or the hand changes. Above all, my text right before another hand (a person or a tool) edits it should always be kept.
Links that open the app
The same day, we wanted doc links to open the app. Tapping an ikie.app/docs/… link pasted in Claude or Slack on an iPhone opened the browser.
#922 added Universal Links. The web announces at /.well-known/apple-app-site-association that the app opens /docs/*, and the iOS app carries applinks:ikie.app. Tapping a link makes the app read the doc id from the URL, open the docs sheet on the Today tab and go into that doc. Reading the id from the URL follows the same shared policy as the doc chips inside the editor, so the web and iOS read the same URL as the same doc.
There were two reasons not to rely only on an app scheme like ikie://. In places like Claude or Slack such a URL doesn't become a tappable link, and without the app nothing happens. A Universal Link simply opens the web doc when the app isn't installed or on a Mac.
- #895Subpages, icons, covers, favourites, recently viewed, docs home read
- #897, #899Web and iOS docs home, sidebar tree, path
- #906Attach docs while creating an event (one transaction)
- #922Doc links open the app
- #924–925Keep, view and restore past versions, with who and where
- NextRead past versions from connected tools (MCP)
What's left
Past versions are visible only in the web and iOS apps for now. For a connected Claude to "bring back the paragraph I deleted yesterday", it needs a tool that reads past versions, and there isn't one yet.
What we learned
We built it like Notion without copying all of Notion's shape. Things that would need syncing if stored, like sibling order, the home lists and tree depth, became computations, and only what people did (opening, favouriting, the text before an edit) is kept. As a result, new screens added almost no data that could drift apart.