@emage-me/firestorm
v0.15.1
Published
Firestore ORM
Maintainers
Readme
FireODM
The best way for build object oriented code backend with Firestore
FireODM is an Typescript ODM for Google Firestore database, it use the activeRecord patern It was only working with firebase-admin for backend
Data structure : Collection | SubCollection | SubObject
Main features
- Use Objects
- Full Typescript
- In memory mockup for easy testing
Example
Find a document ID
const user = await User.find('42')Create a new document
const user = new User({ firstName: 'Jack'})
await user.save()Make a query
await User.query()
.where('lastName','==','jack')
.orderBy('age','asc')
.limit(2)
.get()Define a collection
class User extends Collection {
static collectionName: string = 'user'
@field('') firstName: string
@field('') lastName: string
}Use in memory mockup
// no firebase emulator needed
process.env.FIRESTORM_MOCKED = 'true'
// clear all in memory data
firestorm.data = {}