JSPM

@flowrag/storage-sqlite

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q74416F
  • License MIT

πŸ•ΈοΈ Graph storage implementation based on SQLite. Stores the knowledge graph (entities and relations) and provides traversal algorithms like BFS/DFS, path finding between entities, and queries to find connected entities. SQLite is embedded, fast, and the .db file is easily versionable.

Package Exports

  • @flowrag/storage-sqlite
  • @flowrag/storage-sqlite/package.json

Readme

@flowrag/storage-sqlite

Graph and vector storage implementation using SQLite. Embedded, fast, versionable.

Installation

npm install @flowrag/storage-sqlite

Graph Storage

import { SQLiteGraphStorage } from '@flowrag/storage-sqlite';

const graph = new SQLiteGraphStorage({ path: './data/graph.db' });

await graph.addEntity({ id: 'auth', name: 'Auth Service', type: 'SERVICE', description: '...', sourceChunkIds: [] });
await graph.addRelation({ id: 'r1', sourceId: 'auth', targetId: 'postgres', type: 'USES', description: '...', keywords: ['db'], sourceChunkIds: [] });

const entity = await graph.getEntity('auth');
const relations = await graph.getRelations('auth', 'out');
const path = await graph.findPath('auth', 'dashboard');
const neighbors = await graph.traverse('auth', 2);

Vector Storage

Lightweight vector search via sqlite-vec β€” a pure-C SQLite extension with KNN support.

import { SQLiteVectorStorage } from '@flowrag/storage-sqlite';

const vector = new SQLiteVectorStorage({
  path: './data/vectors.db',
  dimensions: 384, // must match your embedder
});

await vector.upsert([{ id: 'chunk-1', vector: [0.1, 0.2, ...], metadata: { _kind: 'chunk' } }]);
const results = await vector.search([0.1, 0.2, ...], 10, { _kind: 'chunk' });

This is a lightweight alternative to @flowrag/storage-lancedb β€” smaller native binaries (~2MB vs ~50MB), single .db file.

License

MIT