Getting Started

Introduction

What @frappes/firebase provides and when to use it.

@frappes/firebase is a TypeScript library for domain-oriented Firestore operations. It is designed around multi-tenant, multi-location ordering workflows.

What it includes

  • A typed FirestoreCoreClient with methods for tenants, staff, products, orders, and business-day lifecycle.
  • A small interface (FirestorePort) so you can plug your own Firestore adapter.
  • Order transition helper canTransitionOrderStatus(from, to) for pre-validation in UI/workflows.

What it does not include

  • It does not initialize Firebase for you.
  • It does not ship an app-specific auth model.
  • It does not force a single runtime (Node/browser); your adapter controls actual Firestore calls.

How it is structured

  1. You implement FirestorePort (or reuse one in your project).
  2. You create a FirestoreCoreClient with tenantId, optional locationId, and optional actor.
  3. You call typed methods (createOrder, updateOrderStatus, openBusinessDay, etc.).
If you need operation-level idempotency, pass idempotencyKey when creating orders or appending events.
Copyright © 2026