How ddvk/rmfakecloud works
Project Type and Purpose
• This is a full-stack, monolithic Go application with a React frontend that emulates the official reMarkable “cloud” sync service (rmfakecloud).
• It provides HTTP APIs for reMarkable tablets (diff-sync & file operations), a web UI for user management and document browsing, CLI utilities for administrative tasks, and optional integrations with Dropbox/FTP/WebDAV.
Key Architectural Components
A. Clients
• reMarkable Tablet (diff-sync v1/v15)
• Web Browser (React UI served by backend)
• CLI Tools (cmd/* Go binaries for history export, fake-cloud management, tests)
B. API Layer
• HTTP server built with Go (internal/app/routes.go, handlers.go)
• Middleware for logging, authentication, CORS (internal/app/middleware.go)
• JWT/Auth0 integration (internal/messages/auth0.go)
C. Sync Engine / Hub
• Real-time synchronization hub (internal/app/hub/hub.go)
• Diff-sync logic (old vs. new diff-sync15)
D. Storage Layer
• Local filesystem storage (internal/storage/fs/*)
• Data models (archives, hash trees, metadata) (internal/storage/models/*)
• Exporters for PDF, archive rendering (internal/storage/exporter/*)
E. Integrations (optional data backends)
• Dropbox, FTP, WebDAV, LocalFS connectors (internal/integrations/*)
F. Email Service
• SMTP client for user notifications (internal/email/smtp.go)
G. Configuration & CLI
• Central config loader (internal/config/config.go)
• CLI manager (internal/cli/managerusers.go)
H. Infrastructure
• Docker setup (Dockerfile, dockerbuild.sh, dev.sh)
• Helm chart for Kubernetes (helm/Chart.yaml, templates/*.yaml)
Relationships & Data Flows
• Tablets ⇄ HTTP API: diff-sync, document upload/download
• Browsers ⇄ HTTP API: user login (email), profile, document browser
• CLI Tools ⇄ HTTP API: administrative operations (set users, diff flags)
• API Layer → Storage Layer: read/write files, metadata
• API Layer → Sync Engine: publish/subscribe sync events
• API Layer → Email Service: send auth tokens or notifications
• Storage Layer ↔ Integrations: optional data replication to external services
Architectural Patterns & Principles
• Monolithic service with clear package boundaries (app, storage, integrations)
• MVC-like separation: handlers/routes (controller), storage/models (model), React UI (view)
• Dependency injection for connectors and SMTP client via codeconnector.go
• Configuration via environment variables and internal/config
• Container-first design with Docker and Kubernetes manifests