How priyanshu-t-singh/le-grimoire works
Le Grimoire is a Go e-ink reading service: devices authenticate, navigate a library, request rendered pages, and retain per-device navigation state. Its HTTP handlers are the device workflow entry point; provider, state, rendering, and persistence components support that flow. A separate terminal UI offers interactive reading. The composition and middleware wiring are visible in sampled source; handler internals and several domain implementations were not sampled, so uncertain call relationships are omitted.
Main entry points: server.go Service bootstrap · routes.go API handlers · repository.go Device repository · factory.go Provider factory
Components 20
Application Runtime
- HTTP server
internal/core/server.go - Service bootstrap
internal/server/server.go - Request middleware
internal/middleware/middleware.go - Device authentication
internal/middleware/auth.go
Device Reading
- API handlers
internal/handlers/routes.go
Book Content
- Book provider
internal/library/provider.go - Provider factory
internal/provider/factory.go - Kavita connector
internal/provider/kavita/kavita.go - Local filesystem provider
internal/provider/localfs/localfs.go - E-ink renderer
internal/render/image.go - Frame cache
internal/render/cache.go
Device State
- Device repository
internal/device/repository.go - SQLite database
internal/database/db.go - Navigation state machine
internal/state/machine.go - Navigation state
internal/state/models.go
Terminal Reader
- Terminal UI
internal/tui/app.go
Other components
- E-ink device
- Kavita server
- Chromium
- Terminal reader
Connections 25
- Service bootstrap → Book provider: creates and connects
- Service bootstrap → Provider factory: selects provider
- Service bootstrap → Device repository: creates
- Service bootstrap → Navigation state machine: creates
- Service bootstrap → E-ink renderer: creates
- Service bootstrap → Frame cache: creates
- Service bootstrap → SQLite database: opens
- Service bootstrap → API handlers: wires dependencies
- Service bootstrap → HTTP server: starts
- HTTP server → Request middleware: wraps router
- Request middleware → Device authentication: dispatches through
- Device authentication → Device repository: checks device key
- Device repository → SQLite database: reads and writes
- Device repository → Navigation state: loads and saves
- E-ink device → API handlers: requests pages and buttons
- API handlers → Navigation state machine: processes navigation
- API handlers → Book provider: requests library content
- API handlers → E-ink renderer: requests rendered frames
- API handlers → Frame cache: checks and updates frames
- Provider factory → Kavita connector: selects when configured
- Kavita connector → Kavita server: calls REST API
- Provider factory → Local filesystem provider: selects when configured
- E-ink renderer → Chromium: captures pages
- Terminal reader → Terminal UI: navigates and reads
- Terminal UI → Book provider: loads book content