npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zenbase

v2.1.7

Published

GunDB storage adapter for Sia SkynetDB

Downloads

45

Readme

Zenbase 🎍

Welcome to Zenbase, the all encompassing database. It's a secure home for your data that lives in the cloud.

About Zenbase

Zenbase is:

  • Decentralized, peer to peer
  • Fault tolerant
  • Offline first
  • Private
  • Realtime
  • Cross platform. It runs on browsers, and mobile devices. (Servers coming soon!)
  • Auth ready. Decentralized authentication is built in
  • Graph database
  • Persistent
  • Easy to use

HOW???

That was a long list of super awesome features. Basically, Zenbase combines two awesome technologies: GunDB and Sia SkynetDB. GunDB is a Graph database based on WebRTC. Sia SkynetDB is a decentralized Key/Value pair database on a decentralized storage layer.

GunDB offers a flexible database, but lacks decentralized persistence. Centralized relays like S3 or a server are used to persist your data when WebRTC fails.

Sia SkynetDB has decentralized persistence, but lacks most of the features you'd probably want in a database (like relationships and queries).

Zenbase bridges these with a storage adapter for GunDB that persists data to Skynet.

Why Should I Care

  1. It's free / cheaper than you're currently paying for your database. As of November 2020, Sia SkynetDB storage is free. It's unclear when/if that will change but you can expect that it will be cheap if payment is required. Storage on the Sia network currently costs:
  • 3.02 dollars a month per terabyte for storage
  • 0.62 dollars a terabyte for upload bandwidth
  • 1.06 dollars a terabyte for download bandwidth

Source

Even assuming higher storage costs for higher duplication / better web availability, you're looking at cents for a 10gb database. Should payment be required, we intend to host a payment gateway to allow you to pay for your Zenbase easily with your credit card

  1. It's always available. Even the biggest centralized services like AWS have down time. There is good reason to expect that Zenbase won't. Peer devices will each serve as their own database server making your service more available the more people use it. Even if there are no peers, Sia SkynetDB will always be available. There is another 10-30 redundancy on Skynet data, ensuring your data is always close by

  2. It's cross platform. You don't need a server to run it so that's one less thing to set up and one less thing to pay for.

  3. It's realtime and fault tolerant. Need I say more? Pinging your database for updates sucks

  4. It's open source! 😁

Getting Started (v2.1.x)

Version 2.1.x removes Skynetjs from being bundled with Zenbase. Skynet is providing their own client side bundle. You now need to import both Gun and Skynet before Zenbase. I've also tested it and it works with NodeJS as well

The Interactive tutorial has been updated: https://starboard.gg/nb/nl2QbJ2

<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/radix.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/radisk.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/store.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/rindexed.js"></script>
<script src="https://skynet-js.hns.siasky.net/4.0-beta/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/zenbase/src/index.js"></script>
<script>
let hello_world = ""

// Initialize gun.
// [localStorage] We are turning localStorage to false for testing purposes. Generally, you'd want that to be true
// [secret] Secret should be something long and secure. Your data will be saved to Skynet using that secret
// [portal] Skynet portal you'd like to use. Use a portal you trust or run your own. They could potentially manipulate your data (although I don't see why) 
// [debug] Show debug output
// [until] Change the batch time of Gun so that it doesn't attempt to write to storage too quickly
window.gun = new Gun({
    localStorage: false,
    secret: "YOUR_SECRET_HERE",
    portal: "https://siasky.net",
    debug: false,
    until: 2*1000
})

// Put data into gun. This will store in memory, then localStorage (disabled), then Skynet
gun.get('hello').put({ name: "world" });
// Get data into gun. This will pull from memory, then localStorage (disabled), then Skynet
gun.get('hello').on(data => { 
  hello_world = data['name']
	alert("hello: " + hello_world)
})
</script>
</head>
<body>
</body>
</html>

Getting Started (Old)

Interactive tutorial here: https://starboard.gg/nb/nl2QbJ2

<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/radix.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/radisk.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/store.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/rindexed.js"></script>
<script src="https://unpkg.com/zenbase/dist/main.js"></script>
<script>
let hello_world = ""

// Initialize gun.
// [localStorage] We are turning localStorage to false for testing purposes. Generally, you'd want that to be true
// [secret] Secret should be something long and secure. Your data will be saved to Skynet using that secret
// [portal] Skynet portal you'd like to use. Use a portal you trust or run your own. They could potentially manipulate your data (although I don't see why) 
// [debug] Show debug output
// [until] Change the batch time of Gun so that it doesn't attempt to write to storage too quickly
window.gun = new Gun({
    localStorage: false,
    secret: "YOUR_SECRET_HERE",
    portal: "https://siasky.net",
    debug: false,
    until: 2*1000
})

// Put data into gun. This will store in memory, then localStorage (disabled), then Skynet
gun.get('hello').put({ name: "world" });
// Get data into gun. This will pull from memory, then localStorage (disabled), then Skynet
gun.get('hello').on(data => { 
  hello_world = data['name']
	alert("hello: " + hello_world)
})
</script>
</head>
<body>
</body>
</html>

Donators (In order of contribution)

🏆 aaronfye
🥈 griffgreen
🥉 bit-7
🎖 julietea
🎖 slayerizedkoala
🎖 prometheusminer
🎖 caipeng2006
🎖 yaobr
🎖 traviagio
🎖 luxebeng

... and more

Credits

  • GunDB
  • Sia SkynetDB

More about the project

https://www.indiehackers.com/product/zenbase