JSPM

@triyatna/aingdb

0.0.19
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q37892F
  • License MIT

AingDB — Lightweight, Intelligent, and Future-ready Embedded Database.

Package Exports

  • @triyatna/aingdb
  • @triyatna/aingdb/cli
  • @triyatna/aingdb/features

Readme

AingDB

AingDB is a modern embedded database. Small, fast, encrypted, and intelligent.

Install

npm i @triyatna/aingdb

Quick Start

import { AingDB } from "@triyatna/aingdb";

const db = await AingDB.open({
  path: "./app.msdb",
  encryption: {
    enabled: true,
    algorithm: "aes-256-gcm",
    kdf: "scrypt",
    passphrase: "secret",
  },
});

await db.schema.create({
  name: "users",
  columns: [
    { name: "id", type: "uuid", primary: true },
    { name: "email", type: "string", unique: true },
    { name: "name", type: "text" },
  ],
});

await db.table("users").insert({ id: "u1", email: "a@b.com", name: "Ana" });
const rows = await db.table("users").find({ email: "a@b.com" });

await db.close();

Feature Highlights

  • Encrypted single-file WAL + immutable audit trail
  • SQL: SELECT + WITH CTE, INNER/LEFT JOIN, WHERE, GROUP BY + agregat, Window (ROW_NUMBER, RANK, DENSE_RANK, LAG/LEAD), ORDER BY, LIMIT, RETURNING
  • Optimizer: cost-based (ringan) dengan ANALYZE stats, predicate pushdown, IndexScan vs SeqScan, nested-loop join index-aware
  • Indexes: multi-kolom, partial (predicate), expression (mis. LOWER(email)), Index Advisor
  • Vector: HNSW multi-level (cosine/L2), efSearch dinamis, persistensi graf
  • Search: FTS-lite (MATCH()), RTREE-lite (INTERSECTS())
  • Observability: /metrics (Prometheus), /healthz

CLI

# bantuan
npx aingdb help

# jalankan SQL
npx aingdb sql --path ./app.msdb -e "SELECT * FROM users LIMIT 10"

# EXPLAIN/ANALYZE
npx aingdb explain --path ./app.msdb -e "SELECT u.id FROM users u LEFT JOIN orders o ON u.id=o.userId"

# ANALYZE & saran indeks
npx aingdb analyze --path ./app.msdb
npx aingdb advise-index --table users --workload '[{"whereCols":["email"],"joinOn":["id"]}]'

# buat index (multi-col/expression/partial)
npx aingdb create-index --path ./app.msdb --name users_email_idx --table users --columns "email"
npx aingdb create-index --path ./app.msdb --name users_email_lower_act --table users --expr "LOWER(email)" --partial "status == 'active'"

Change Log

  • v0.0.19 Fix Bug
  • v0.0.17 Add SQL in CLI
  • v0.0.15 Release

Lisensi: MIT · © Tri Yatna