You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Status: Needs Architectural Review
This issue outlines a proposed core architectural change. It requires technical review and approval before deciding whether to implement or adopt.
Replace auto-increment integers and random UUID v4 strings with Universally Unique Lexicographically Sortable Identifiers (ULID) and establish a formal multi-terminal device model (Organization -> Location -> Register -> Device).
Key Features & Technical Details
ULID Identifiers:
Crockford Base32 128-bit ULIDs combining 48-bit UNIX timestamps with 80 bits of random data (01ARZ3NDEKTSV4RRFFQ69G5FAV).
Time-ordered to preserve SQLite B-Tree index performance as databases grow.
Verdict: NOT APPLICABLE TO FLOCAFE as proposed — needs maintainer decision only if offline multi-terminal sync becomes a goal
Findings:
IDs are mixed today (INTEGER AUTOINCREMENT for orders main/db.ts:4156, print_logs :2306; TEXT ids for held_orders/users/tables/customers). A ULID migration would touch every table, route, and fixture — a massive refactor with no stated problem in FloCafe.
The Organization → Location → Register → Device hierarchy conflicts with the architecture: FloCafe is a single local install. Companion devices pair via mDNS flo.local (main/index.tsstartMdns), KDS pairing tokens, and FloAdmin store registration (ensureCloudIdentity, setCachedPairingCode in main/db.ts:635-665). Order numbers come from sequences (timezone-aware, feat: configure invoice numbering #297), giving sortable, human-readable IDs already.
No code change is warranted without a product goal (e.g., true multi-terminal offline sync) — the issue should be closed or held as an architectural note, not backlog work.
Maintainer decision: not applicable to FloCafe's architecture
FloCafe's supported multi-terminal model is centralized:
POS terminals / waiter devices / KDS / kiosks
↓ LAN HTTP/WebSocket
One authoritative local FloCafe server
↓
One SQLite database
Terminals are clients of the local server. They do not maintain independently writable transaction databases and do not later merge sales. Consequently, the collision scenario this proposal is designed to solve does not exist within the supported architecture.
Decision
Keep SQLite integer primary keys for local transactional tables.
Keep human-facing order and invoice numbers separate from internal database identity.
Do not introduce ULIDs, distributed transaction IDs, or the proposed Organization → Location → Register → Device hierarchy.
Do not adopt the referenced fork implementation. In addition to being unnecessary, its migration numbers 68–70 now conflict with migrations already present in the repository, and its plain 26-character ULIDs do not match this issue's prefixed-ID acceptance criterion.
A lightweight local terminal/counter identity may be introduced later if an approved feature needs workstation attribution, counter-specific printers/cash drawers, or the create-at-one-counter/pay-at-another workflow. That is a local configuration concern, not database synchronization.
Relevant improvements under the centralized model
These should be evaluated independently rather than used to justify distributed identifiers:
Server availability: launch-at-login/start-at-boot support, dedicated-server deployment guidance, UPS/wired-LAN recommendations, and clear terminal connection-loss recovery.
LAN security: the current HTTP/WS trusted-LAN boundary should be documented explicitly or optional HTTPS/WSS should be designed.
Multi-client correctness: add focused concurrent-client tests for duplicate payment, simultaneous order edits, table selection, split checks, cancellation/payment races, and last-stock sales.
Terminal attribution and peripheral routing: add only when product workflows require knowing which counter created/paid an order or which printer/cash drawer belongs to it.
Cross-terminal freshness: retain backend-authoritative validation and improve typed real-time updates/conflict refresh where polling can temporarily display stale state.
Data protection: unattended rotating local/NAS backups, backup-age warnings, and restore verification alongside the optional Google Drive backup.
A FloCafe location has exactly one authoritative local server and database. POS terminals, KDS displays, waiter devices, kiosks, and customer displays are clients of that server and do not maintain independently writable transaction databases.
Closing as not planned. If independently writable offline terminals ever become an approved product requirement, synchronization semantics and conflict resolution must be designed first; identifier selection would follow that design.
The ULID and multi-database synchronization proposal is still not approved: FloCafe retains one authoritative local server and database. This issue will remain open temporarily while the centralized multi-terminal gaps identified above are reviewed and either:
explicitly accepted as deployment constraints, or
moved into focused implementation issues for server availability, LAN transport security, concurrent-client coverage, terminal/counter attribution, real-time freshness, peripheral routing, and unattended backups.
No implementation of main/core/ids.ts, ULID migrations, or the proposed organization hierarchy should begin from this issue without a separate architectural decision.
Closing as not_planned per the earlier maintainer decision rejecting ULID migrations and distributed multi-database sync. FloCafe retains one authoritative local SQLite server with integer transactional primary keys. Most of the centralized multi-terminal improvements noted when this issue was temporarily reopened have since shipped on main: automatic in-process LAN HTTPS (#1624), counter entities (#1411, main/routes/counters.ts), per-station local WebUSB printing (#1616), unattended local backups (main/routes/database-tools.ts), and #277 security hardening. Any remaining operational docs (launch-at-login or UPS guidance) should be tracked as small focused tasks rather than under a rejected ULID proposal.
Activity
khaira777 commentedon Aug 16, 2026
Verdict: NOT APPLICABLE TO FLOCAFE as proposed — needs maintainer decision only if offline multi-terminal sync becomes a goal
Findings:
main/db.ts:4156, print_logs:2306; TEXT ids for held_orders/users/tables/customers). A ULID migration would touch every table, route, and fixture — a massive refactor with no stated problem in FloCafe.Organization → Location → Register → Devicehierarchy conflicts with the architecture: FloCafe is a single local install. Companion devices pair via mDNSflo.local(main/index.tsstartMdns), KDS pairing tokens, and FloAdmin store registration (ensureCloudIdentity,setCachedPairingCodeinmain/db.ts:635-665). Order numbers come from sequences (timezone-aware, feat: configure invoice numbering #297), giving sortable, human-readable IDs already.No code change is warranted without a product goal (e.g., true multi-terminal offline sync) — the issue should be closed or held as an architectural note, not backlog work.
itsbkm commentedon Sep 1, 2026
Maintainer decision: not applicable to FloCafe's architecture
FloCafe's supported multi-terminal model is centralized:
Terminals are clients of the local server. They do not maintain independently writable transaction databases and do not later merge sales. Consequently, the collision scenario this proposal is designed to solve does not exist within the supported architecture.
Decision
Organization → Location → Register → Devicehierarchy.A lightweight local terminal/counter identity may be introduced later if an approved feature needs workstation attribution, counter-specific printers/cash drawers, or the create-at-one-counter/pay-at-another workflow. That is a local configuration concern, not database synchronization.
Relevant improvements under the centralized model
These should be evaluated independently rather than used to justify distributed identifiers:
Architectural invariant going forward:
Closing as not planned. If independently writable offline terminals ever become an approved product requirement, synchronization semantics and conflict resolution must be designed first; identifier selection would follow that design.
itsbkm commentedon Sep 1, 2026
Reopening at maintainer request.
The ULID and multi-database synchronization proposal is still not approved: FloCafe retains one authoritative local server and database. This issue will remain open temporarily while the centralized multi-terminal gaps identified above are reviewed and either:
No implementation of
main/core/ids.ts, ULID migrations, or the proposed organization hierarchy should begin from this issue without a separate architectural decision.khaira777 commentedon Nov 28, 2026
Closing as
not_plannedper the earlier maintainer decision rejecting ULID migrations and distributed multi-database sync. FloCafe retains one authoritative local SQLite server with integer transactional primary keys. Most of the centralized multi-terminal improvements noted when this issue was temporarily reopened have since shipped onmain: automatic in-process LAN HTTPS (#1624), counter entities (#1411,main/routes/counters.ts), per-station local WebUSB printing (#1616), unattended local backups (main/routes/database-tools.ts), and#277security hardening. Any remaining operational docs (launch-at-login or UPS guidance) should be tracked as small focused tasks rather than under a rejected ULID proposal.