# grapesjs-firestore-update

> GrapesJS Cloud Firestore Storage Wrapper with update function instead of set

Latest version **0.1.2** (published 2021-04-17) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install grapesjs-firestore-update
pnpm add grapesjs-firestore-update
yarn add grapesjs-firestore-update
bun add grapesjs-firestore-update
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2021-04-17 |
| First published | 2021-04-17 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 22.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 32 |
| Author | Artur Arseniev |
| Maintainers | paulusman |
| Keywords | grapesjs, plugin, storage, firebase, firestore |

## Links

- npm: https://www.npmjs.com/package/grapesjs-firestore-update
- Repository: https://github.com/artf/grapesjs-firestore
- Homepage: https://github.com/artf/grapesjs-firestore#readme
- Issues: https://github.com/artf/grapesjs-firestore/issues
- npm.io page: https://npm.io/package/grapesjs-firestore-update

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2021-04-17

## README

# GrapesJS Firestore

Fork of GrapesJS storage wrapper for [Cloud Firestore](https://firebase.google.com/docs/firestore), flexible, scalable NoSQL cloud database to store and sync data for client/server-side development.

Uses Firestore update method instead of set method for updating documents.



> Requires GrapesJS v0.14.15 or higher


## Summary

* Plugin name: `grapesjs-firestore-update`
* Storage
  * `firestore`





## Options

|Option|Description|Default|
|-|-|-
| `apiKey` | Firebase API key | `''` |
| `authDomain` | Firebase Auth domain | `''` |
| `projectId` | Cloud Firestore project ID | `''` |
| `docId` | Document id | `'gjs'` |
| `collectionName` | Collection name | `'templates'` |
| `enableOffline` | Enable support for offline data persistence | `true` |
| `settings` | Firestore database [settings](https://firebase.google.com/docs/reference/js/firebase.firestore.Settings) | `{ timestampsInSnapshots: true }` |





## Download

* NPM
  * `npm i grapesjs-firestore-update`





## Usage

Before start using this plugin you have to create and enable Cloud Firestore project in [Firebase Console](https://console.firebase.google.com). When you create a Firestore project, it also enables its API, which you can get from [Cloud API Manager](https://console.cloud.google.com/projectselector/apis/api/firestore.googleapis.com/overview).

```html
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="path/to/grapesjs-firestore-update.min.js"></script>

<script src="https://www.gstatic.com/firebasejs/4.13.0/firebase.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.13.0/firebase-firestore.js"></script>

<div id="gjs"></div>

<script type="text/javascript">
  var editor = grapesjs.init({
      container : '#gjs',
      ...
      storageManager: { type: 'firestore' },
      plugins: ['grapesjs-firestore'],
      pluginsOpts: {
        'grapesjs-firestore': {
          docId: 'someID',
          apiKey: '<API_KEY>',
          authDomain: '<PROJECT_ID>.firebaseapp.com',
          projectId: '<PROJECT_ID>',
        }
      }
  });
</script>
```

By default, Firebase allows everyone to read/write data inside your DB by knowing the API credentials, which is ok for the first setup and development but, obviously, not for production.
To get more about the Firestore security checkout [this guide](https://firebase.google.com/docs/firestore/security/overview).




## Development

Clone the repository

```sh
$ git clone https://github.com/PaulEvers/grapesjs-firestore
$ cd grapesjs-firestore-update
```

Install dependencies

```sh
$ npm i
```

The plugin relies on GrapesJS via `peerDependencies` so you have to install it manually (without adding it to package.json)

```sh
$ npm i grapesjs --no-save
```

Start the dev server

```sh
$ npm start
```





## License

BSD 3-Clause

---
_Source: https://npm.io/package/grapesjs-firestore-update · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
