Universal Foundations
Cross-domain primitives — eventLog, counter, queue, lifecycle, pagination, health, snapshot — one API for apps, chat, games, AI, and jobs.
Server-blind by architecture. Local-first. AI-native. Private RAG, agent memory, and sealed vaults — encrypted end-to-end.
import { FlashClient } from "@moaaz-i/flash-db";
// 1. Initialize Client with Master Secret Key
const client = new FlashClient({
secretKey: "quantum_production_passphrase_2026",
storagePath: "./data",
});
const users = client.collection("users", {
schema: {
name: { type: "string", required: true, trim: true },
email: { type: "string", required: true, unique: true },
balance: { type: "number", default: 0 },
},
});
// 2. Insert Document (Encrypted on Client Side with AAD binding)
const { insertedId } = await users.insertOne({
name: "Ada Lovelace",
email: "ada@computing-pioneer.org",
role: "Mathematician",
balance: 45000,
status: "active",
});
// 3. Search Over Encrypted Blind Indexes (Server remains 100% blind)
const results = await users
.find({ email: "ada@computing-pioneer.org" })
.sort({ balance: -1 })
.limit(10);
console.log(results[0].name); // 'Ada Lovelace'
// 4. Natural Language Query (AI Engine)
const nlResults = await users.ask("show me users with balance over 30000", {
limit: 5,
});
// 5. Backup & Restore
await client.backup("/backups/flash-daily");