How brook-sys/picofarm works
PicoFarm is a self-hosted print-farm and order-fulfillment application. Users manage a product catalog and sales, turn order items into production tasks and print jobs, then queue work and monitor or control a printer fleet. The browser frontend talks to a Go API; business workflows use repository and storage layers backed by SQLite and disk files. Major additional capabilities include sales-channel integrations, slicer support, realtime updates, notifications, and operational reporting. Some backend wiring and unsampled pages are represented only where the README or source index supports the relationship.
Main entry points: client.ts API client · App.tsx Web app routes · service Business services · Sales.tsx Sales and orders
Components 24
Web application
- Web app routes
web/src/App.tsx - Sales and orders
web/src/pages/Sales.tsx - Catalog and tasks
web/src/pages/ProjectDetail.tsx - Printer and queue UI
web/src/pages/PrintQueue.tsx - Channel settings
web/src/pages/Channels.tsx - File library
web/src/pages/GCodeFiles.tsx - Materials UI
web/src/pages/Materials.tsx - Settings and slicer
web/src/pages/Settings.tsx - API client
web/src/api/client.ts - Realtime updates
web/src/hooks/useWebSocket.ts
Backend workflows
- Go server runtime
cmd/server/main.go - HTTP API routes
internal/api/router.go - Business services
internal/service - WebSocket hub
internal/realtime/hub.go
Print operations
- Printer service
internal/service/printer_service.go - Printer connections
internal/printer/manager.go - Printer protocols
internal/printer
Persistence
- Data repositories
internal/repository - SQLite database
internal/database/sqlite.go - Uploaded files
internal/storage/storage.go
Integrations
- Sales channels
internal/saleschannel - External slicer
internal/service/slicer.go
Other components
- Farm operator
- Sales platforms
Connections 29
- Farm operator → Web app routes: uses
- Web app routes → Sales and orders: routes to
web/src/App.tsx - Web app routes → Catalog and tasks: routes to
web/src/App.tsx - Web app routes → Printer and queue UI: routes to
web/src/App.tsx - Web app routes → Channel settings: routes to
web/src/App.tsx - Sales and orders → API client: requests data
- Catalog and tasks → API client: requests data
- Printer and queue UI → API client: requests data
web/src/api/client.ts - API client → HTTP API routes: calls API
- Go server runtime → HTTP API routes: starts
cmd/server/main.go - HTTP API routes → Business services: dispatches to
internal/api/router.go - Sales channels → Sales platforms: connects
- Business services → Sales channels: uses adapters
- Business services → Data repositories: persists through
internal/service/printer_service.go - Data repositories → SQLite database: accesses
- Business services → Uploaded files: stores uploads
- Business services → Printer service: includes
- Printer service → Printer connections: connects printers
internal/service/printer_service.go - Printer connections → Printer protocols: uses clients
- Settings and slicer → API client: configures
- Settings and slicer → External slicer: configures
- Web app routes → Realtime updates: uses updates
web/src/App.tsx - Realtime updates → WebSocket hub: receives events
- WebSocket hub → HTTP API routes: serves WebSocket
internal/api/router.go - File library → API client: requests files
- Materials UI → API client: requests inventory
- Farm operator → Sales and orders: records orders
- Sales and orders → Catalog and tasks: fulfills items
- Catalog and tasks → Printer and queue UI: queues print jobs