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
FirestoreCoreClientwith 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
- You implement
FirestorePort(or reuse one in your project). - You create a
FirestoreCoreClientwithtenantId, optionallocationId, and optionalactor. - You call typed methods (
createOrder,updateOrderStatus,openBusinessDay, etc.).
If you need operation-level idempotency, pass
idempotencyKey when creating orders or appending events.