The challenge
Inventory and sales are everyday work. Requiring a constant cloud connection would make local operations depend on network availability.
Project scope
- Local inventory and sales
- Background synchronization
- Separate cloud backend
Decisions behind the build
Make local storage the foundation
The backend is an offline-first FastAPI sidecar using a local SQLite database. Local inventory and sales can be stored on the pharmacy machine.
The tradeoff
The local database must be persisted and backed up independently of application deployments.
Move synchronization into an outbox worker
A separate worker sends outbox events in configurable batches. This separates local transactions from the timing of a remote service.
The tradeoff
Retry behavior and remote event handling need careful coordination.
Make schema upgrades explicit
Alembic migrations and configurable startup migration behavior support updating an installed database.
The tradeoff
Deployments must preserve the database file and handle failed upgrades safely.
What took shape
A local-first architecture with a separate path for cloud synchronization, rather than a browser-only dependency on a remote API.
Built with
FastAPI · SQLite · Outbox worker
Based on the project implementation and documentation. Tradeoffs explain the implications of these choices; no measured business results or client feedback are claimed.