How tanmaybuilds14/inkwell works
Inkwell is a self-hostable collaborative document platform: users organize documents, open an editor, and collaborate through Yjs-backed live rooms, with changes persisted for later access. The Next.js app serves the UI and CRUD APIs; a separate WebSocket service handles live collaboration. Sharing, permissions, offline editing, versions, trash, activity, inbox, and background jobs are distinct product capabilities. Several subsystem links below come from the README architecture; unsampled implementation details are represented at their existing directory paths.
Main entry points: editor-client.jsx Collaborative editor · dashboard.jsx Document dashboard · server.js WebSocket entry · route.js Sharing and permissions
Components 24
Next.js app
- Document dashboard
src/components/documents/dashboard.jsx
Live collaboration
- Collaborative editor
src/components/editor/editor-client.jsx - Editor surface
src/components/editor/collab-editor.jsx - Offline document cache
src/lib/offline-docs.js - WebSocket entry
sync-service/src/server.js - Yjs rooms
sync-service/src/rooms.js - Cross-instance relay
sync-service/src/broadcast.js - Snapshot persistence
sync-service/src/db.js - Shared wire contract
shared/protocol.js
Document features
- Document API
src/app/api/documents/route.js - Folder API
src/app/api/folders/route.js - Version history
src/components/documents/version-history.jsx - Trash and restore
src/app/api/trash/route.js
Identity and access
- Handshake authorization
sync-service/src/auth.js - Sharing and permissions
src/app/api/documents/[id]/share/route.js - Public share access
src/lib/share-page.js - Profile and onboarding
src/app/api/profile/route.js
Background and records
- Inbox and mentions
src/lib/inbox.js - Activity history
src/lib/activity.js - Scheduled jobs and invites
src/inngest/functions.js
Other components
- Document user
- PostgreSQL
- Redis
- Inngest
Connections 30
- Document user → Document dashboard: uses
- Document dashboard → Document API: lists and creates
src/components/documents/dashboard.jsx - Document dashboard → Folder API: organizes
- Document dashboard → Collaborative editor: opens document
- Collaborative editor → Editor surface: renders
src/components/editor/editor-client.jsx - Collaborative editor → Offline document cache: caches edits
src/components/editor/editor-client.jsx - Collaborative editor → WebSocket entry: sends updates
- WebSocket entry → Handshake authorization: authenticates
sync-service/src/server.js - WebSocket entry → Yjs rooms: joins room
sync-service/src/server.js - Yjs rooms → Cross-instance relay: relays updates
sync-service/src/rooms.js - Cross-instance relay → Redis: publishes and subscribes
- Yjs rooms → Snapshot persistence: persists snapshots
sync-service/src/rooms.js - Snapshot persistence → PostgreSQL: writes snapshots
- WebSocket entry → Shared wire contract: uses protocol
sync-service/src/server.js - Document API → PostgreSQL: reads and writes
src/app/api/documents/route.js - Folder API → PostgreSQL: reads and writes
src/app/api/folders/route.js - Sharing and permissions → PostgreSQL: updates access
src/app/api/documents/[id]/share/route.js - Sharing and permissions → Inbox and mentions: records invitations
src/app/api/documents/[id]/share/route.js - Sharing and permissions → Activity history: records sharing
src/app/api/documents/[id]/share/route.js - Collaborative editor → Version history: opens timeline
src/components/editor/editor-client.jsx - Version history → PostgreSQL: loads and restores versions
- Trash and restore → PostgreSQL: soft deletes and restores
- Document user → Public share access: opens shared link
- Profile and onboarding → PostgreSQL: updates profile
src/app/api/profile/route.js - Profile and onboarding → Activity history: logs profile changes
src/app/api/profile/route.js - Activity history → PostgreSQL: stores and queries events
src/lib/activity.js - Inbox and mentions → PostgreSQL: stores inbox items
src/lib/inbox.js - Inngest → Scheduled jobs and invites: dispatches jobs
- Scheduled jobs and invites → PostgreSQL: purges and prunes
- Scheduled jobs and invites → Inngest: sends invite email