0.0.7-alpha • Published 10 months ago
@yuga-cb/ezdb v0.0.7-alpha
EZDB
EZDB is a simple, flexible database abstraction layer that supports multiple storage backends. It is most useful for code that is intended to be deployed across multiple hosting environments (e.g. Replit, Vercel, etc.) without modification.
Installation
npm install @yuga-cb/ezdb
Configuration
EZDB uses an environment variable EZDB_TYPE
to determine which storage backend to use. Valid options are:
LOCAL
(default): Uses PouchDB for local storageREPLIT
: Uses Replit's key-value storeVERCEL
: Uses Vercel KV storage
Set the EZDB_TYPE
environment variable before running your application:
EZDB_TYPE=REPLIT
Optional environment variables:
When EZDB_TYPE=LOCAL
:
POUCHDB_NAME
: The name of the PouchDB database (default:ezdb
)
Usage
javascript
import createDB from 'ezdb';
const db = createDB();
// Set a value
await db.set('key', 'value');
// Get a value
const value = await db.get('key');
console.log(value); // 'value'
0.0.7-alpha
10 months ago
0.0.6-alpha
10 months ago
0.0.5-alpha
10 months ago
0.0.4-alpha
10 months ago
0.0.3-alpha
10 months ago
0.0.2-alpha
11 months ago
0.0.1-alpha
11 months ago