📄️ Installation & Setup
This guide shows you how to install FireODM in your Node.js project and configure firebase-admin so that FireODM can interface with Firestore.
📄️ Models & Decorators
FireODM uses TypeScript classes plus decorators to map your data types to Firestore documents. Every model:
📄️ Validation
FireODM integrates Zod under the hood to enforce schema rules at runtime. Every field decorator you use builds a Zod schema that validates data before it’s written to Firestore (during save(), update() or model instantiation).
📄️ CRUD API
FireODM provides simple, strongly-typed methods for basic data operations. You’ll find both static methods on your model classes and instance methods on your objects.
📄️ Relations & Populate
FireODM lets you link documents across collections with minimal setup. You define a relation on your model, and then load the related documents on demand with populate() or via query options.
📄️ Transactions and Batched Writes
You can perform atomic operations by using the ORM's save, update, and delete methods within an asynchronous context managed by helper functions runInTransaction and runInBatch. These helpers use Node.js AsyncLocalStorage internally, so you do not need to explicitly pass the transaction or batch object to the ORM methods when called inside the helper's callback.
📄️ Lifecycle Hooks
FireODM models support lifecycle callbacks (hooks) that run before or after various operations. Use these to:
📄️ Advanced Usage
Once you’ve mastered basic CRUD, decorators, relations and hooks, explore these advanced Firestore features with FireODM.