How phannhatminh/hodion_drive works
Hodion Drive is a cloud file-storage product with a native macOS client, stateless Workers, Postgres metadata, R2 file content, and per-drive authorization. The main client workflow is a user mounting a drive: the mount controller runs reconciliation, which compares local files with the remote tree, applies sync actions, and records an agreed baseline; file events and the doorbell wake later cycles. On the server, API and auth Workers route requests into domain services and authorization. The graph preserves documented Shared Drive, configurable authorization, and files-on-demand capabilities; unsampled internals are represented at their supported directory paths.
Main entry points: SyncEngine.swift Sync engine · MountController.swift Mount controller · fs-routes.ts Filesystem routes · HTTPAPIClient.swift HTTP API client
Components 28
macOS client
- Mac app
client/Sources/App/HodionDriveApp.swift - Mount controller
client/Sources/App/MountController.swift - Sync engine
client/Sources/Core/Sync/SyncEngine.swift - Reconciler
client/Sources/Core/Sync/Reconciler.swift - Action planner
client/Sources/Core/Sync/Planner.swift - Action applier
client/Sources/Core/Sync/Applier.swift - Local files
client/Sources/Adapters/RealLocalFiles.swift - HTTP API client
client/Sources/Adapters/HTTPAPIClient.swift - Auth session
client/Sources/Adapters/AuthSession.swift - R2 transfer
client/Sources/Adapters/R2BlobTransfer.swift - Sync state
client/Sources/Adapters/JSONStateStore.swift - File Provider
client/Sources/FileProviderExt/HodionFileProviderExtension.swift
Worker APIs
- Drive API worker
server/src/workers/api-worker/app.ts - Filesystem routes
server/src/workers/api-worker/fs-routes.ts - Auth worker
server/src/workers/auth-worker/app.ts - Middleware pipeline
server/src/middleware/pipeline.ts
Drive domain
- Node service
server/src/domain/services/NodeService.ts - Drive service
server/src/domain/services/DriveService.ts - Authorization service
server/src/domain/services/AuthzService.ts - Authorization engine
server/src/domain/engine/EngineAuthorizer.ts - Policy evaluation
server/src/domain/engine/decide.ts - Access model
server/src/domain/model/AccessModel.ts
Storage and integrations
- Postgres engine stores
server/src/adapters/postgres/PgEngineStores.ts - R2 capabilities
server/src/adapters/r2/R2TransferCapabilities.ts - Drive doorbell
server/src/adapters/do/DoorbellNotifier.ts
Other components
- Drive user
- Postgres
- Cloudflare R2
Connections 30
- Drive user → Mac app: uses
README.md - Drive user → File Provider: browses files
README.md - Mac app → Mount controller: starts mounts
- Mount controller → Sync engine: runs cycles
client/Sources/App/MountController.swift - Mount controller → Local files: watches changes
client/Sources/App/MountController.swift - Sync engine → Reconciler: compares trees
client/Sources/Core/Sync/SyncEngine.swift - Sync engine → Action planner: orders actions
client/Sources/Core/Sync/SyncEngine.swift - Sync engine → Action applier: applies plan
client/Sources/Core/Sync/SyncEngine.swift - Sync engine → Local files: scans files
client/Sources/Core/Sync/SyncEngine.swift - Sync engine → HTTP API client: fetches metadata
client/Sources/Core/Sync/SyncEngine.swift - Sync engine → Sync state: loads and saves
client/Sources/Core/Sync/SyncEngine.swift - Mount controller → HTTP API client: configures
client/Sources/App/MountController.swift - Mount controller → R2 transfer: configures
client/Sources/App/MountController.swift - HTTP API client → Auth session: renews tokens
client/Sources/Adapters/HTTPAPIClient.swift - HTTP API client → Drive API worker: sends requests
README.md - File Provider → HTTP API client: requests metadata
client/Sources/FileProviderExt/HodionFileProviderExtension.swift - File Provider → R2 transfer: transfers content
client/Sources/FileProviderExt/HodionFileProviderExtension.swift - R2 transfer → Cloudflare R2: transfers blobs
README.md - Drive API worker → Filesystem routes: routes requests
server/src/workers/api-worker/app.ts - Drive API worker → Middleware pipeline: composes middleware
server/src/workers/api-worker/app.ts - Auth worker → Middleware pipeline: composes middleware
server/src/workers/auth-worker/app.ts - Filesystem routes → Node service: manages nodes
server/src/workers/api-worker/fs-routes.ts - Filesystem routes → Drive service: lists drives
server/src/workers/api-worker/fs-routes.ts - Filesystem routes → Authorization service: changes access
server/src/workers/api-worker/fs-routes.ts - Authorization engine → Policy evaluation: evaluates policy
server/src/domain/engine/EngineAuthorizer.ts - Authorization engine → Node service: filters trash
server/src/domain/engine/EngineAuthorizer.ts - Authorization service → Access model: resolves configuration
server/src/domain/services/AuthzService.ts - Postgres engine stores → Postgres: reads and writes
server/src/adapters/postgres/PgEngineStores.ts - R2 capabilities → Cloudflare R2: enables transfers
README.md - Filesystem routes → Drive doorbell: notifies changes
server/src/workers/api-worker/fs-routes.ts