This is a collaborative text editor demo based on the Yjs collaborative editing framework with PromiseGrid protocol integration.
It enables multiple users to edit shared text documents in real-time using WebSocket and local IndexedDB persistence, while also generating real PromiseGrid CBOR messages for decentralized computing demonstration.
This demo has been extended with additional features that are useful to teams, including user presence, logging, export options, document awareness, and genuine PromiseGrid protocol messaging.
- Real-time collaborative editing
- Shared cursors and user awareness
- Custom usernames and color indicators
- Room-based collaboration via URL (e.g.,
?room=my-team
) - UUID-based room creation (see
docs/guid-rooms.md
) - Typing indicators and presence tracking
- Toggleable user activity log
- Offline support with automatic syncing (via IndexedDB)
- Complete menu bar: File, Edit, Format, Tools, View, and Help menus
- Over 30 menu features: Many implemented features and several planned for future releases. Much of this is a work-in-progress.
- Comprehensive keyboard shortcuts: 23+ shortcuts including standard (Ctrl+C, Ctrl+V), formatting (Ctrl+B, Ctrl+I, Ctrl+U), and advanced (Ctrl+Alt+1/2/3 for headings, Ctrl+Shift+S for copy, Ctrl+M for markdown preview)
- Smart export options: All exports use document title for filename generation
- Side-by-side markdown preview: Real-time markdown rendering with Ctrl+M toggle and Ctrl+R refresh
- Professional interface: Clean, modern design matching a traditional document editor aesthetic
- Menu integration: Seamlessly connects to existing WASM and collaboration features
- Document compression: 98% compression ratio using Rust WASM
- Smart text formatting: Auto-clean whitespace, headers, and code blocks
- Markdown formatting buttons: Bold, italic, underline with smart toggle
- Live document statistics: Real-time word count, character count, reading time
- Client-side processing: All text operations run in browser with near-native speed
- Search: Search functionality that highlights matches in the document
- Real CBOR message generation: Creates authentic PromiseGrid messages with official 'grid' tag (0x67726964)
- Live protocol demonstration: Every formatting action generates PromiseGrid messages
- Decentralized messaging: Protocol-compliant messages for distributed computing
- Content-addressable data: Document edits as PromiseGrid promises and capabilities
- Export functionality: Save documents as PromiseGrid CBOR files
- Console logging: Real-time display of PromiseGrid message creation
- Real CBOR message generation: Creates authentic PromiseGrid messages with official 'grid' tag (0x67726964)
- Live protocol demonstration: Every formatting action generates PromiseGrid messages
- Decentralized messaging: Protocol-compliant messages for distributed computing
- Content-addressable data: Document edits as PromiseGrid promises and capabilities
- Export functionality: Save documents as PromiseGrid CBOR files
- Console logging: Real-time display of PromiseGrid message creation
- Optional Go or Rust backend support:
- Go backend: Simple in-memory collaboration for legacy support
- Rust backend: Fast document persistence, UUID-based room support, Markdown export
- Menu system integration: All export formats accessible through File menu
- Client-side processing: Most menu operations happen in browser without backend dependency
- Plain text
- CodeMirror state (JSON)
- PromiseGrid CBOR (protocol-compliant messages)
- Yjs snapshot (binary
.ysnap
) - Yjs update (JSON array)
This editor demonstrates real PromiseGrid protocol implementation through:
Every user action creates authentic PromiseGrid CBOR messages:
PromiseGrid CBOR message created: 193 bytes
Created PromiseGrid message for bold edit
- Official CBOR tag: 0x67726964 ('grid')
- Message structure: Protocol hash + payload with message type and data
- Capability-based design: Ready for decentralized permission systems
- Content-addressable: Following PromiseGrid's storage model
document_edit
- Text formatting and editing operationsdocument_stats
- Live document statistics updatesexport
- Document export operations
See docs/promisegrid-integration.md for complete technical details.
To launch the editor, open the application in your browser. You can specify a custom room in the URL like this:
http://localhost:8080/?room=your-room-name
This creates or joins a shared editing space named your-room-name
.
If no room is specified, a globally unique room name (UUID) will be generated automatically. You can share the resulting URL with others to collaborate in the same document.
Example:
http://localhost:8080/?room=b51f0dd8-bc93-4a3d-a0e5-417a8ac812c4
-
Clone the repository:
git clone https://github.com/your-org/collab-editor.git cd collab-editor
-
Install dependencies:
npm install
-
Build WASM module (includes PromiseGrid functions):
make wasm
-
Start the WebSocket server:
make ws
-
In a separate terminal, start the dev server:
make serve
-
Optional: Start the Rust backend:
make run
-
Open your browser and visit:
http://localhost:8080/?room=my-room
Replace
my-room
with any custom room name. If none is provided, a UUID will be generated. -
Check browser console to see PromiseGrid messages being generated in real-time!
Once running, you can verify PromiseGrid functionality:
- Open browser console to see initialization messages
- Type and format text - each action creates PromiseGrid messages
- Export as PromiseGrid CBOR from the dropdown menu
- Console testing: Use exposed functions like
window.createPromiseGridMessage()
Expected console output:
PromiseGrid CBOR message created: 193 bytes
PromiseGrid Message: { "protocol_hash": "QmPromiseGridProtocolV1", ... }
Created PromiseGrid message for bold edit
For advanced use and automation, see docs/makefile-usage.md for how to run the Go and Rust servers using make
.
Key commands:
make wasm
- Build Rust WASM module with PromiseGrid functionsmake dev-all
- Start complete development stackmake ws
- Start WebSocket server for collaborationmake serve
- Start frontend development server
Please see the User Guide for detailed usage instructions, UI explanations, and feature descriptions.
For information about UUID-based rooms, see docs/uuid-rooms.md.
- Yjs - Collaborative editing with CRDTs
- y-websocket - Real-time synchronization
- y-indexeddb - Offline persistence
- CodeMirror 6 - Advanced text editing
- Vanilla JS / HTML / CSS - Frontend
- Rust WebAssembly (WASM) - High-performance text processing + PromiseGrid protocol
- PromiseGrid CBOR - Decentralized computing messages
- serde_cbor - Protocol-compliant message encoding
- Go (optional backend for legacy and service compatibility)
- Rust (new backend for high-performance persistence and exports)
src/
: All core JavaScript logicsrc/setup/
: Initialization modules (Yjs, editor, user)src/export/
: Export handlers including PromiseGrid CBORsrc/wasm/
: WebAssembly integration and initializationsrc/export/
: Export handlers including PromiseGrid CBORrust-wasm/
: Rust code compiled to WebAssembly (includes PromiseGrid functions)rust-server/
: Rust backend server codedocs/
: Markdown documentation (includes user guide and other files)
- User Guide — How to use the editor and its features
- UUID-Based Rooms — How room names are generated using UUIDs
- Formatting Spec — Planned document structure and export formats
- Rust Developer Notes — Architecture and data flow for the Rust backend (for Go developers)
- docs/makefile-usage.md — How to use the Makefile for building and running the Rust or Go server
- docs/project.md — Latest project overview and architecture
- docs/rust-wasm-features.md — Features implemented in the Rust for WebAssembly
- docs/promisegrid-integration.md — Complete PromiseGrid protocol implementation details, CBOR message structure, and integration guide
- docs/editor-menu.md — Full list of menu features and keyboard shortcuts
- docs/keyboard-shortcuts.md — Comprehensive list of keyboard shortcuts
- docs/menu-development.md — How to extend and add new menu features
Current Implementation: Functional CBOR message creation with official 'grid' tag
Integration Level: Live message generation during collaborative editing
Protocol Compliance: Authentic PromiseGrid message structure and encoding
Next Steps: Network communication and decentralized node messaging
This project demonstrates real PromiseGrid protocol implementation suitable for decentralized computing research and development.
- docs/promisegrid-integration.md — Complete PromiseGrid protocol implementation details, CBOR message structure, and integration guide
Current Implementation: Functional CBOR message creation with official 'grid' tag
Integration Level: Live message generation during collaborative editing
Protocol Compliance: Authentic PromiseGrid message structure and encoding
Next Steps: Network communication and decentralized node messaging
This project demonstrates real PromiseGrid protocol implementation suitable for decentralized computing research and development.
This is a living demo extended for internal team use and PromiseGrid protocol research. Pull requests and suggestions are welcome, especially for advancing the decentralized computing capabilities.