Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 928 Bytes

File metadata and controls

41 lines (28 loc) · 928 Bytes

Getting Started with SencilloDB

Installation

Install SencilloDB using npm:

npm install sencillodb

SencilloDB is written in TypeScript and includes type definitions out of the box.

Basic Usage

Import SencilloDB and create an instance. By default, it will save data to sencillo.json in the current directory.

import { SencilloDB } from "sencillodb";

// Initialize the database
const db = new SencilloDB({ file: "./my-database.json" });

// Perform a transaction
const result = await db.transaction((tx) => {
  // Create a new document
  const newUser = tx.create({
    data: { name: "Alice", age: 30 },
    collection: "users",
  });
  
  return newUser;
});

console.log(result);

Next Steps