A small full-stack app inspired by Google Docs, deployed as "Ajaia Docs": rich-text editing with autosave, import of .txt, .md and .docx files, and sharing with owner, editor and viewer roles. Built in a fixed timebox, with the effort put where bugs cost the most: access control and saving.
A document editor has a long feature list. Within a timebox, the question was which parts could not afford to be wrong.
Sharing is the part most likely to be subtly wrong, so every permission decision lives in one place and is covered by tests.
Autosave with a visible state, retry on failure, and no lost edits matter more than a long toolbar.
A free, zero-config stack: runs locally with no setup and deploys to Vercel with a hosted database.
Route handlers stay thin. Every rule lives in a small library layer that takes a database client, so it can be tested without HTTP.
The parts I built and tested end to end.
Bold, italic, underline, H1 to H3, bulleted and numbered lists, undo and redo, plus working File, Edit and Format menus.
Debounced saves with an "All changes saved" state and a Retry button if a save fails.
.txt, .md and .docx files up to 2 MB become new editable documents. Limits are stated in the UI.
Share by email as Can edit or View only. Change or revoke access. "My documents" and "Shared with me" with role badges.
Download as Markdown or plain text. Save as PDF through the browser print dialog.
If someone else saves while you have a document open, a banner appears within about 5 seconds with a Reload button.
Each choice has a reason tied to the timebox or to deployment.
| Layer | Technology | Why |
|---|---|---|
| App framework | Next.js 14 + TypeScript | One repo and one deploy for UI and API; route handlers keep the backend small. |
| Editor | Tiptap (ProseMirror) | A real rich-text engine out of the box. Building on contenteditable would have used the whole timebox. |
| Database | libSQL (@libsql/client) | The same code runs on a local SQLite file for development and on hosted Turso in production. |
| Validation | zod | Request validation in one declarative place. |
| Tests | Vitest | Fast tests against an in-memory libSQL database, with no mocking of the database. |
| Hosting | Vercel + Turso | Serverless has no persistent disk, so a hosted database is required. |
The trade-offs that shaped the final design.
Roles are owner, editor, viewer or none. Read needs any role, edit needs owner or editor, delete and sharing need owner. A user with no access gets 404, not 403, so document ids cannot be probed. Enforcement is on the server for every route; hiding buttons in the UI is only a convenience.
Content is saved as Tiptap/ProseMirror JSON. That keeps structure exact, and imported files use the same schema, so imported and hand-written documents are identical.
Plain SQLite on Vercel would lose data on an ephemeral disk. libSQL keeps the same code for local and hosted use.
Serverless hosting cannot hold long-lived connections, so open editors poll a tiny meta endpoint every 5 seconds. It signals conflicts but does not resolve them, and that limit is stated openly.
Seeded users and a signed cookie let a reviewer test sharing in seconds. It is clearly labelled as mocked, with real authentication listed as the next step.
Problems where a naive version loses data or trust.
Edits made while a save is in flight must not be dropped. Pending changes are kept in refs so the debounced saver always sends the latest state, and an edit during a save triggers another save.
✓ Retry button and best-effort save on page closeImported files go through the same editor schema, so anything that cannot be represented is dropped rather than breaking the document. Guards cover the extension allow-list, the 2 MB cap, empty files, and corrupt files return a friendly 422.
✓ Same schema for import and editingThe app needed a database that survives on a platform with no disk. The test suite includes a concurrent cold-start race and an in-place schema migration for existing databases.
✓ Hosted Turso, tested start-up pathThe owner, editor, viewer and no-access matrix is tested directly, including the 404 versus 403 behaviour and cascade on delete.
✓ Pure role rules plus matrix testsWhat a reviewer can verify in the repo and the live demo.
Stated plainly in the repo, and repeated here.
Saves are last-write-wins. The editor detects other people's saves but you must reload to see them. Real merging needs a CRDT such as Yjs and a websocket host.
Anyone can pick any seeded user. That is deliberate for a review exercise.
Real-time collaboration with Yjs, version history, server-generated PDF export, real authentication, and Playwright end-to-end tests.
I'm open to full-time roles and project work in AI engineering, full-stack development, and backend systems.