-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add firebase example with persistence adapter
resolves #391
- Loading branch information
Showing
39 changed files
with
2,126 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
head: | ||
- - link | ||
- rel: canonical | ||
href: https://signaldb.js.org/data-persistence/firebase/ | ||
--- | ||
# Firebase Persistence Adapter | ||
|
||
In the realm of modern data-driven applications, maintaining data persistence and consistency is crucial. SignalDB, known for its efficiency as an in-memory database, faces the challenge of data loss during events like page reloads. This is where the integration of persistence adapters becomes vital, particularly for services like Firebase. Firebase, a comprehensive app development platform, offers robust features that can significantly enhance SignalDB's functionality. Implementing a Firebase persistence adapter not only secures data persistence in SignalDB but also enables seamless integration with Firebase's extensive suite of features. | ||
|
||
Exploring the role of persistence adapters within SignalDB, their primary function is to act as a bridge between SignalDB and various storage solutions, including Firebase's Firestore, Realtime Database, or cloud storage. These adapters are designed to translate high-level data operations, typical in applications, into the low-level operations compatible with Firebase's storage systems. The integration of a Firebase persistence adapter allows developers to leverage Firebase's advanced capabilities, such as real-time data synchronization, authentication, and cloud storage. This means using the adapter to store data within Firebase's ecosystem, ensuring it is securely managed and easily accessible. | ||
|
||
The key advantage of employing a Firebase persistence adapter lies in the flexibility and abstraction it offers. It enables SignalDB to effectively interface with Firebase's powerful storage and synchronization mechanisms, ensuring data continuity, even through application reloads or prolonged user sessions. Furthermore, by decoupling SignalDB from its storage mechanism via the adapter, transitioning to different storage systems or making updates becomes a smoother process, requiring minimal code changes. Essentially, a Firebase persistence adapter serves as a conduit, linking SignalDB's in-memory processes with Firebase's robust, persistent data storage capabilities. | ||
|
||
For a practical demonstration, our [Firebase Example](https://github.com/maxnowack/signaldb/tree/main/examples/firebase) showcases a prototype implementation of a persistence adapter for Firebase. While not fully optimized, it's functional. You can find the helper function to create a Firebase persistence adapter for a SignalCollection here: [`createFirebasePersistenceAdapter`](https://github.com/maxnowack/signaldb/blob/main/examples/firebase/src/utils/createFirebasePersistenceAdapter.ts) and its usage [here](https://github.com/maxnowack/signaldb/blob/main/examples/firebase/src/system/setupCollection/persistence.ts). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
*-debug.log | ||
.firebaserc | ||
firebase.json | ||
database.rules.json |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
basePath: '/examples/firebase', | ||
output: 'export', | ||
eslint: { | ||
ignoreDuringBuilds: true, | ||
}, | ||
typescript: { | ||
ignoreBuildErrors: true, | ||
}, | ||
} | ||
|
||
module.exports = nextConfig |
Oops, something went wrong.