DevelopersTechnologySpacepos Runtime
Technology

SpacePOS Runtime & Sync

Config and state

SpacePOS keeps two main config layers:

  • Node config (config_state): app-wide settings such as API URLs, feature flags, and auth token.
  • Terminal/library config: terminal identity, onboarding code, sync toggles, and ERP endpoints.

Common fields (examples):

  • client_id, client_secret
  • api_endpoint
  • amqp_url
  • ingest_frequency, send_frequency, data_sync_retry_interval_minutes
  • store_number, terminal_number, company_information

Runtime update state (including SpaceFuel blue/green tracking and snooze state) is stored in state.json.

Auth bootstrapping

SpacePOS uses client credentials for machine-to-machine calls:

  • ERP issues client_id / client_secret during onboarding.
  • These are sent as headers for release checks and other ERP endpoints.
  • User actions still use JWT auth; client auth is for device/terminal operations.

ERP sync model

SpacePOS syncs data with ERP using two channels:

  • REST seeding for initial datasets and snapshot-style reads.
  • RabbitMQ events for incremental updates.

Offline operations are queued locally and retried on a timer:

  • ingest_frequency: how often inbound data is pulled.
  • send_frequency: how often outbound operations are pushed.
  • data_sync_retry_interval_minutes: retry cadence on failures.

Presence reporting

SpacePOS emits a periodic POSPresenceEvent that includes:

  • Component statuses (SpacePOS + SpaceFuel when applicable)
  • Current StoreStaffId (nullable)
  • Client credentials (client_id / client_secret) for ERP correlation

Presence reporting can be toggled per terminal with report_presence, and the interval is stored in presence_interval_seconds (default 300s). ERP can adjust the interval via POSPresenceIntervalUpdatedIntegrationEvent.

Updates and components

Updates are component-based:

  • SpacePOS (Tauri MSI)
  • SpaceFuel extension

Pending releases are fetched from ERP using client credentials and OS-specific user-agent info. SpacePOS builds a one-shot local manifest for Tauri’s updater based on the pending release payload. Snooze defaults are 5 minutes with 3 total snoozes per component/version.

ERP tracking events are emitted when updates are staged or applied:

  • POSComponentReadyEvent
  • POSComponentAppliedEvent

Extensions: SpaceFuel

SpaceFuel is a Windows Service extension:

  • Staged into extensions/spacefuel/{blue,green}.
  • Active slot tracked in state.json.
  • UI surfaces SpaceFuel updates alongside SpacePOS.

SpaceFuel interacts with forecourt controllers and writes sales back to the shared data store.