technology / design review
Questioning our own design,in public.
A list of strengths cannot evaluate a design. So here first is what we pay for what we get, and where it is weak.
the bets
The three bets in this design
Three bets give AiiB its shape. Each one leaves something weak.
- Templates and content are enough
- Gains: AI does not break layouts, documents stay small, designs can change later. Weak spot: free-form placement outside templates is hard and needs a separate mechanism
- No servers of our own
- Gains: we hold no documents, so the operating and breach surface is small. Weak spot: backups and device protection stay with you, and the app alone cannot do multi-person co-editing (a team form is in preparation)
- You bring the AI
- Gains: tied to no AI, and the product carries no AI costs. Weak spot: for people with neither an API key nor an AI app, AI is further out of reach
failure modes
Robustness: a defined layer for each failure
Rather than trying to never fail, we list the ways things break and decide where each one is stopped.
- App or device killed
- Restore the latest state from the append-only edit log
- OS shutdown
- Receive the shutdown request and finish writing before exit
- Database corruption
- Detect with pre-update copies and periodic integrity checks, and restore from a copy
- Interrupted sync
- Verify checksums and do not read past a damaged section
- Two devices editing at once
- Each device writes its own file, merged by CRDT
- Saving from an older version
- Carry unknown fields through instead of dropping them
- Wrong AI edit
- Deck-wide changes and MCP drafts stay out until adopted. A single-slide change undoes in one step. Versions allow reverting after adoption
- User mistake
- Copies of the whole document before editing and at intervals
Gains
- If one defense is defeated, the next layer catches it
Costs
- Keeping the same document in several forms uses storage
- More paths means more that must be checked
data volume
Data volume: templates and content, not coordinates
A slide is mostly its text and a template reference, typically a few KB excluding images. Position and formatting come from the template definition, so documents do not store them.
Gains
- Small documents and small diffs
- Template improvements can reach existing documents
- Images inside the document let it sync and move as one unit
Costs
- Free-form placement outside templates needs a separate mechanism
- Image-heavy documents grow large; images are downscaled on import to limit this
- Storing image originals separately from the document is future work
persistence
Persistence: four stores, split by frequency and purpose
No single mechanism tries to do everything.
- Edit log
- High frequency, appending only what changed. The source for crash recovery and device sync
- Document
- The whole document. Used for lists, export and reconciling updates that bypass the log
- Copies
- Taken before editing and at intervals, so a person can return to an earlier state
- Versions
- States the user marked. The content replaced by an adopted AI draft is kept here too
Gains
- Small writes while editing
- Recovery, sync and history work independently
Costs
- Multiple stores must be kept consistent; the log and document are compared when opening
footprint
Footprint: a small download, processes split by role
Using the OS WebView keeps the download small, and AI work runs in a process separate from the interface.
Gains
- No bundled browser engine, so the download stays small
- Heavy AI work does not block the interface
- Editing continues if the sidecar goes down
- Large local models start only when used
Costs
- Three runtimes: WebView, Rust and Node.js
- The Node.js sidecar always uses memory
- Right after launch, AI features may wait for the sidecar to be ready
- WebView differences between operating systems must be absorbed
interaction
Responsiveness: keep the main thread free
- Load when needed, draw what is visible
Heavy parts such as equations, charts and export load when first used, and long lists skip what is out of view.
- Heavy work goes to Rust
Image downscaling and sync run off the main thread.
- Never block typing
The edit log is written in batches. If a write fails, editing continues.
- Undo granularity
Structural changes such as adding a slide undo one at a time, while typing is grouped by time.
code
Code: discipline enforced by machines, not people
- Type discipline
TypeScript runs in strict mode. Directives that disable type checking are avoided as a rule.
- Enforced boundaries
Each template is one folder, and checks confirm it does not depend on other templates or on screens. Lint also blocks dependencies on the data layer.
- Generated registration
Template registration is generated from folders rather than written by hand, which prevents missed entries by construction.
- Rust tests
Saving and sync are tested with temporary databases and folders, including abnormal cases.
Gains
- Areas that break without showing on screen can be verified by automated checks
Costs
- There are no automated UI tests. The interface changes on short cycles, so testing concentrates on data, permissions and export
- Most checks are run locally; not all of them run automatically on every change
q&a
Questions you may have
- Doesn’t Yjs history grow forever?
The edit log is compacted into the current state after a certain amount, and sync files are rewritten into new generations that hold it. By the nature of CRDTs, deletion information inside the document never fully disappears.
- What if cloud sync is delayed or out of order?
A CRDT does not depend on arrival order. Updates whose prerequisites have not arrived are not compacted, and merge once they do. A delay only delays what you see; content is not lost.
- If Node.js is always running, why not write it in Rust?
AI and MCP SDKs are centered on TypeScript, and this area changes often. The sidecar does not write to the document database, so data is not lost if it goes down.
- Do WebView differences change PowerPoint output?
No. PowerPoint files are generated from template definitions rather than captured from the screen. The exceptions are Word cover backgrounds and decorations, which are rendered from the screen into images.
- The code is closed. How can I trust this?
You cannot verify everything. What you can verify: exported files are standard formats you can open and inspect, network traffic can be observed with OS tools, and your data is in standard SQLite.
- What happens to my documents if development stops?
Documents stay in standard SQLite on your device and can be exported to PowerPoint, Word and PDF. Saving and editing do not use our servers. However, store subscriptions and support for future OS versions depend on continued development.
- What if text inside a document manipulates the AI?
Code refuses writes outside the requested scope, and deck-wide changes and MCP drafts stay out until adopted. A single-slide change lands right away, so check it and undo if needed. A connected AI can read documents, so connect only AI you trust.
- What if the AI provider goes down?
AI features are unavailable during that time, but editing, export and saving work without AI. You can also switch to another provider’s key or a local model.