How toeverything/affine works
AFFiNE is a local-first workspace combining document editing, an edgeless canvas, and planning features such as databases. The main user workflow is to create or edit block-based content, arrange it in document or canvas views, and retain or synchronize workspace data. The README documents collaboration and multimodal AI; the tree identifies relevant modules, but their full wiring is not shown in the sampled source, so those links are kept broad and evidence limits are noted.
Main entry points: src/index.ts BlockSuite entry · store/index.ts Document storage · store.ts Editor foundation · note/index.ts Document blocks
Components 21
Editing surface
- BlockSuite entry
blocksuite/affine/all/src/index.ts - Editor foundation
blocksuite/affine/all/src/foundation/store.ts - Editing controls
blocksuite/affine/all/src/widgets/toolbar/index.ts - Document navigation
blocksuite/affine/all/src/fragments/outline/index.ts
Content and canvas
- Document blocks
blocksuite/affine/all/src/blocks/note/index.ts - Text and inline content
blocksuite/affine/all/src/blocks/paragraph/index.ts - Edgeless canvas
blocksuite/affine/all/src/blocks/surface/index.ts - Canvas objects
blocksuite/affine/all/src/gfx/shape/index.ts - Embeds and links
blocksuite/affine/all/src/blocks/embed/index.ts - Database views
blocksuite/affine/blocks/database/src/index.ts - Data view system
blocksuite/affine/blocks/data-view/src/index.ts - Content adapters
blocksuite/affine/blocks/database/src/adapters/index.ts
Workspace data
- Document storage
blocksuite/affine/all/src/store/index.ts - Workspace sync
blocksuite/affine/all/src/sync/index.ts - Blob synchronization
blocksuite/framework/sync/src/blob/engine.ts - Local SQLite storage
packages/frontend/native/nbstore/src/storage.rs - Document snapshots
packages/backend/native/src/runtime/backend_runtime/doc_storage.rs
AI and integrations
- AI tool loop
packages/backend/native/src/llm/host/tool_loop/engine.rs - Copilot attachments
packages/backend/server/src/plugins/copilot/storage.ts - Link previews
blocksuite/affine/shared/src/services/link-preview-service/link-preview-service.ts
Other components
- Workspace user
Connections 20
- Workspace user → BlockSuite entry: edits in
- BlockSuite entry → Editor foundation: uses editor core
- BlockSuite entry → Editing controls: provides controls
- BlockSuite entry → Document blocks: composes blocks
- Document blocks → Text and inline content: contains text
- BlockSuite entry → Edgeless canvas: opens canvas
- Edgeless canvas → Canvas objects: arranges objects
- BlockSuite entry → Embeds and links: inserts embeds
- BlockSuite entry → Database views: uses databases
- Database views → Data view system: offers views
- BlockSuite entry → Document navigation: navigates documents
- BlockSuite entry → Content adapters: imports and exports
- Editor foundation → Document storage: stores document state
- Document storage → Local SQLite storage: persists locally
- Document storage → Workspace sync: synchronizes workspace
- Workspace sync → Blob synchronization: syncs blobs
- Document storage → Document snapshots: stores snapshots
- Workspace user → AI tool loop: requests AI work
- AI tool loop → Copilot attachments: uses attachments
- Embeds and links → Link previews: requests previews