JSPM

  • Created
  • Published
  • Downloads 7917
  • Score
    100M100P100Q107408F
  • License MIT

JavaScript/TypeScript SDK for RedDB - unified multi-model database

Package Exports

  • reddb-cli

Readme

RedDB

The AI-first multi-model database.

Tables. Documents. Graphs. Vectors. KV. One engine. Ask it anything.

Release License npm


The Killer Feature: ASK

ASK 'who owns CPF 000.000.000-00 and what services do they use?'

One command. RedDB searches across tables, graphs, vectors, documents, and key-value stores -- builds context -- calls an LLM -- returns a natural-language answer. No pipelines. No glue code. No other database does this.


5 Data Models, 1 Engine

Stop running Postgres + Neo4j + Pinecone + Redis + Mongo. RedDB unifies them.

-- Relational rows
INSERT INTO users (name, email) VALUES ('Alice', 'alice@co.com')

-- JSON documents
INSERT INTO logs DOCUMENT (body) VALUES ('{"level":"info","msg":"login"}')

-- Graph edges
INSERT INTO network EDGE (label, from, to) VALUES ('CONNECTS', 1, 2)

-- Vector similarity search
SEARCH SIMILAR TEXT 'anomaly detected' COLLECTION events

-- Key-value
PUT config.theme = 'dark'

Same file. Same engine. Same query language.


AI-Native From Day One

-- Semantic search without managing vectors yourself
SEARCH SIMILAR TEXT 'suspicious login' COLLECTION logs USING groq

-- Auto-embed on insert -- vectors are created for you
INSERT INTO articles (title, body) VALUES ('AI Safety', 'Alignment research...')
  WITH AUTO EMBED (body) USING openai

-- Context search: find everything related to an entity across all models
SEARCH CONTEXT '192.168.1.1' FIELD ip DEPTH 2

-- Ask questions in plain English
ASK 'what vulnerabilities affect host 10.0.0.1?' USING anthropic

RedDB retrieves context from every data model, feeds it to the LLM, and gives you a grounded answer. RAG built into the database layer.


11 AI Providers

Swap providers with a keyword. No code changes.

Provider Keyword API Key Required
OpenAI openai Yes
Anthropic anthropic Yes
Groq groq Yes
OpenRouter openrouter Yes
Together together Yes
Venice venice Yes
DeepSeek deepseek Yes
HuggingFace huggingface Yes
Ollama ollama No (local)
Local local No
Custom URL https://... Configurable
ASK 'summarize alerts' USING groq MODEL 'llama-3.3-70b-versatile'
ASK 'summarize alerts' USING ollama MODEL 'llama3'
ASK 'summarize alerts' USING anthropic

SQL Extensions

RedDB extends SQL with WITH clauses for operational semantics:

-- TTL: auto-expire records
INSERT INTO sessions (token) VALUES ('abc') WITH TTL 1 h

-- Context indexes for cross-model search
CREATE TABLE customers (cpf TEXT) WITH CONTEXT INDEX ON (cpf)

-- Graph expansion inline with SELECT
SELECT * FROM users WITH EXPAND GRAPH DEPTH 2

-- Metadata on write
INSERT INTO logs (msg) VALUES ('deploy') WITH METADATA (source = 'ci')

-- Absolute expiration
INSERT INTO events (name) VALUES ('launch') WITH EXPIRES AT 1735689600000

6 Query Languages

Write in whatever you think in. The engine auto-detects the language.

Language Example
SQL SELECT * FROM hosts WHERE os = 'linux'
Cypher MATCH (a:User)-[:FOLLOWS]->(b) RETURN b.name
Gremlin g.V().hasLabel('person').out('FOLLOWS').values('name')
SPARQL SELECT ?name WHERE { ?p :name ?name }
Natural Language show me all critical hosts
ASK (RAG) ASK 'what changed in the last 24 hours?'

All six hit the same engine, same data, same indexes.


48 Built-in Types

Not just TEXT and INTEGER. RedDB understands your domain.

Network: IpAddr, Ipv4, Ipv6, MacAddr, Cidr, Subnet, Port Geo: Latitude, Longitude, GeoPoint Locale: Country2, Country3, Lang2, Lang5, Currency Identity: Uuid, Email, Url, Phone, Semver Visual: Color, ColorAlpha Cross-model refs: NodeRef, EdgeRef, VectorRef, RowRef, KeyRef, DocRef, TableRef, PageRef Primitives: Integer, UnsignedInteger, Float, Decimal, BigInt, Text, Blob, Boolean, Json, Array, Enum Temporal: Timestamp, TimestampMs, Date, Time, Duration

Validation on write. No parsing in your app.


3 Deployment Modes

Mode Think of it as... Access via
Embedded SQLite Rust API -- RedDB::open("data.rdb")
Server Postgres HTTP + gRPC -- dual-stack
Agent MCP tool red mcp -- AI agent integration

Same storage format across all three. Start embedded, scale to server, expose to agents -- no migration.


Quick Start

# Install
curl -fsSL https://raw.githubusercontent.com/forattini-dev/reddb/main/install.sh | bash

# Start the server
red server --http-bind 127.0.0.1:8080 --path ./data.rdb

# Insert data
curl -X POST http://127.0.0.1:8080/query \
  -H 'content-type: application/json' \
  -d '{"query":"INSERT INTO hosts (ip, os) VALUES ('\''10.0.0.1'\'', '\''linux'\'')"}'

# Query it
curl -X POST http://127.0.0.1:8080/query \
  -H 'content-type: application/json' \
  -d '{"query":"SELECT * FROM hosts"}'

Or via npm:

npx reddb-cli@latest server --http --bind 127.0.0.1:8080


MIT License -- Built by Filipe Forattini