Architecture
Dashboard -> checked database functions -> Postgres rules and command queue
|
restricted hub account
|
Terminal -> private WebSocket -> hub -> durable scan spool -> Postgres
The terminal connects out to the hub. Commands are sent one at a time with a quiet gap. The hub acknowledges scans only after local durable storage accepts them, then uploads them. A failure must be visible and retried safely.
The dashboard uses checked functions, not direct writes to sales tables. Permissions live in database row-level security and functions, not hidden UI. There is exactly one owner. Money and audit history are immutable; corrections use new credit/refund records.
Demo mode runs the same migrations in PGlite in the browser. Hub integration tests use the real migrations and a fake terminal. The SDK has no database dependency and can serve other applications independently.
All development packages share a root npm workspace and lockfile. The hub
imports @danishjsheikh/doorlink-sdk directly; it does not maintain another
protocol or transport implementation. Root build/test commands build the SDK
before using the hub. ws belongs to the SDK at runtime; the hub uses it only
in fake-terminal tests.
One hub handles one terminal connection. Database device records do not imply the hub supports simultaneous terminals. A cloud server needs a private router tunnel or equivalent secure networking; IP and serial checks alone are not authentication or encryption.