How rrweb-io/rrweb works
Main Components Overview
a) rrweb-snapshot
• Purpose: DOM serialization and reconstruction
• Components to show:
• Snapshot engine
• DOM rebuilding engine
• Serialization layer
b) rrweb (core)
• Purpose: Recording and replaying
• Components to show:
• Record module
• Replay module
• Mutation observer system
• Event handling system
c) rrweb-player
• Purpose: UI playback interface
• Components to show:
• Player UI components
• Playback controls
• Timeline management
Data Flow Architecture
Recording Flow:
DOM Events → Mutation Observer → Event Processor → Serializer → Storage
Replay Flow:
Storage → Deserializer → DOM Rebuilder → Player UI → Browser Rendering
Key Architectural Elements
a) Core Services (show as separate modules):
• Canvas recording service
• Console recording service
• WebGL recording service
• Shadow DOM handling
• Cross-origin iframe management
• Stylesheet management
b) Plugin System (show as extensible modules):
• Plugin API interface
• WebRTC plugins
• Console plugins
• Sequential ID plugins
Integration Points
External integration points:
• Browser APIs
• Storage systems
• Cross-origin communication channels
• WebRTC connections
• Custom event handlers
Component Relationships
Relationships between:
• Record and replay modules
• Snapshot and mutation handling
• Player UI and replay engine
• Plugin system and core functionality
Technical Details
Annotations for:
• TypeScript integration
• Build system connections
• Test framework integration
• Package dependencies