• Stars
    star
    4,289
  • Rank 10,048 (Top 0.2 %)
  • Language
    TypeScript
  • License
    Mozilla Public Li...
  • Created about 2 years ago
  • Updated 3 months 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
41,812
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,312
star
3

AFFiNE.pro

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

awesome-affine

๐Ÿ˜Ž Awesome lists about all kinds of interesting topics around AFFiNE
67
star
5

editoe

Editoe - Redefine Academic Writing.
62
star
6

design

Design System for AFFiNE and BlockSuite
TypeScript
26
star
7

docker

The official Docker deployment solution for AFFiNE.
21
star
8

affine-reader

TypeScript
12
star
9

affine.pro-legacy

affine.pro website.
TypeScript
11
star
10

AFFiNE-docs-archive

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

file-type

Node.js/wasm binding for https://github.com/mmalecot/file-format
Rust
10
star
12

blocksuite-ecosystem-ci

BlockSuite Ecosystem CI
TypeScript
7
star
13

abed

Atomico block editor demo
TypeScript
7
star
14

notesuite

Experimental note-taking app based on BlockSuite and ystream.
TypeScript
6
star
15

experimental-virgo

TypeScript
5
star
16

affine-workers

TypeScript
5
star
17

blocksuite-example-next

Example Next.js app using BlockSuite.
CSS
5
star
18

AFFiNE-Releases

AFFiNE Releases
4
star
19

.github

2
star
20

intl-segmenter-polyfill-rs

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

blocksuite-compat

Package for BlockSuite compat and reliability
JavaScript
2
star
22

blocksuite-example-vite

Example Vite app using BlockSuite.
CSS
1
star
23

set-build-version

TypeScript
1
star
24

octobase-swift-binding

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

deploy-to-nomad

TypeScript
1
star
26

affine-plugin-demo

1
star
27

helm-charts

helm charts for affine cloud
1
star
28

collaboration-room

Cloudflare worker for blocksuite playground collaboration support
TypeScript
1
star