Skip to content

Local Development

The simplest way to use FlowRAG — everything runs locally, data files are Git-friendly.

Setup

bash
npm install @flowrag/pipeline @flowrag/presets @flowrag/provider-gemini

TIP

You need a Gemini API key for entity extraction. Get one at ai.google.dev.

Usage

typescript
import { defineSchema } from '@flowrag/core';
import { createFlowRAG } from '@flowrag/pipeline';
import { createLocalStorage } from '@flowrag/presets';

const schema = defineSchema({
  entityTypes: ['SERVICE', 'DATABASE', 'PROTOCOL'],
  relationTypes: ['USES', 'PRODUCES', 'CONSUMES'],
});

const rag = createFlowRAG({
  schema,
  ...createLocalStorage('./data'),
});

// Index
await rag.index('./content');

// Search
const results = await rag.search('how does authentication work');

Storage Presets

FlowRAG offers two local presets:

createLocalStorage() (LanceDB)

The default preset. Uses LanceDB for vector search — optimized for large datasets.

StorageImplementationPath
KVJSON files./data/kv/
VectorLanceDB./data/vectors/
GraphSQLite./data/graph.db

createSQLiteStorage() (Lightweight)

Uses sqlite-vec for vector search — smaller native binaries (~2MB vs ~50MB).

typescript
import { createSQLiteStorage } from '@flowrag/presets';

const rag = createFlowRAG({
  schema,
  ...createSQLiteStorage('./data'),
});
StorageImplementationPath
KVJSON files./data/kv/
VectorSQLite + sqlite-vec./data/vectors.db
GraphSQLite./data/graph.db

When to use which?

  • createLocalStorage — large datasets (100k+ vectors), best KNN performance
  • createSQLiteStorage — smaller projects, minimal dependencies, single-file vector storage

CLI

For quick local usage without writing code:

bash
# Install globally
npm install -g @flowrag/cli

# Initialize
flowrag init

# Index documents
flowrag index ./content
flowrag index ./content --force          # Re-index all
flowrag index ./content --interactive    # Review entities

# Search
flowrag search "how does OCPP work"

# Stats
flowrag stats
flowrag graph stats

Git-Friendly

The ./data directory contains plain files:

  • JSON files for KV storage
  • SQLite databases for the knowledge graph and (optionally) vector embeddings
  • LanceDB files for vector embeddings (if using createLocalStorage)

You can commit these to your repo for a fully portable knowledge base.

Storage Layout

With createLocalStorage (LanceDB)

data/
├── kv/
│   ├── doc:readme.json
│   ├── chunk:readme:0.json
│   ├── extraction:a1b2c3.json    # LLM cache
│   └── docHash:doc:readme.json   # Incremental indexing
├── vectors/
│   └── chunks.lance/             # LanceDB table
└── graph.db                      # SQLite database

With createSQLiteStorage (sqlite-vec)

data/
├── kv/
│   ├── doc:readme.json
│   ├── chunk:readme:0.json
│   ├── extraction:a1b2c3.json
│   └── docHash:doc:readme.json
├── vectors.db                    # SQLite + sqlite-vec
└── graph.db                      # SQLite database

Released under the MIT License.