sapphiredb
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

sapphiredb - JS client Build Status

SapphireDb logo

SapphireDb is a self-hosted, easy to use realtime database for Asp.Net Core and EF Core.

It creates a generic API you can easily use with different clients to effortlessly create applications with realtime data synchronization. SapphireDb should serve as a self hosted alternative to firebase realtime database and firestore on top of .Net.

Check out the documentation for more details: Documentation

Features

  • 🔧 Dead simple configuration
  • 📡 Broad technology support
  • 💻 Self hosted
  • 📱 Offline support
  • 💾 Easy to use CRUD operations
  • ⚡️ Model validation
  • ✔️ Database support
  • 📂 Supports joins/includes
  • ➿ Complex server evaluated queries
  • 🔌 Actions
  • 🔑 Authorization included
  • ✉️ Messaging
  • 🌐 Scalable

Learn more

Installation

Install Package

To use sapphiredb you have to install the package using npm

In your app folder execute

npm install sapphiredb rxjs axios -S

Create SapphireDb instance

var sapphiredb = require('sapphiredb');
 
var db = new sapphiredb.SapphireDb({
    serverBaseUrl: 'localhost:5000',
    useSsl: false,
    apiKey: 'webapp',
    apiSecret: 'pw1234'
});
 
db.collection('demo.entries').values().subscribe(function (values) {
    console.log(values);
});

Use websockets on NodeJs

sapphiredb also works in a NodeJs application. It will use polling as communication strategy by default. If you want to use websockets you have to install an external library for that.

Example
npm install ws -S
var sapphiredb = require('sapphiredb');
 
var ws = require('ws');
WebSocket = ws;
 
var db = new sapphiredb.SapphireDb({
    serverBaseUrl: 'localhost:5000',
    useSsl: false,
    apiKey: 'webapp',
    apiSecret: 'pw1234'
});
 
db.collection('demo.entries').values().subscribe(function (values) {
    console.log(values);
});

Compatibility

Browser/Engine Websocket SSE Polling
Chrome ✔️ ✔️ ✔️
Firefox ✔️ ✔️
Opera ✔️ ✔️
Edge ✔️ ✔️
Internet Explorer 11 ✔️ ✔️
NodeJs ✔️ ✔️

Technology support

JS, NodeJs, React, Svelte ...

Examples

React Example

Svelte Example

NodeJs Example

Documentation

Check out the documentation for more details: Documentation

Implementations/Packages

Server

SapphireDb - Server for Asp.Net Core

SapphireDb.RedisSync

SapphireDb.HttpSync

Client

sapphiredb - JS client (JS, NodeJs, React, Svelte, ...)

ng-sapphiredb - Angular client

Author

Morris Janatzek (morrisjdev)

Licenses

SapphireDb - MIT License

sapphiredb-js - MIT License

Package Sidebar

Install

npm i sapphiredb

Weekly Downloads

45

Version

3.0.0

License

MIT

Unpacked Size

1.79 MB

Total Files

248

Last publish

Collaborators

  • morrisjdev