Skip to content

An in memory TypeScript/JS clone of Firebase & Firestore (useful for testing)

License

Notifications You must be signed in to change notification settings

fiery-data/fiery-firebase-memory

Repository files navigation

Fiery Firebase Memory

This is a clone of Firebase Realtime Database & Firestore in TypeScript/JS which stores the data in memory.

!!! At the moment, only the Firestore code is "fully" developed !!!

Installation

npm install fiery-firebase-memory

Example with default app (just like normal firebase)

import firebase from 'fiery-firebase-memory'

firebase.initializeApp({
  // config for default app - doesn't mean anything for this library
});

var fs = firebase.firestore();

// fs.app is available

fs.doc('path/to/doc')
  .set({ values: 'many', created_at: new Date() });

fs.collection('path/to')
  .where('values', '==', 'many')
  .orderBy('created_at')
  .onSnapshot(querySnapshot => {
    // realtime changes on the results of the query
  })
;

Example with named app

var app = firebase.initializeApp({ /* config */ }, 'namedApp');
var fs = firebase.firestore('namedApp');

Where can I access the stored data?

  • firestoreInstance._docs: an object of documents where the key is their full path
  • firestoreInstance._collections: an object of collections (array of document ids) where the key is their full path

Currently Unsupported Functionality

  • firebase#database
  • firebase.app.App#auth
  • firebase.app.App#database
  • firebase.app.App#delete
  • firebase.app.App#messaging
  • firebase.app.App#storage
  • firebase.firestore.Firestore#disableNetwork
  • firebase.firestore.Firestore#enableNetwork
  • firebase.firestore.Firestore#enablePersistence
  • firebase.firestore.Firestore#setLogLevel
  • firebase.firestore.FieldPath
  • firebase.firestore.Transaction
  • firebase.firestore.WriteBatch

About

An in memory TypeScript/JS clone of Firebase & Firestore (useful for testing)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published