For AI agents: the complete documentation index is available at https://silt-db.dev/llms.txt, the full documentation bundle is available at https://silt-db.dev/llms-full.txt, and this page is available as Markdown at https://silt-db.dev/guide/quick-start.md.

Quick start

Open a SQLite file with MongoClient, write a document, and query it through the MongoDB-compatible API. This example runs on Node.js 24 or newer using built-in SQLite.

Run from source

Silt is preparing its first release; its packages are currently local npm workspaces.

git clone https://github.com/startupjs/silt-db.git
cd silt-db
npm ci
node examples/docs-quick-start.mjs

Repository access is required while the repository is private. The example creates silt-guide.sqlite in your current directory. Run it again to check that the same file can be reused, or pass another filename:

node examples/docs-quick-start.mjs ./another-demo.sqlite

Open a database

import { MongoClient } from '@silt-db/mongodb';

const client = new MongoClient('./app.sqlite', { dbName: 'app' });
await client.connect();

try {
  const notes = client.db().collection('notes');
  await notes.updateOne(
    { _id: 'welcome' },
    { $set: { text: 'Saved in SQLite', archived: false } },
    { upsert: true },
  );

  console.log(await notes.find({ archived: false }).toArray());
} finally {
  await client.close();
}

The collection calls use the familiar MongoDB API. Writes and cursor consumption return promises. client.db() returns the database handle immediately, and client.close() releases the owned connection.

One file is one database. Here, client.db() and client.db('app') are the same handle. A different database name is rejected; open another file for another database.

Verify persistence

The runnable example resets one demo document, queries it, updates it, and closes the client. A new client opening the same file reads the saved change:

const reopened = new MongoClient('./app.sqlite', { dbName: 'app' });
try {
  console.log(await reopened.db().collection('notes').findOne({ _id: 'welcome' }));
} finally {
  await reopened.close();
}

Calling connect() explicitly is optional: the first database operation opens the connection if needed.

Choose your next step

Use the official MongoDB docs for ordinary collection operations, and Silt's compatibility reference for supported methods and limitations.