• Stars
    star
    3,837
  • Rank 10,955 (Top 0.3 %)
  • Language
    TypeScript
  • License
    Mozilla Public Li...
  • Created over 1 year ago
  • Updated 4 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🧩 Content editing tech stack for the web - BlockSuite is a toolkit for building editors and collaborative applications.

BlockSuite

BlockSuite logo and name

Codecov Checks Status Issues Closed NPM Latest Release NPM Nightly Release Open in StackBlitz Join Discord


The BlockSuite project aims to provide a toolkit for building collaborative editors. It creates a tech stack suitable for general-purpose structured content editing, and builds upon that to implement various first-party editors. By leveraging blocks as the fundamental primitive, all BlockSuite-based editors share high compatibility, and can even be dynamically switched as different view layers at runtime.

⚠️ BlockSuite is already in use in the production environment of AFFiNE, but it's still under heavy development and undergoing rapid changes. Stay tuned or check out our roadmap!

Introduction

BlockSuite was originally designed for the AFFiNE knowledge base. In AFFiNE, the same piece of data can be presented in various forms including documents, whiteboards, and tables. Users can smoothly switch among these different forms with real-time collaboration support. To this end, BlockSuite focuses on utilizing blocks as its primitive element to create a standardized collaborative editing engine. This consists of the following modules:

  • ⚑️ CRDT-Driven Block State Management: The block tree model in BlockSuite is implemented using the Yjs CRDT library. Acting like a conflict-free Git, CRDT (conflict-free replicated data type) enables the editor to have built-in conflict resolution and time travel capabilities. By using CRDT as the single source of truth, all editors based on BlockSuite are natively collaborative. Plus, CRDT is blazingly fast.
  • βš›οΈ Atomic Block UI Components: In BlockSuite, blocks act like molecules, which can be further assembled from other blocks or more atomic components. These atomic components include rich-text and canvas renderers. For example, in BlockSuite, 100 paragraph blocks will generate 100 instances of rich-text components, and a form block could connect to multiple rich-text components. All these rich-text instances are linked to the same CRDT block tree, ensuring the cross-block editing operations can be consistently managed. Additionally, BlockSuite editors and blocks are all defined as Web Components, making them easily integratable with other frameworks.
  • 🎨 Adaptable Selection Manager: BlockSuite models operations on abstract selection states, allowing for the extension of various types of selections that are well-suited for multi-user collaboration.
  • πŸ’Ύ Content Transformation and Serialization: BlockSuite supports JSON-based document snapshots and offers extensibility for compatibility with third-party formats. It also provides auxiliary tools for managing forward and backward compatibility, as well as data validation and migration issues.
  • πŸ“‘ Providers for Data Synchronization: The document state in BlockSuite can be serialized into binary and distributed through various providers, allowing for transmission via WebSocket, or storage into persistent backends like SQLite or IndexedDB. Thanks to their support for on-demand loading and incremental updates, these providers work efficiently.

Based on this framework, BlockSuite has already implemented editing capabilities for various types of structured data:

Resources

Getting Started

To learn how to start using BlockSuite, visit blocksuite.affine.pro.

Building

See BUILDING.md for instructions on how to build BlockSuite from source code.

Contributing

BlockSuite accepts pull requests on GitHub. Before you start contributing, please make sure you have read and accepted our Contributor License Agreement. To indicate your agreement, simply edit this file and submit a pull request.

License

MPL 2.0

More Repositories

1

AFFiNE

There can be more than Notion and Miro. AFFiNE(pronounced [Ι™β€˜fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript
32,450
star
2

OctoBase

πŸ™ OctoBase is the open-source database behind AFFiNE, local-first, yet collaborative. A light-weight, scalable, data engine written in Rust.
Rust
1,054
star
3

AFFiNE.pro

AFFiNE official website, source for affine.pro
Vue
556
star
4

editoe

Editoe - Redefine Academic Writing.
62
star
5

awesome-affine

😎 Awesome lists about all kinds of interesting topics around AFFiNE
44
star
6

design

Design System for AFFiNE and BlockSuite
TypeScript
20
star
7

affine.pro-legacy

affine.pro website.
TypeScript
11
star
8

docker

The official Docker deployment solution for AFFiNE.
10
star
9

AFFiNE-docs-archive

AFFiNE Docs - This GItHub is synced with the AFFiNE GitBook.
10
star
10

affine-reader

TypeScript
8
star
11

blocksuite-ecosystem-ci

BlockSuite Ecosystem CI
TypeScript
7
star
12

blocksuite-example-next

Example Next.js app using BlockSuite.
CSS
6
star
13

experimental-virgo

TypeScript
5
star
14

abed

Atomico block editor demo
TypeScript
4
star
15

AFFiNE-Releases

AFFiNE Releases
4
star
16

intl-segmenter-polyfill-rs

This projects polyfills the Intl.Segmenter API for browsers that do not support it.
TypeScript
2
star
17

blocksuite-compat

Package for BlockSuite compat and reliability
JavaScript
2
star
18

blocksuite-example-vite

Example Vite app using BlockSuite.
CSS
1
star
19

set-build-version

TypeScript
1
star
20

.github

1
star
21

affine-workers

TypeScript
1
star
22

helm-charts

helm charts for affine cloud
1
star
23

deploy-to-nomad

TypeScript
1
star
24

affine-plugin-demo

1
star
25

octobase-swift-binding

The static library output for Swift binding of OctoBase.
Swift
1
star