Skip to content

Architecture

Overview of the SciFlow monorepo architecture.

Package Structure

packages/
├── editor/
│   ├── core/          # Core editor runtime APIs
│   └── start/         # Lit web component wrapper
└── schema/
    ├── core/          # Base types and interfaces
    └── prosemirror/   # ProseMirror schema implementation

Package Dependencies

@sciflow/editor-start
  └── @sciflow/editor-core
      └── @sciflow/schema-prosemirror
          └── @sciflow/schema-core

Core Concepts

Editor

The Editor class is the main entry point for programmatic control. It: - Manages ProseMirror state - Handles document synchronization - Provides command access - Emits events for document/selection changes

Command System

Three complementary APIs: - Immediate commands (commands.*) - Execute immediately - Flows (flow()) - Batch operations - Inspection (can()) - Check capabilities

See Command System for details.

Sync Strategy

Abstract interface for persistence and collaboration: - load() - Load document from storage - applyExternal() - Handle remote changes - applyLocal() - Send local changes - dispose() - Cleanup

Schema

ProseMirror schema defines: - Node types (doc, paragraph, heading, etc.) - Mark types (strong, em, etc.) - Attributes for each node/mark

Build System

  • Nx - Monorepo orchestration
  • TypeScript - Type checking and compilation
  • Vite - Bundling for browser bundle
  • Vitest - Testing framework

Development Tools

  • ESLint - Code linting
  • Prettier - Code formatting
  • TypeScript - Type safety