Install SencilloDB using npm:
npm install sencillodbSencilloDB is written in TypeScript and includes type definitions out of the box.
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);- Learn about Core Concepts
- Explore the API Reference
- Check out Advanced Usage for hooks and resource managers.