{"repo":"ehacke/simple-cached-firestore","free":true,"listed":false,"github":"https://github.com/ehacke/simple-cached-firestore","clone":"git clone https://github.com/ehacke/simple-cached-firestore.git","description":"Firestore wrapper with simplified API and optional caching built in","language":"TypeScript","stars":31,"topics":["firebase","firestore","redis","cache"],"license":"MIT","category":"databases-storage","readme_excerpt":"simple-cached-firestore NodeJS Firestore wrapper with simplified API, model validation, and optional caching built in. Features - transparent, no-effort redis caching to improve speed and limit costs - model validation (optional, suggest using validated-base) - simplified API to reduce boilerplate, but retain access to original API for special cases Install Usage Before instantiating the Firestore wrapper, we first need a model it'll use for CRUD operations. Here is a blog post on validated models in Node, and why they are useful. Create a Model At minimum, the model has to fulfill the following interface: That said, it's easiest to just extend validated-base and use that. Create simple-cached-firestore A single instance is responsible for reading and writing to a specific Firestore collection. Reads are cached for the configured TTL, writes update the cache. CRUD API create(instance: T): Promise\\ Write a new model to the db. If an entry exists with the same ID, the write fails. get(id: string): Promise Read a model from the db by ID. Returns a constructed instance of the model, or null. getOrThrow(id: string): Promise\\ Read a model from the db by ID. Returns a constructed instance of the model, or throws an Error if not found. Useful for cases where you know the ID should exist, and dow't want to add null checks to make Typescript happy. patch(id: string, patch: DeepPartial ): Promise Pass in any subset of the properties of the model already in the db to update just those pr","default_branch":null,"files":null,"tree":[],"storefront":"/r/ehacke","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ehacke/simple-cached-firestore/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}