$ show toeverything/AFFiNE
AFFiNE is a cross-platform, block-based knowledge management application that combines notes, whiteboards, and databases in a local-first, real-time collaborative environment. Built on the BlockSuite editor framework, it features a modular architecture with extensible components, AI-powered capabilities (Copilot), and support for embedding external content. The application consists of a web client, desktop client (Electron), and mobile clients (iOS/Android), backed by a Node.js/NestJS server with Prisma ORM and Rust performance modules. Data is synchronized via Yjs CRDTs with a custom storage layer (nbstore) for offline-first capabilities.
The LLM identified 4 files worth highlighting for reuse:
Implements a provider-based extension system for registering store extensions, enabling pluggable functionality in the BlockSuite editor. The system uses dependency injection via identifiers to decouple extensions from core logic, allowing developers to add new store behaviors without modifying the base framework. This pattern is highly reusable in any application requiring runtime extensibility.
Provides a Yjs-based implementation of the nbstore abstraction for real-time collaborative state synchronization with offline support. This module integrates Yjs awareness and persistence with IndexedDB and broadcast channels, enabling seamless cross-tab and cross-device collaboration. The storage abstraction pattern allows swapping different persistence mechanisms (e.g., IndexedDB, SQLite) without altering collaboration logic, making it reusable in other offline-first applications.
Defines a design token-based theming system using CSS variables to support dynamic theme switching (including dark/light mode) with minimal runtime overhead. The system exposes semantic color and spacing tokens that can be consumed by UI components via styled-jsx or CSS-in-JS solutions. Its framework-agnostic approach (working with plain CSS variables) allows easy extraction to other web applications seeking consistent, maintainable theming.
Implements a reusable data view system for rendering and interacting with tabular data through multiple views (table, kanban, calendar) with built-in virtual scrolling, column resizing, filtering, grouping, and sorting. The property preset system allows defining custom data types and cell renderers, while the view preset architecture enables extending with new visualization modes. This component is decoupled from application-specific logic and can be integrated into any data-driven interface.