RxStorage
RxDB is not a self contained database. Instead the data is stored in an implementation of the RxStorage interface. This allows you to switch out the underlying data layer, depending on the JavaScript environment and performance requirements. For example you can use the SQLite storage for a capacitor app or you can use the LocalStorage RxStorage to store data in localstorage in a browser based application. There are also storages for other JavaScript runtimes like Node.js, React-Native, NativeScript and more.
Quick Recommendations
- In the Browser: Use the LocalStorage storage for simple setup and small build size. For bigger datasets, use either the dexie.js storage (free) or the IndexedDB RxStorage if you have 👑 premium access which is a bit faster and has a smaller build size.
- In Electron and ReactNative: Use the SQLite RxStorage if you have 👑 premium access or the trial-SQLite RxStorage for tryouts.
- In Capacitor: Use the SQLite RxStorage if you have 👑 premium access, otherwise use the localStorage storage.
Configuration Examples
The RxStorage layer of RxDB is very flexible. Here are some examples on how to configure more complex settings:
Storing much data in a browser securely
Lets say you build a browser app that needs to store a big amount of data as secure as possible. Here we can use a combination of the storages (encryption, IndexedDB, compression, schema-checks) that increase security and reduce the stored data size.
We use the schema-validation on the top level to ensure schema-errors are clearly readable and do not contain