Reference

Data Layout

Firestore path layout used by the core client.

FirestoreCoreClient uses a consistent tenant-first path structure:

tenants/{tenantId}
tenants/{tenantId}/locations/{locationId}
tenants/{tenantId}/staff/{uid}
tenants/{tenantId}/products/{productId}
tenants/{tenantId}/locations/{locationId}/orders/{orderId}
tenants/{tenantId}/locations/{locationId}/orders/{orderId}/events/{eventId}
tenants/{tenantId}/locations/{locationId}/businessDays/{dateKey}
tenants/{tenantId}/locations/{locationId}/dailySummaries/{dateKey}

Date keys

For businessDays and dailySummaries, use a stable date key format such as YYYY-MM-DD:

await client.openBusinessDay("2026-02-24")
await client.setDailySummary("2026-02-24", {
  ordersCount: 10,
  revenue: 120,
  topItems: [{ productId: "latte", qty: 3, revenue: 30 }],
  channelMix: { pos: 8, delivery: 2 },
})

Querying orders

const orders = await client.listOrders(undefined, {
  where: [{ fieldPath: "status", op: "==", value: "new" }],
  orderBy: [{ fieldPath: "createdAt", direction: "desc" }],
  limit: 50,
})

Live subscriptions

const unsubscribe = client.subscribeOrders((docs) => {
  console.log("Order count:", docs.length)
})

// later
unsubscribe()
Copyright © 2026