Skip to main content

Prerequisites

  • Node.js 20+ (node -v to check)
  • Odoo 12 running locally at http://localhost:8069 with a POS session open
  • A terminal with 3 tabs

Step 1: Build the protocol package

The protocol package must be built first since the hub depends on it.

Step 2: Start the hub in dev mode

Open a new terminal tab:
Create a .env file for local development:
.env
HUB_DEV_AUTH=true enables dev-mode auth bypass. When the frontend sends an empty token, the hub authenticates using its own Odoo credentials instead of rejecting the connection.
Start with tsx (auto-reloads on changes):
Verify it works:
Expected output:
Open http://localhost:8766/ in a browser to see the live dashboard.

Step 3: Enable hub mode in Odoo

  1. Go to Point of Sale > Configuration
  2. Set nu_hub_enabled = checked
  3. Set nu_hub_url = ws://localhost:8766
  4. Save

Step 4: Start the frontend

Open a third terminal tab:
Open two browser tabs:
  • Tab 1: http://localhost:3000/pos-react/order/?table=1
  • Tab 2: http://localhost:3000/pos-react/order/?table=1
Both tabs should connect to the hub. The dashboard at http://localhost:8766/ should show 2 connected terminals.

Step 5: Test real-time sync

  1. In Tab 1: Add an item to the order
  2. Watch Tab 2: The item should appear within milliseconds
  3. Check the dashboard: 2 terminals, 1 active lease, events flowing

Test leasing

  1. In Tab 1, open an order (acquires a lease)
  2. In Tab 2, try to open the same order
  3. Tab 2 should see a “LEASE_DENIED”
  4. Navigate away in Tab 1 (releases the lease)
  5. Tab 2 can now acquire the lease

Test offline recovery

  1. Stop the hub (Ctrl+C in the hub terminal)
  2. Add items in Tab 1 — they queue in the localStorage outbox
  3. Restart the hub (npm run dev)
  4. The frontend reconnects automatically and flushes the outbox

Development workflow

Inspecting the hub database

The dev SQLite file is at nu_pos_hub/dev.sqlite:

Testing with wscat

Connect to the hub directly to test the protocol:
Then send messages manually:

Troubleshooting

Build the protocol package first:
Make sure Odoo is running and credentials in .env are correct. In dev mode, ensure HUB_DEV_AUTH=true is set.
  1. Is the hub running? curl http://localhost:8766/health
  2. Is nu_hub_enabled set to true?
  3. Check browser DevTools Network tab for WS connections
  4. Look for connection errors in the browser console
  1. Is Odoo reachable? curl http://localhost:8069/web/login
  2. Check hub logs for forwarding errors
  3. Ensure ODOO_USER/ODOO_PASSWORD has POS access
The hub didn’t respond to LEASE_ACQUIRE within 10 seconds. Usually means the hub is overloaded or the message was lost. Check hub logs.

Environment variable reference