2025-08-25 09:52:32 -07:00
# Brainy
< p align = "center" >
< img src = "brainy.png" alt = "Brainy Logo" width = "200" >
< / p >
[](https://www.npmjs.com/package/brainy)
[](https://www.npmjs.com/package/brainy)
[](LICENSE)
[](https://www.typescriptlang.org/)
2025-08-26 12:03:45 -07:00
**🧠 Brainy 2.0 - Zero-Configuration AI Database with Triple Intelligence™**
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
The industry's first truly zero-configuration AI database that combines vector similarity, metadata filtering, and graph relationships with O(log n) performance. Production-ready with 3ms search latency, 220 pre-computed NLP patterns, and only 24MB memory footprint.
2025-08-26 12:03:45 -07:00
## 🎉 What's New in 2.0
- **Triple Intelligence™**: Unified Vector + Metadata + Graph queries in one API
2025-08-26 12:21:13 -07:00
- **API Consolidation**: 15+ methods → 2 clean APIs (`search()` and `find()` )
- **Natural Language**: Ask questions in plain English
- **Zero Configuration**: Works instantly, no setup required
- **O(log n) Performance**: Binary search on sorted indices
- **220+ NLP Patterns**: Pre-computed for instant understanding
- **Universal Compatibility**: Node.js, Browser, Edge, Workers
## ⚡ Quick Start
2025-08-25 09:52:32 -07:00
```bash
npm install brainy
```
2025-08-26 12:21:13 -07:00
```javascript
2025-08-25 09:52:32 -07:00
import { BrainyData } from 'brainy'
const brain = new BrainyData()
await brain.init()
2025-08-26 12:21:13 -07:00
// Add data with automatic embedding
await brain.addNoun("JavaScript is a programming language", {
type: "language",
year: 1995
2025-08-25 09:52:32 -07:00
})
2025-08-26 12:21:13 -07:00
// Natural language search
const results = await brain.find("programming languages from the 90s")
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
// Vector similarity with metadata filtering
const filtered = await brain.search("JavaScript", {
metadata: { type: "language" },
limit: 5
2025-08-25 09:52:32 -07:00
})
```
2025-08-26 12:21:13 -07:00
## 🚀 Key Features
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
### Triple Intelligence Engine
Combines three search paradigms in one unified API:
- **Vector Search**: Semantic similarity with HNSW indexing
- **Metadata Filtering**: O(log n) field lookups with binary search
- **Graph Relationships**: Navigate connected knowledge
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
### Natural Language Understanding
```javascript
// Ask questions naturally
await brain.find("Show me recent React components with tests")
await brain.find("Popular JavaScript libraries similar to Vue")
await brain.find("Documentation about authentication from last month")
2025-08-25 09:52:32 -07:00
```
2025-08-26 12:21:13 -07:00
### Zero Configuration Philosophy
- **No API keys required** - Built-in embedding models
- **No external dependencies** - Everything included
- **No complex setup** - Works instantly
- **Smart defaults** - Optimized out of the box
### Production Performance
- **3ms average search** - Lightning fast queries
- **24MB memory footprint** - Efficient resource usage
- **Worker-based embeddings** - Non-blocking operations
- **Automatic caching** - Intelligent result caching
## 📚 Core API
### `search()` - Vector Similarity
```javascript
const results = await brain.search("machine learning", {
limit: 10, // Number of results
metadata: { type: "article" }, // Filter by metadata
includeContent: true // Include full content
})
2025-08-25 09:52:32 -07:00
```
2025-08-26 12:21:13 -07:00
### `find()` - Natural Language Queries
```javascript
// Simple natural language
const results = await brain.find("recent important documents")
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
// Structured query with Triple Intelligence
const results = await brain.find({
like: "JavaScript", // Vector similarity
where: { // Metadata filters
year: { greaterThan: 2020 },
important: true
},
related: { to: "React" } // Graph relationships
})
2025-08-25 09:52:32 -07:00
```
2025-08-26 12:21:13 -07:00
### CRUD Operations
```javascript
// Create
const id = await brain.addNoun(data, metadata)
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
// Read
const item = await brain.getNoun(id)
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
// Update
await brain.updateNoun(id, newData, newMetadata)
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
// Delete
await brain.deleteNoun(id)
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
// Bulk operations
await brain.import(arrayOfData)
const exported = await brain.export({ format: 'json' })
2025-08-25 09:52:32 -07:00
```
2025-08-26 12:21:13 -07:00
## 🎯 Use Cases
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
### Knowledge Management
```javascript
// Store and search documentation
await brain.addNoun(documentContent, {
title: "API Guide",
category: "documentation",
version: "2.0"
2025-08-25 09:52:32 -07:00
})
2025-08-26 12:21:13 -07:00
const docs = await brain.find("API documentation for version 2")
2025-08-25 09:52:32 -07:00
```
2025-08-26 12:21:13 -07:00
### Semantic Search
```javascript
// Find similar content
const similar = await brain.search(existingContent, {
limit: 5,
threshold: 0.8
2025-08-25 09:52:32 -07:00
})
```
2025-08-26 12:21:13 -07:00
### AI Memory Layer
```javascript
// Store conversation context
await brain.addNoun(userMessage, {
userId: "123",
timestamp: Date.now(),
session: "abc"
2025-08-25 09:52:32 -07:00
})
2025-08-26 12:21:13 -07:00
// Retrieve relevant context
const context = await brain.find(`previous conversations with user 123` )
2025-08-25 09:52:32 -07:00
```
2025-08-26 12:21:13 -07:00
## 💾 Storage Options
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
Brainy supports multiple storage backends:
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
```javascript
// Memory (default for testing)
const brain = new BrainyData({
storage: { type: 'memory' }
2025-08-25 09:52:32 -07:00
})
2025-08-26 12:21:13 -07:00
// FileSystem (Node.js)
const brain = new BrainyData({
storage: {
2025-08-25 09:52:32 -07:00
type: 'filesystem',
path: './data'
2025-08-26 12:21:13 -07:00
}
})
// Browser Storage (OPFS)
const brain = new BrainyData({
storage: { type: 'opfs' }
})
// S3 Compatible (Production)
const brain = new BrainyData({
storage: {
type: 's3',
bucket: 'my-bucket',
region: 'us-east-1'
}
2025-08-25 09:52:32 -07:00
})
```
2025-08-26 12:21:13 -07:00
## 🛠️ CLI
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
Brainy includes a powerful CLI for testing and management:
2025-08-25 09:52:32 -07:00
```bash
2025-08-26 12:21:13 -07:00
# Install globally
npm install -g brainy
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
# Add data
brainy add "JavaScript is awesome" --metadata '{"type":"opinion"}'
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
# Search
brainy search "programming"
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
# Natural language find
brainy find "awesome programming languages"
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
# Interactive mode
2025-08-25 09:52:32 -07:00
brainy chat
2025-08-26 12:21:13 -07:00
# Export data
brainy export --format json > backup.json
2025-08-25 09:52:32 -07:00
```
2025-08-26 12:21:13 -07:00
## 🔌 Augmentations
Extend Brainy with powerful augmentations:
2025-08-25 09:52:32 -07:00
```bash
2025-08-26 12:21:13 -07:00
# List available augmentations
brainy augment list
# Install an augmentation
brainy augment install explorer
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
# Connect to Brain Cloud
brainy cloud setup
2025-08-25 09:52:32 -07:00
```
2025-08-26 12:21:13 -07:00
## 🏢 Enterprise Features - Included for Everyone
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
Brainy includes enterprise-grade capabilities at no extra cost. **No premium tiers, no paywalls.**
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
- **Scales to 10M+ items** with consistent 3ms search latency
- **Write-Ahead Logging (WAL)** for zero data loss durability
- **Distributed architecture** with sharding and replication
- **Read/write separation** for horizontal scaling
- **Connection pooling** and request deduplication
- **Built-in monitoring** with metrics and health checks
- **Production ready** with circuit breakers and backpressure
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
📖 ** [Read the full Enterprise Features guide → ](docs/ENTERPRISE-FEATURES.md )**
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
## 📊 Benchmarks
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
| Operation | Performance | Memory |
|-----------|------------|--------|
| Initialize | 450ms | 24MB |
| Add Item | 12ms | +0.1MB |
| Vector Search (1k items) | 3ms | - |
| Metadata Filter (10k items) | 0.8ms | - |
| Natural Language Query | 15ms | - |
| Bulk Import (1000 items) | 2.3s | +8MB |
| **Production Scale (10M items)** | **5.8ms** | **12GB** |
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
## 🔄 Migration from 1.x
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
See [MIGRATION.md ](MIGRATION.md ) for detailed upgrade instructions.
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
Key changes:
- Search methods consolidated into `search()` and `find()`
- Result format now includes full objects with metadata
- New natural language capabilities
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
## 🤝 Contributing
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
We welcome contributions! See [CONTRIBUTING.md ](CONTRIBUTING.md ) for guidelines.
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
## 📖 Documentation
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
- [Getting Started Guide ](docs/guides/getting-started.md )
- [API Reference ](docs/api/README.md )
- [Architecture Overview ](docs/architecture/overview.md )
- [Natural Language Guide ](docs/guides/natural-language.md )
- [Triple Intelligence ](docs/architecture/triple-intelligence.md )
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
## 🏢 Enterprise & Cloud
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
**Brain Cloud** - Managed Brainy with team sync, persistent memory, and enterprise connectors.
2025-08-25 09:52:32 -07:00
```bash
2025-08-26 12:21:13 -07:00
# Get started with free trial
brainy cloud setup
2025-08-25 09:52:32 -07:00
```
2025-08-26 12:21:13 -07:00
Visit [soulcraft.com ](https://soulcraft.com ) for more information.
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
## 📄 License
2025-08-25 09:52:32 -07:00
2025-08-26 12:21:13 -07:00
MIT © Brainy Contributors
2025-08-25 09:52:32 -07:00
---
2025-08-26 12:21:13 -07:00
< p align = "center" >
< strong > Built with ❤️ by the Brainy community< / strong > < br >
< em > Zero-Configuration AI Database with Triple Intelligence™< / em >
< / p >