alaindb
v1.1.1
Published
alaindb - The SQLite-Mongoose ODM
Maintainers
Readme
AlainDB
A lightweight, Mongoose-like library for SQLite.
📦 Installation
npm install alaindb🚀 Quick Start
1. Define your Schema
const db = require("alaindb")
const userSchema = new db.Schema({
name: String,
pass: String,
tags: [String]
})2. Initialize Model
const User = db.model("users", userSchema)3. Create a Record
const user = await User.create({ name: "Alain", pass: "123", tags: ["admin"] })4. Find and Access Data
const found = await User.findOne({ name: "Alain" })
console.log(found.name) // "Alain"
console.log(found.pass) // "123"5. Update and Save
found.pass = "456"
await found.save()6. Delete a Record
await User.deleteOne({ name: "Alain" })🖥️ Dashboard
To start the built-in management dashboard, use the following code:
db.dashboard({
port: 3000,
password: "your-password"
})