@emage-me/firestorm
TypeScript icon, indicating that this package has built-in type declarations

0.14.1 • Public • Published

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

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 = {}

Readme

Keywords

Package Sidebar

Install

npm i @emage-me/firestorm

Weekly Downloads

56

Version

0.14.1

License

ISC

Unpacked Size

109 kB

Total Files

42

Last publish

Collaborators

  • thibaud_granier