LogseqSpringThing is a distributed 3D knowledge graph visualization system built with a decoupled architecture. It combines a high-performance Rust backend with a React/TypeScript frontend to deliver real-time, interactive graph visualizations with XR capabilities.
- Backend Independence: The server maintains and processes graph data independently of client connections
- Pre-computed State: Graph physics and layout are calculated server-side before clients connect
- Scalable Design: Multiple clients can connect without duplicating computation
- Message-Passing: Uses Actix actors for safe concurrent state management
- Isolation: Each actor manages its own state domain
- Async Communication: Non-blocking message passing between components
- WebSocket Protocol: Binary protocol for efficient position updates
- Bidirectional Updates: Clients can modify graph state with server-side authority
- Optimized Streaming: Only significant changes are transmitted
- GPU Acceleration: Optional CUDA support for physics calculations
- Instanced Rendering: Efficient rendering of thousands of nodes
- Progressive Loading: Metadata loads immediately while data fetches in background
graph TB
subgraph "Client Layer"
Browser[Web Browser]
XRDevice[XR Device<br/>Quest 3]
end
subgraph "Frontend Application"
React[React UI]
R3F[React Three Fiber]
WebXR[WebXR API]
WSClient[WebSocket Client]
end
subgraph "Network Layer"
NGINX[NGINX Proxy]
WSProtocol[Binary WebSocket Protocol]
REST[REST API]
end
subgraph "Backend Application"
ActixWeb[Actix Web Server]
ActorSystem[Actor System]
Services[Service Layer]
end
subgraph "Data Layer"
FileSystem[File System]
GitHub[GitHub API]
AIServices[AI Services<br/>OpenAI, Perplexity, RAGFlow]
end
subgraph "Compute Layer"
CPU[CPU Physics]
GPU[CUDA GPU Physics]
end
Browser --> React
XRDevice --> WebXR
React --> R3F
R3F --> WebXR
React --> WSClient
WSClient --> NGINX
React --> NGINX
NGINX --> WSProtocol
NGINX --> REST
WSProtocol --> ActixWeb
REST --> ActixWeb
ActixWeb --> ActorSystem
ActixWeb --> Services
Services --> FileSystem
Services --> GitHub
Services --> AIServices
ActorSystem --> CPU
ActorSystem --> GPU
- React Application: Component-based UI with TypeScript
- React Three Fiber: Declarative 3D scene management
- WebXR Integration: VR/AR support for Quest 3 and other devices
- State Management: Zustand for application state
- WebSocket Service: Real-time communication with backend
- Actix Web Server: High-performance async HTTP/WebSocket server
- Actor System: Concurrent state management with message passing
- Service Layer: Business logic and external integrations
- GPU Compute: Optional CUDA acceleration for physics
- File Service: Local and GitHub content management
- Initialization: Server loads metadata and builds initial graph
- Client Connection: WebSocket handshake and initial state transfer
- Real-time Updates: Continuous position streaming via binary protocol
- User Interactions: Client updates sent to server and broadcast
- Persistence: Metadata and settings saved to disk
- Language: TypeScript 5.5+
- Framework: React 18 with Concurrent Features
- 3D Rendering: Three.js + React Three Fiber
- XR Support: WebXR API
- State: Zustand
- Styling: Tailwind CSS
- Build Tool: Vite
- Language: Rust (2021 Edition)
- Framework: Actix Web 4
- Concurrency: Actix Actor System
- GPU: CUDA (optional)
- Serialization: Serde + Binary Protocol
- Async Runtime: Tokio
- Containerization: Docker + Docker Compose
- Reverse Proxy: NGINX
- Development: Hot reload with cargo-watch
Instead of traditional shared memory with locks, the system uses actors for:
- Safety: No data races or deadlocks
- Scalability: Natural parallelism
- Clarity: Clear ownership and message flow
Custom binary protocol for position updates provides:
- Efficiency: ~10x smaller than JSON
- Performance: Minimal parsing overhead
- Flexibility: Extensible message types
Supports both CPU and GPU physics:
- Fallback: CPU physics always available
- Acceleration: GPU for large graphs
- Flexibility: Runtime switching
System works at multiple capability levels:
- Basic: 2D visualization fallback
- Standard: Full 3D with interactions
- Enhanced: XR support with hand tracking
- GitHub API: For repository content
- OpenAI API: Speech and chat services
- Perplexity API: Advanced search
- RAGFlow: Document analysis
- Nostr Network: Decentralized authentication
- Authentication: Nostr-based decentralized auth
- API Keys: Protected settings with user isolation
- Network: HTTPS/WSS in production
- CORS: Configured for client access
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Browser │────▶│ NGINX │────▶│ Rust Dev │
│ localhost │ │ :80/:443 │ │ :8080 │
└─────────────┘ └─────────────┘ └─────────────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Vite Dev │ │ Data │
│ :5173 │ │ Volume │
└─────────────┘ └─────────────┘
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Internet │────▶│ CloudFlare │────▶│ NGINX │
│ HTTPS │ │ CDN │ │ Container │
└─────────────┘ └─────────────┘ └─────────────┘
│
▼
┌─────────────┐
│ Rust Server │
│ Container │
└─────────────┘
- Concurrent Clients: 100+ simultaneous connections
- Graph Size: 10,000+ nodes with GPU acceleration
- Update Rate: 60 FPS position streaming
- Latency: <16ms for local updates
- Memory: ~500MB base + 100KB per node
- CPU: 1-2 cores for physics simulation
- GPU: Optional, 50-100x speedup for large graphs
- Network: 10-50 KB/s per active client
For detailed component documentation, see: