# rip-db-js

> RipDB is a dead simple, snappy, decentralized JSON store perfect for fast moving web3 builders. It comes with a javascript client that feels like using localstorage, but has decentralization and encryption baked in.

Latest version **1.0.1** (published 2022-07-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install rip-db-js
pnpm add rip-db-js
yarn add rip-db-js
bun add rip-db-js
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-07-26 |
| First published | 2022-07-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 1006.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | zacdenham |

## Links

- npm: https://www.npmjs.com/package/rip-db-js
- npm.io page: https://npm.io/package/rip-db-js

## Dependencies (10)

- [redis](https://npm.io/package/redis.md) ^4.2.0
- [ts-node](https://npm.io/package/ts-node.md) ^10.9.1
- [typescript](https://npm.io/package/typescript.md) ^4.7.4
- [@types/cors](https://npm.io/package/@types/cors.md) ^2.8.12
- [async-retry](https://npm.io/package/async-retry.md) ^1.3.3
- [cross-fetch](https://npm.io/package/cross-fetch.md) ^3.1.5
- [nft.storage](https://npm.io/package/nft.storage.md) ^6.4.1
- [@types/dotenv](https://npm.io/package/@types/dotenv.md) ^8.2.0
- [@types/express](https://npm.io/package/@types/express.md) ^4.17.13
- [@types/async-retry](https://npm.io/package/@types/async-retry.md) ^1.4.4

## Recent versions

- 1.0.1 (latest) — 2022-07-26
- 1.0.0 — 2022-07-26

## README

# RipDB (Redis + IPfs = RIP)

RipDB is a dead simple, snappy, decentralized JSON store perfect for fast moving web3 builders. It comes with a javascript client that feels like using localstorage, but has decentralization and encryption baked in.

![img](https://i.imgur.com/8KVnLX3.png)

## Demo

https://zdenham.github.io/redis-ipfs/

## Motivation

The SQL database is a powerful tool unrivaled for storing and querying relational data.

BUT, I believe most Dapps can live without a traditional SQL database in favor of something more light weight and decentralized.

Here are some problems with setting up a db for your dapp

1. There are already many great services which index blockchain data (why reinvent the wheel?)
2. DBs are expensive to host
3. Migrations are often a pain
4. They tend to be centralized / treasure trove for attackers
5. They usually don't give users provenance over their data
6. Encryption / key management is a pain

If a traditional db seems overkill for your use case, RIP might be for you. It gives you the speed of in memory cache (redis) but the decentralization of a global netowrk (Filecoin + IPFS), with some ther goodies like encryption.

### Example use case

In my own project (https://juicelabs.io), I needed some sort of store for a list of allowlist addresses (to calculate merkle proofs). Database seemed like a lot. I wanted something closer to an in memory store like Redis, but I wanted better redundancy / cold storage, and thus the idea for RIP came to be.

## Usage from browser js client

```javascript
// Setting up client
import { RipClient } from './RipClient'
const ripServerUrl = '';

const rip = new RipClient({ ripServerUrl });

...

const myJson = { hello: 'RIP world' };
await rip.set('myJsonKey', myJson, { encrypt: false });

...

const { data } = await rip.get('myJsonKey');

...

// reclaims memory, but preserves data on IPFS
await rip.purge('myJsonKey');


```

☠️ simple or what?

## Running your own RipDb Instance

You will need to set up a redis instance first.

The fastest way to do this on your local is via homebrew.

```
> brew install redis
> brew services start redis
```

Under your environment variables you will need to set IPFS

## TODO

- [ ] Expose RIP client and Rip server as node_modules
- [ ] Implement other Redis operations e.g. scan on the front end client
- [ ] Maybe, build key -> data models in typescript, get graphql style automatic runtime validation during set based on the typescript models
      COOL: https://github.com/gcanti/io-ts
- [ ] Get fancier with user owned access control features

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