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-geminiTIP
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.
| Storage | Implementation | Path |
|---|---|---|
| KV | JSON files | ./data/kv/ |
| Vector | LanceDB | ./data/vectors/ |
| Graph | SQLite | ./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'),
});| Storage | Implementation | Path |
|---|---|---|
| KV | JSON files | ./data/kv/ |
| Vector | SQLite + sqlite-vec | ./data/vectors.db |
| Graph | SQLite | ./data/graph.db |
When to use which?
createLocalStorage— large datasets (100k+ vectors), best KNN performancecreateSQLiteStorage— 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 statsGit-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 databaseWith 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