@soulcraft/brainy 0.55.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +172 -730
- package/bin/brainy.js +592 -0
- package/dist/augmentations/cortexSense.d.ts +196 -0
- package/dist/augmentations/cortexSense.js +747 -0
- package/dist/augmentations/cortexSense.js.map +1 -0
- package/dist/augmentations/memoryAugmentations.d.ts.map +1 -1
- package/dist/augmentations/neuralImportSense.d.ts +196 -0
- package/dist/augmentations/neuralImportSense.js +747 -0
- package/dist/augmentations/neuralImportSense.js.map +1 -0
- package/dist/brainyData.d.ts.map +1 -1
- package/dist/brainyData.js +12 -0
- package/dist/brainyData.js.map +1 -1
- package/dist/chat/brainyChat.d.ts +42 -0
- package/dist/chat/brainyChat.js +340 -0
- package/dist/chat/brainyChat.js.map +1 -0
- package/dist/connectors/interfaces/IConnector.d.ts +143 -0
- package/dist/connectors/interfaces/IConnector.js +8 -0
- package/dist/connectors/interfaces/IConnector.js.map +1 -0
- package/dist/coreTypes.d.ts.map +1 -1
- package/dist/cortex/backupRestore.d.ts +85 -0
- package/dist/cortex/backupRestore.js +326 -0
- package/dist/cortex/backupRestore.js.map +1 -0
- package/dist/cortex/cortex.d.ts +249 -0
- package/dist/cortex/cortex.js +2304 -0
- package/dist/cortex/cortex.js.map +1 -0
- package/dist/cortex/healthCheck.d.ts +85 -0
- package/dist/cortex/healthCheck.js +546 -0
- package/dist/cortex/healthCheck.js.map +1 -0
- package/dist/cortex/licensingSystem.d.ts +126 -0
- package/dist/cortex/licensingSystem.js +474 -0
- package/dist/cortex/licensingSystem.js.map +1 -0
- package/dist/cortex/neuralImport.d.ts +145 -0
- package/dist/cortex/neuralImport.js +620 -0
- package/dist/cortex/neuralImport.js.map +1 -0
- package/dist/cortex/performanceMonitor.d.ts +150 -0
- package/dist/cortex/performanceMonitor.js +371 -0
- package/dist/cortex/performanceMonitor.js.map +1 -0
- package/dist/cortex/serviceIntegration.d.ts +156 -0
- package/dist/cortex/serviceIntegration.js +384 -0
- package/dist/cortex/serviceIntegration.js.map +1 -0
- package/dist/cortex/webhookManager.d.ts +39 -0
- package/dist/cortex/webhookManager.js +326 -0
- package/dist/cortex/webhookManager.js.map +1 -0
- package/dist/hnsw/hnswIndex.d.ts.map +1 -1
- package/dist/hnsw/hnswIndexOptimized.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/patched-platform-node.d.ts +17 -0
- package/dist/patched-platform-node.d.ts.map +1 -0
- package/dist/shared/default-augmentations.d.ts +41 -0
- package/dist/shared/default-augmentations.js +112 -0
- package/dist/shared/default-augmentations.js.map +1 -0
- package/dist/storage/adapters/baseStorageAdapter.d.ts.map +1 -1
- package/dist/storage/adapters/fileSystemStorage.d.ts +14 -0
- package/dist/storage/adapters/fileSystemStorage.d.ts.map +1 -1
- package/dist/storage/adapters/fileSystemStorage.js +68 -0
- package/dist/storage/adapters/fileSystemStorage.js.map +1 -1
- package/dist/storage/adapters/memoryStorage.d.ts +13 -0
- package/dist/storage/adapters/memoryStorage.d.ts.map +1 -1
- package/dist/storage/adapters/memoryStorage.js +19 -0
- package/dist/storage/adapters/memoryStorage.js.map +1 -1
- package/dist/storage/adapters/opfsStorage.d.ts.map +1 -1
- package/dist/storage/adapters/s3CompatibleStorage.d.ts.map +1 -1
- package/dist/storage/baseStorage.d.ts.map +1 -1
- package/dist/storage/storageFactory.d.ts.map +1 -1
- package/dist/testing/prettyReporter.d.ts +23 -0
- package/dist/testing/prettyReporter.d.ts.map +1 -0
- package/dist/testing/prettySummaryReporter.d.ts +22 -0
- package/dist/testing/prettySummaryReporter.d.ts.map +1 -0
- package/dist/types/augmentations.d.ts +48 -1
- package/dist/unified.min.js +12511 -0
- package/dist/unified.min.js.map +1 -0
- package/dist/utils/embedding.d.ts.map +1 -1
- package/dist/utils/embedding.js +1 -0
- package/dist/utils/embedding.js.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/tensorflowUtils.d.ts +17 -0
- package/dist/utils/tensorflowUtils.d.ts.map +1 -0
- package/dist/webhooks/webhookSystem.d.ts +114 -0
- package/dist/webhooks/webhookSystem.js +321 -0
- package/dist/webhooks/webhookSystem.js.map +1 -0
- package/package.json +11 -1
- package/dist/browserFramework.d.ts.map +0 -1
- package/dist/cortex/cli.d.ts +0 -8
- package/dist/cortex/cli.js +0 -207
- package/dist/cortex/cli.js.map +0 -1
- package/dist/cortex/commands/index.d.ts +0 -79
- package/dist/cortex/commands/index.js +0 -614
- package/dist/cortex/commands/index.js.map +0 -1
- package/dist/cortex/config.d.ts +0 -112
- package/dist/cortex/config.js +0 -312
- package/dist/cortex/config.js.map +0 -1
- package/dist/demo.d.ts.map +0 -1
- package/dist/distributed/configManager.d.ts.map +0 -1
- package/dist/distributed/domainDetector.d.ts.map +0 -1
- package/dist/distributed/hashPartitioner.d.ts.map +0 -1
- package/dist/distributed/healthMonitor.d.ts.map +0 -1
- package/dist/distributed/index.d.ts.map +0 -1
- package/dist/distributed/operationalModes.d.ts.map +0 -1
- package/dist/hnsw/distributedSearch.d.ts.map +0 -1
- package/dist/hnsw/optimizedHNSWIndex.d.ts.map +0 -1
- package/dist/hnsw/partitionedHNSWIndex.d.ts.map +0 -1
- package/dist/hnsw/scaledHNSWSystem.d.ts.map +0 -1
- package/dist/storage/adapters/batchS3Operations.d.ts.map +0 -1
- package/dist/storage/adapters/optimizedS3Search.d.ts.map +0 -1
- package/dist/storage/cacheManager.d.ts.map +0 -1
- package/dist/storage/enhancedCacheManager.d.ts.map +0 -1
- package/dist/storage/readOnlyOptimizations.d.ts.map +0 -1
- package/dist/types/distributedTypes.d.ts.map +0 -1
- package/dist/types/paginationTypes.d.ts.map +0 -1
- package/dist/types/tensorflowTypes.js +0 -6
- package/dist/types/tensorflowTypes.js.map +0 -1
- package/dist/utils/autoConfiguration.d.ts.map +0 -1
- package/dist/utils/cacheAutoConfig.d.ts.map +0 -1
- package/dist/utils/crypto.d.ts.map +0 -1
- package/dist/utils/fieldNameTracking.d.ts.map +0 -1
- package/dist/utils/jsonProcessing.d.ts.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/robustModelLoader.d.ts +0 -112
- package/dist/utils/robustModelLoader.d.ts.map +0 -1
- package/dist/utils/robustModelLoader.js +0 -624
- package/dist/utils/robustModelLoader.js.map +0 -1
- package/dist/utils/searchCache.d.ts.map +0 -1
- package/dist/utils/statisticsCollector.d.ts.map +0 -1
- package/dist/utils/typeUtils.d.ts.map +0 -1
- package/dist/utils/version.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,67 +1,27 @@
|
|
|
1
|
+
# 🧠⚛️ Brainy - Lightning-Fast Vector + Graph Database with AI Intelligence
|
|
2
|
+
|
|
1
3
|
<div align="center">
|
|
2
|
-
<img src="./brainy.png" alt="Brainy Logo" width="200"/>
|
|
3
|
-
<br/><br/>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
[](https://badge.fury.io/js/%40soulcraft%2Fbrainy)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
9
|
[](https://nodejs.org/)
|
|
7
10
|
[](https://www.typescriptlang.org/)
|
|
8
|
-
[](CONTRIBUTING.md)
|
|
9
11
|
|
|
10
|
-
**The world's only true Vector + Graph database -
|
|
12
|
+
**The world's only true Vector + Graph database with built-in AI intelligence**
|
|
13
|
+
**Sub-millisecond queries across millions of vectors + billions of relationships**
|
|
11
14
|
|
|
12
15
|
</div>
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# 🆕 Introducing Cortex - Configuration & Coordination Command Center
|
|
17
|
-
|
|
18
|
-
**Never manage .env files again!** Cortex brings encrypted configuration management and distributed coordination to Brainy:
|
|
17
|
+
## The Problem: Three Databases for One Search
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
# Store all your configs encrypted in Brainy
|
|
22
|
-
npx cortex init
|
|
23
|
-
cortex config set DATABASE_URL postgres://localhost/mydb
|
|
24
|
-
cortex config set STRIPE_KEY sk_live_... --encrypt
|
|
25
|
-
|
|
26
|
-
# In your app - just one line!
|
|
27
|
-
await brainy.loadEnvironment() # All configs loaded & decrypted!
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
[📖 **Full Cortex Documentation**](CORTEX.md) | **Zero dependencies** | **Works everywhere**
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
# The Search Problem Every Developer Faces
|
|
35
|
-
|
|
36
|
-
**"I need to find similar content, explore relationships, AND filter by metadata - but that means juggling 3+ databases"**
|
|
37
|
-
|
|
38
|
-
❌ **Current Reality**: Pinecone + Neo4j + Elasticsearch + Custom Sync Logic
|
|
39
|
-
✅ **Brainy Reality**: One database. One API. All three search types.
|
|
40
|
-
|
|
41
|
-
## 🔥 The Power of Three-in-One Search
|
|
42
|
-
|
|
43
|
-
```javascript
|
|
44
|
-
// This ONE query does what used to require 3 databases:
|
|
45
|
-
const results = await brainy.search("AI startups in healthcare", 10, {
|
|
46
|
-
// 🔍 Vector: Semantic similarity
|
|
47
|
-
includeVerbs: true,
|
|
48
|
-
|
|
49
|
-
// 🔗 Graph: Relationship traversal
|
|
50
|
-
verbTypes: ["invests_in", "partners_with"],
|
|
51
|
-
|
|
52
|
-
// 📊 Faceted: MongoDB-style filtering
|
|
53
|
-
metadata: {
|
|
54
|
-
industry: "healthcare",
|
|
55
|
-
funding: { $gte: 1000000 },
|
|
56
|
-
stage: { $in: ["Series A", "Series B"] }
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
// Returns: Companies similar to your query + their relationships + matching your criteria
|
|
60
|
-
```
|
|
19
|
+
**"I need semantic search, relationship traversal, AND metadata filtering - that means 3+ databases"**
|
|
61
20
|
|
|
62
|
-
**
|
|
21
|
+
❌ **Current Reality**: Pinecone + Neo4j + Elasticsearch + Custom Sync = Slow, expensive, complex
|
|
22
|
+
✅ **Brainy Reality**: One blazing-fast database. One API. Everything in sync.
|
|
63
23
|
|
|
64
|
-
## 🚀
|
|
24
|
+
## 🚀 Quick Start: 8 Lines to Production
|
|
65
25
|
|
|
66
26
|
```bash
|
|
67
27
|
npm install @soulcraft/brainy
|
|
@@ -70,595 +30,229 @@ npm install @soulcraft/brainy
|
|
|
70
30
|
```javascript
|
|
71
31
|
import { BrainyData } from '@soulcraft/brainy'
|
|
72
32
|
|
|
73
|
-
const brainy = new BrainyData() // Auto-detects
|
|
74
|
-
await brainy.init() //
|
|
33
|
+
const brainy = new BrainyData() // Auto-detects environment
|
|
34
|
+
await brainy.init() // Zero configuration
|
|
75
35
|
|
|
76
36
|
// Add data with relationships
|
|
77
37
|
const openai = await brainy.add("OpenAI", { type: "company", funding: 11000000 })
|
|
78
38
|
const gpt4 = await brainy.add("GPT-4", { type: "product", users: 100000000 })
|
|
79
39
|
await brainy.relate(openai, gpt4, "develops")
|
|
80
40
|
|
|
81
|
-
//
|
|
41
|
+
// One query, three search paradigms
|
|
82
42
|
const results = await brainy.search("AI language models", 5, {
|
|
83
|
-
metadata: { funding: { $gte: 10000000 } },
|
|
84
|
-
includeVerbs: true
|
|
85
|
-
})
|
|
43
|
+
metadata: { funding: { $gte: 10000000 } }, // MongoDB-style filtering
|
|
44
|
+
includeVerbs: true // Graph relationships
|
|
45
|
+
}) // Semantic vector search
|
|
86
46
|
```
|
|
87
47
|
|
|
88
|
-
**That's it. You just built a knowledge graph with semantic search
|
|
89
|
-
|
|
90
|
-
## ⚙️ Configuration Options
|
|
48
|
+
**That's it. You just built a knowledge graph with semantic search in 8 lines.**
|
|
91
49
|
|
|
92
|
-
|
|
50
|
+
## 🎯 Key Features: Why Developers Choose Brainy
|
|
93
51
|
|
|
94
|
-
###
|
|
95
|
-
```javascript
|
|
96
|
-
const brainy = new BrainyData() // Auto-detects everything
|
|
97
|
-
await brainy.init() // Zero config needed
|
|
52
|
+
### ⚡ Blazing Performance at Scale
|
|
98
53
|
```
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
Perfect for high-throughput data ingestion with smart caching:
|
|
104
|
-
```javascript
|
|
105
|
-
const brainy = new BrainyData({
|
|
106
|
-
writeOnly: true, // Skip search index loading
|
|
107
|
-
allowDirectReads: true // Enable ID-based lookups for deduplication
|
|
108
|
-
})
|
|
109
|
-
// ✅ Can: add(), get(), has(), exists(), getMetadata(), getBatch()
|
|
110
|
-
// ❌ Cannot: search(), similar(), query() (saves memory & startup time)
|
|
54
|
+
Vector Search (1M embeddings): 2-8ms p95 latency
|
|
55
|
+
Graph Traversal (100M relations): 1-3ms p95 latency
|
|
56
|
+
Combined Vector+Graph+Filter: 5-15ms p95 latency
|
|
57
|
+
Throughput: 10K+ queries/second
|
|
111
58
|
```
|
|
112
59
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
writeOnly: true, // No search capabilities
|
|
118
|
-
allowDirectReads: false // No read operations at all
|
|
119
|
-
})
|
|
120
|
-
// ✅ Can: add(), addBatch(), relate()
|
|
121
|
-
// ❌ Cannot: Any read operations (fastest startup)
|
|
122
|
-
```
|
|
60
|
+
### 🌍 Write Once, Run Anywhere
|
|
61
|
+
- **Same code** works in React, Vue, Angular, Node.js, Edge Workers
|
|
62
|
+
- **Auto-detects** environment and optimizes automatically
|
|
63
|
+
- **Zero config** - no setup files, no tuning parameters
|
|
123
64
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
frozen: true // Block statistics updates and optimizations
|
|
130
|
-
})
|
|
131
|
-
// ✅ Can: All search operations
|
|
132
|
-
// ❌ Cannot: add(), update(), delete()
|
|
133
|
-
```
|
|
65
|
+
### 🧠 Built-in AI Intelligence (FREE)
|
|
66
|
+
- **Cortex Augmentation**: AI understands your data structure automatically
|
|
67
|
+
- **Entity Detection**: Identifies people, companies, locations
|
|
68
|
+
- **Relationship Mapping**: Discovers connections between entities
|
|
69
|
+
- **Chat Interface**: Talk to your data naturally (v0.56+)
|
|
134
70
|
|
|
135
|
-
|
|
136
|
-
```javascript
|
|
137
|
-
const brainy = new BrainyData({
|
|
138
|
-
// Storage options
|
|
139
|
-
storage: {
|
|
140
|
-
type: 's3', // 's3', 'memory', 'filesystem'
|
|
141
|
-
requestPersistentStorage: true, // Browser: request persistent storage
|
|
142
|
-
s3Storage: {
|
|
143
|
-
bucketName: 'my-vectors',
|
|
144
|
-
region: 'us-east-1'
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
// Performance tuning
|
|
149
|
-
hnsw: {
|
|
150
|
-
maxConnections: 16, // Higher = better search quality
|
|
151
|
-
efConstruction: 200, // Higher = better index quality
|
|
152
|
-
useOptimized: true // Enable disk-based storage
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
// Embedding customization
|
|
156
|
-
embeddingFunction: myCustomEmbedder,
|
|
157
|
-
distanceFunction: 'euclidean' // 'cosine', 'euclidean', 'manhattan'
|
|
158
|
-
})
|
|
159
|
-
```
|
|
71
|
+
---
|
|
160
72
|
|
|
161
|
-
|
|
162
|
-
```javascript
|
|
163
|
-
// Microservice A (Writer)
|
|
164
|
-
const writerService = new BrainyData({
|
|
165
|
-
writeOnly: true,
|
|
166
|
-
allowDirectReads: true, // For deduplication
|
|
167
|
-
defaultService: 'data-ingestion'
|
|
168
|
-
})
|
|
73
|
+
# 🎆 NEW: Talk to Your Data with Brainy Chat!
|
|
169
74
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
readOnly: true,
|
|
173
|
-
defaultService: 'search-api'
|
|
174
|
-
})
|
|
75
|
+
```javascript
|
|
76
|
+
import { BrainyChat } from '@soulcraft/brainy'
|
|
175
77
|
|
|
176
|
-
//
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
defaultService: 'full-stack-app'
|
|
180
|
-
})
|
|
78
|
+
const chat = new BrainyChat(brainy) // That's it!
|
|
79
|
+
const answer = await chat.ask("What patterns do you see in customer behavior?")
|
|
80
|
+
// → Works instantly with zero config!
|
|
181
81
|
```
|
|
182
82
|
|
|
183
|
-
|
|
83
|
+
**One line. Zero complexity. Optional LLM for smarter responses.**
|
|
84
|
+
[📖 **Learn More About Brainy Chat**](BRAINY-CHAT.md)
|
|
184
85
|
|
|
185
|
-
|
|
186
|
-
<summary>Click to see complete configuration reference</summary>
|
|
86
|
+
## 🔥 The Power of Three-in-One Search
|
|
187
87
|
|
|
188
88
|
```javascript
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
readOnly?: boolean // Disable write operations
|
|
194
|
-
frozen?: boolean // Disable all optimizations and statistics
|
|
195
|
-
lazyLoadInReadOnlyMode?: boolean // Load index on-demand
|
|
196
|
-
|
|
197
|
-
// === Storage Configuration ===
|
|
198
|
-
storage?: {
|
|
199
|
-
type?: 'auto' | 'memory' | 'filesystem' | 's3' | 'opfs'
|
|
200
|
-
requestPersistentStorage?: boolean // Browser persistent storage
|
|
201
|
-
|
|
202
|
-
// Cloud storage options
|
|
203
|
-
s3Storage?: {
|
|
204
|
-
bucketName: string
|
|
205
|
-
region?: string
|
|
206
|
-
accessKeyId?: string
|
|
207
|
-
secretAccessKey?: string
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
r2Storage?: { /* Cloudflare R2 options */ },
|
|
211
|
-
gcsStorage?: { /* Google Cloud Storage options */ }
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
// === Performance Tuning ===
|
|
215
|
-
hnsw?: {
|
|
216
|
-
maxConnections?: number // Default: 16
|
|
217
|
-
efConstruction?: number // Default: 200
|
|
218
|
-
efSearch?: number // Default: 50
|
|
219
|
-
useOptimized?: boolean // Default: true
|
|
220
|
-
useDiskBasedIndex?: boolean // Default: auto-detected
|
|
221
|
-
},
|
|
222
|
-
|
|
223
|
-
// === Embedding & Distance ===
|
|
224
|
-
embeddingFunction?: EmbeddingFunction
|
|
225
|
-
distanceFunction?: 'cosine' | 'euclidean' | 'manhattan'
|
|
226
|
-
|
|
227
|
-
// === Service Identity ===
|
|
228
|
-
defaultService?: string // Default service name for operations
|
|
89
|
+
// This ONE query does what used to require 3 databases:
|
|
90
|
+
const results = await brainy.search("AI startups in healthcare", 10, {
|
|
91
|
+
// 🔍 Vector: Semantic similarity
|
|
92
|
+
includeVerbs: true,
|
|
229
93
|
|
|
230
|
-
//
|
|
231
|
-
|
|
232
|
-
verbose?: boolean // Enable detailed logging
|
|
233
|
-
},
|
|
94
|
+
// 🔗 Graph: Relationship traversal
|
|
95
|
+
verbTypes: ["invests_in", "partners_with"],
|
|
234
96
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
97
|
+
// 📊 Faceted: MongoDB-style filtering
|
|
98
|
+
metadata: {
|
|
99
|
+
industry: "healthcare",
|
|
100
|
+
funding: { $gte: 1000000 },
|
|
101
|
+
stage: { $in: ["Series A", "Series B"] }
|
|
238
102
|
}
|
|
239
103
|
})
|
|
104
|
+
// Returns: Companies similar to your query + their relationships + matching your criteria
|
|
240
105
|
```
|
|
241
106
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
## 🔥 MAJOR UPDATES: What's New in v0.51, v0.49 & v0.48
|
|
245
|
-
|
|
246
|
-
### 🎯 **v0.51: Revolutionary Developer Experience**
|
|
247
|
-
|
|
248
|
-
**Problem-focused approach that gets you productive in seconds!**
|
|
107
|
+
## 🌍 Works Everywhere - Same Code
|
|
249
108
|
|
|
250
|
-
|
|
251
|
-
- ✅ **8-Line Quickstart** - Three search types in one simple demo
|
|
252
|
-
- ✅ **Streamlined Documentation** - Focus on what matters most
|
|
253
|
-
- ✅ **Clear Positioning** - The only true Vector + Graph database
|
|
109
|
+
**Write once, run anywhere.** Brainy auto-detects your environment:
|
|
254
110
|
|
|
255
|
-
|
|
111
|
+
| Environment | Storage | Optimization |
|
|
112
|
+
|-------------|---------|-------------|
|
|
113
|
+
| 🌐 Browser | OPFS | Web Workers, Memory Cache |
|
|
114
|
+
| 🟢 Node.js | FileSystem / S3 | Worker Threads, Clustering |
|
|
115
|
+
| ⚡ Serverless | S3 / Memory | Cold Start Optimization |
|
|
116
|
+
| 🔥 Edge | Memory / KV | Minimal Footprint |
|
|
256
117
|
|
|
257
|
-
|
|
118
|
+
<details>
|
|
119
|
+
<summary>🔧 <strong>Advanced Configuration Options</strong></summary>
|
|
258
120
|
|
|
259
121
|
```javascript
|
|
260
|
-
//
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
// Returns: ['category', 'price', 'brand', 'rating', ...]
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
- ✅ **Filter Discovery API**: O(1) field discovery for instant filter UI generation
|
|
269
|
-
- ✅ **Improved Performance**: Removed deprecated methods, now uses pagination everywhere
|
|
270
|
-
- ✅ **Better Scalability**: Hybrid indexing with O(1) field access scales to millions
|
|
271
|
-
- ✅ **Smart Caching**: LRU cache for frequently accessed filters
|
|
272
|
-
- ✅ **Zero Configuration**: Everything auto-optimizes based on usage patterns
|
|
273
|
-
|
|
274
|
-
### 🚀 **v0.48: MongoDB-Style Metadata Filtering**
|
|
122
|
+
// High-throughput writer
|
|
123
|
+
const writer = new BrainyData({
|
|
124
|
+
writeOnly: true,
|
|
125
|
+
allowDirectReads: true // For deduplication
|
|
126
|
+
})
|
|
275
127
|
|
|
276
|
-
|
|
128
|
+
// Read-only search service
|
|
129
|
+
const reader = new BrainyData({
|
|
130
|
+
readOnly: true,
|
|
131
|
+
frozen: true // No stats updates
|
|
132
|
+
})
|
|
277
133
|
|
|
278
|
-
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
134
|
+
// Custom storage
|
|
135
|
+
const custom = new BrainyData({
|
|
136
|
+
storage: {
|
|
137
|
+
type: 's3',
|
|
138
|
+
s3Storage: { bucketName: 'my-vectors' }
|
|
139
|
+
},
|
|
140
|
+
hnsw: {
|
|
141
|
+
maxConnections: 32 // Higher quality
|
|
285
142
|
}
|
|
286
143
|
})
|
|
287
144
|
```
|
|
288
145
|
|
|
289
|
-
|
|
290
|
-
- ✅ **Automatic Indexing**: Zero configuration, maximum performance
|
|
291
|
-
- ✅ **Nested Fields**: Use dot notation for complex objects
|
|
292
|
-
- ✅ **100% Backward Compatible**: Your existing code works unchanged
|
|
293
|
-
|
|
294
|
-
### ⚡ **v0.46: Transformers.js Migration**
|
|
295
|
-
|
|
296
|
-
**Replaced TensorFlow.js for better performance and true offline operation!**
|
|
297
|
-
|
|
298
|
-
- ✅ **95% Smaller Package**: 643 kB vs 12.5 MB
|
|
299
|
-
- ✅ **84% Smaller Models**: 87 MB vs 525 MB models
|
|
300
|
-
- ✅ **True Offline**: Zero network calls after initial download
|
|
301
|
-
- ✅ **5x Fewer Dependencies**: Clean tree, no peer dependency issues
|
|
302
|
-
- ✅ **Same API**: Drop-in replacement, existing code works unchanged
|
|
303
|
-
|
|
304
|
-
### 🚀 Why Developers Love Brainy
|
|
305
|
-
|
|
306
|
-
- **🧠 Zero-to-Smart™** - No config files, no tuning parameters, no DevOps headaches. Brainy auto-detects your environment and optimizes itself
|
|
307
|
-
- **🌍 True Write-Once, Run-Anywhere** - Same code runs in Angular, React, Vue, Node.js, Deno, Bun, serverless, edge workers, and web workers with automatic environment detection
|
|
308
|
-
- **⚡ Scary Fast** - Handles millions of vectors with sub-millisecond search. GPU acceleration for embeddings, optimized CPU for distance calculations
|
|
309
|
-
- **🎯 Self-Learning** - Like having a database that goes to the gym. Gets faster and smarter the more you use it
|
|
310
|
-
- **🔮 AI-First Design** - Built for the age of embeddings, RAG, and semantic search. Your LLMs will thank you
|
|
311
|
-
- **🎮 Actually Fun to Use** - Clean API, great DX, and it does the heavy lifting so you can build cool stuff
|
|
146
|
+
</details>
|
|
312
147
|
|
|
313
|
-
|
|
148
|
+
## 🎮 Brainy CLI - Command Center for Everything
|
|
314
149
|
|
|
315
|
-
|
|
150
|
+
```bash
|
|
151
|
+
# Talk to your data
|
|
152
|
+
brainy chat "What patterns do you see?"
|
|
316
153
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
- **📄 Cursor-Based Pagination** - Navigate millions of results with constant O(k) performance
|
|
320
|
-
- **🔄 Real-Time Data Sync** - Cache automatically updates when data changes, even in distributed scenarios
|
|
321
|
-
- **📊 Performance Monitoring** - Built-in hit rate and memory usage tracking with adaptive optimization
|
|
322
|
-
- **🎯 Zero Breaking Changes** - All existing code works unchanged, just faster and smarter
|
|
154
|
+
# AI-powered data import
|
|
155
|
+
brainy import data.csv --cortex --confidence 0.8
|
|
323
156
|
|
|
324
|
-
|
|
157
|
+
# Real-time monitoring
|
|
158
|
+
brainy monitor --dashboard
|
|
325
159
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
- 🔄 **Always Synced** - No data consistency nightmares between systems
|
|
330
|
-
- 📦 **Truly Offline** - Works without internet after initial setup
|
|
331
|
-
- 🔒 **Your Data** - Run locally, in browser, or your own cloud
|
|
160
|
+
# Start premium trials
|
|
161
|
+
brainy license trial notion
|
|
162
|
+
```
|
|
332
163
|
|
|
333
|
-
|
|
164
|
+
[📖 **Full CLI Documentation**](/docs/brainy-cli.md)
|
|
334
165
|
|
|
335
|
-
|
|
336
|
-
- **⚡ LLM Generation** - Built-in content generation powered by your knowledge graph
|
|
337
|
-
- **🌊 Real-time Sync** - Live updates across distributed instances
|
|
166
|
+
## ⚙️ Configuration (Optional)
|
|
338
167
|
|
|
339
|
-
|
|
168
|
+
Brainy works with **zero configuration**, but you can customize
|
|
340
169
|
|
|
341
|
-
**🤖 AI Chat Applications** - Build ChatGPT-like apps with long-term memory and context awareness
|
|
342
|
-
**🔍 Semantic Search Engines** - Search by meaning, not keywords. Find "that thing that's like a cat but bigger" → returns "tiger"
|
|
343
|
-
**🎯 Recommendation Engines** - "Users who liked this also liked..." but actually good
|
|
344
|
-
**🧬 Knowledge Graphs** - Connect everything to everything. Wikipedia meets Neo4j meets magic
|
|
345
|
-
**👁️ Computer Vision Apps** - Store and search image embeddings. "Find all photos with dogs wearing hats"
|
|
346
|
-
**🎵 Music Discovery** - Find songs that "feel" similar. Spotify's Discover Weekly in your app
|
|
347
|
-
**📚 Smart Documentation** - Docs that answer questions. "How do I deploy to production?" → relevant guides
|
|
348
|
-
**🛡️ Fraud Detection** - Find patterns humans can't see. Anomaly detection on steroids
|
|
349
|
-
**🌐 Real-Time Collaboration** - Sync vector data across devices. Figma for AI data
|
|
350
|
-
**🏥 Medical Diagnosis Tools** - Match symptoms to conditions using embedding similarity
|
|
351
170
|
|
|
352
|
-
##
|
|
171
|
+
## 🆚 Why Not Just Use...?
|
|
353
172
|
|
|
354
|
-
|
|
173
|
+
### vs. Multiple Databases
|
|
174
|
+
❌ **Pinecone + Neo4j + Elasticsearch** - 3 databases, sync nightmares, 3x the cost
|
|
175
|
+
✅ **Brainy** - One database, always synced, built-in intelligence
|
|
355
176
|
|
|
356
|
-
###
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
npx cortex init
|
|
177
|
+
### vs. Cloud-Only Vector DBs
|
|
178
|
+
❌ **Pinecone/Weaviate/Qdrant** - Vendor lock-in, expensive, cloud-only
|
|
179
|
+
✅ **Brainy** - Run anywhere, your data stays yours, cost-effective
|
|
360
180
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
cortex config import .env.production # Import existing
|
|
181
|
+
### vs. Graph DBs with "Vector Features"
|
|
182
|
+
❌ **Neo4j + vector plugin** - Bolt-on solution, not native, limited
|
|
183
|
+
✅ **Brainy** - Native vector+graph architecture from the ground up
|
|
365
184
|
|
|
366
|
-
|
|
367
|
-
await brainy.loadEnvironment() # All configs loaded!
|
|
368
|
-
```
|
|
185
|
+
## 💎 Premium Features (Optional)
|
|
369
186
|
|
|
370
|
-
|
|
371
|
-
```bash
|
|
372
|
-
# Coordinate migration across all services
|
|
373
|
-
cortex migrate --to s3://new-bucket --strategy gradual
|
|
187
|
+
**Core Brainy is FREE forever. Premium features for enterprise needs:**
|
|
374
188
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
189
|
+
### 🔗 Enterprise Connectors (14-day trials)
|
|
190
|
+
- **Notion** ($49/mo) - Bidirectional workspace sync
|
|
191
|
+
- **Salesforce** ($99/mo) - CRM integration
|
|
192
|
+
- **Slack** ($49/mo) - Team collaboration
|
|
193
|
+
- **Asana** ($44/mo) - Project management
|
|
378
194
|
|
|
379
|
-
### 📊 Database Management
|
|
380
195
|
```bash
|
|
381
|
-
|
|
382
|
-
cortex stats # View statistics
|
|
383
|
-
cortex backup --compress # Create backups
|
|
384
|
-
cortex health # Health check
|
|
385
|
-
cortex shell # Interactive mode
|
|
196
|
+
brainy license trial notion # Start free trial
|
|
386
197
|
```
|
|
387
198
|
|
|
388
|
-
|
|
389
|
-
- **No more .env files** - Encrypted configs in Brainy
|
|
390
|
-
- **No more deployment complexity** - Configs follow your app
|
|
391
|
-
- **No more manual coordination** - Services sync automatically
|
|
392
|
-
- **Zero dependencies** - Uses Brainy's existing storage
|
|
393
|
-
- **Works everywhere** - Any environment, any storage
|
|
199
|
+
**No vendor lock-in. Your data stays yours.**
|
|
394
200
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
## 🌍 Works Everywhere - Same Code
|
|
201
|
+
## 🎨 What You Can Build
|
|
398
202
|
|
|
399
|
-
|
|
203
|
+
- **🤖 AI Chat Applications** - ChatGPT-like apps with long-term memory
|
|
204
|
+
- **🔍 Semantic Search** - Search by meaning, not keywords
|
|
205
|
+
- **🎯 Recommendation Engines** - "Users who liked this also liked..."
|
|
206
|
+
- **🧬 Knowledge Graphs** - Connect everything to everything
|
|
207
|
+
- **🛡️ Fraud Detection** - Find patterns humans can't see
|
|
208
|
+
- **📚 Smart Documentation** - Docs that answer questions
|
|
400
209
|
|
|
401
|
-
### 🌐 Browser Frameworks (React, Angular, Vue)
|
|
402
|
-
|
|
403
|
-
```javascript
|
|
404
|
-
import { BrainyData } from '@soulcraft/brainy'
|
|
405
|
-
|
|
406
|
-
// SAME CODE in React, Angular, Vue, Svelte, etc.
|
|
407
|
-
const brainy = new BrainyData()
|
|
408
|
-
await brainy.init() // Auto-uses OPFS in browsers
|
|
409
|
-
|
|
410
|
-
// Add entities and relationships
|
|
411
|
-
const john = await brainy.add("John is a software engineer", { type: "person" })
|
|
412
|
-
const jane = await brainy.add("Jane is a data scientist", { type: "person" })
|
|
413
|
-
const ai = await brainy.add("AI Project", { type: "project" })
|
|
414
|
-
|
|
415
|
-
await brainy.relate(john, ai, "works_on")
|
|
416
|
-
await brainy.relate(jane, ai, "leads")
|
|
417
|
-
|
|
418
|
-
// Search by meaning
|
|
419
|
-
const engineers = await brainy.search("software developers", 5)
|
|
420
|
-
|
|
421
|
-
// Traverse relationships
|
|
422
|
-
const team = await brainy.getVerbsByTarget(ai) // Who works on AI Project?
|
|
423
|
-
```
|
|
424
210
|
|
|
425
211
|
<details>
|
|
426
|
-
<summary>📦 <strong>
|
|
212
|
+
<summary>📦 <strong>Framework Examples</strong></summary>
|
|
427
213
|
|
|
214
|
+
### React
|
|
428
215
|
```jsx
|
|
429
216
|
import { BrainyData } from '@soulcraft/brainy'
|
|
430
|
-
import { useEffect, useState } from 'react'
|
|
431
|
-
|
|
432
|
-
function Search() {
|
|
433
|
-
const [brainy, setBrainy] = useState(null)
|
|
434
|
-
const [results, setResults] = useState([])
|
|
435
|
-
|
|
436
|
-
useEffect(() => {
|
|
437
|
-
const init = async () => {
|
|
438
|
-
const db = new BrainyData()
|
|
439
|
-
await db.init()
|
|
440
|
-
// Add your data...
|
|
441
|
-
setBrainy(db)
|
|
442
|
-
}
|
|
443
|
-
init()
|
|
444
|
-
}, [])
|
|
445
217
|
|
|
218
|
+
function App() {
|
|
219
|
+
const [brainy] = useState(() => new BrainyData())
|
|
220
|
+
useEffect(() => brainy.init(), [])
|
|
221
|
+
|
|
446
222
|
const search = async (query) => {
|
|
447
|
-
|
|
448
|
-
setResults(results)
|
|
223
|
+
return await brainy.search(query, 10)
|
|
449
224
|
}
|
|
450
|
-
|
|
451
|
-
return <input onChange={(e) => search(e.target.value)} placeholder="Search..." />
|
|
452
225
|
}
|
|
453
226
|
```
|
|
454
227
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
<
|
|
458
|
-
|
|
228
|
+
### Vue 3
|
|
229
|
+
```vue
|
|
230
|
+
<script setup>
|
|
231
|
+
const brainy = new BrainyData()
|
|
232
|
+
await brainy.init()
|
|
233
|
+
</script>
|
|
234
|
+
```
|
|
459
235
|
|
|
236
|
+
### Angular
|
|
460
237
|
```typescript
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
@Component({
|
|
465
|
-
selector: 'app-search',
|
|
466
|
-
template: `<input (input)="search($event.target.value)" placeholder="Search...">`
|
|
467
|
-
})
|
|
468
|
-
export class SearchComponent implements OnInit {
|
|
238
|
+
@Component({})
|
|
239
|
+
export class AppComponent {
|
|
469
240
|
brainy = new BrainyData()
|
|
470
|
-
|
|
471
241
|
async ngOnInit() {
|
|
472
242
|
await this.brainy.init()
|
|
473
|
-
// Add your data...
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
async search(query: string) {
|
|
477
|
-
const results = await this.brainy.search(query, 5)
|
|
478
|
-
// Display results...
|
|
479
243
|
}
|
|
480
244
|
}
|
|
481
245
|
```
|
|
482
246
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
<details>
|
|
486
|
-
<summary>📦 <strong>Full Vue Example</strong></summary>
|
|
487
|
-
|
|
488
|
-
```vue
|
|
489
|
-
<script setup>
|
|
490
|
-
import { BrainyData } from '@soulcraft/brainy'
|
|
491
|
-
import { ref, onMounted } from 'vue'
|
|
492
|
-
|
|
493
|
-
const brainy = ref(null)
|
|
494
|
-
const results = ref([])
|
|
495
|
-
|
|
496
|
-
onMounted(async () => {
|
|
497
|
-
const db = new BrainyData()
|
|
498
|
-
await db.init()
|
|
499
|
-
// Add your data...
|
|
500
|
-
brainy.value = db
|
|
501
|
-
})
|
|
502
|
-
|
|
503
|
-
const search = async (query) => {
|
|
504
|
-
const results = await brainy.value?.search(query, 5) || []
|
|
505
|
-
setResults(results)
|
|
506
|
-
}
|
|
507
|
-
</script>
|
|
508
|
-
|
|
509
|
-
<template>
|
|
510
|
-
<input @input="search($event.target.value)" placeholder="Search..." />
|
|
511
|
-
</template>
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
</details>
|
|
515
|
-
|
|
516
|
-
### 🟢 Node.js / Serverless / Edge
|
|
517
|
-
|
|
247
|
+
### Node.js
|
|
518
248
|
```javascript
|
|
519
|
-
import { BrainyData } from '@soulcraft/brainy'
|
|
520
|
-
|
|
521
|
-
// SAME CODE works in Node.js, Vercel, Netlify, Cloudflare Workers, Deno, Bun
|
|
522
249
|
const brainy = new BrainyData()
|
|
523
|
-
await brainy.init() // Auto-detects environment and optimizes
|
|
524
|
-
|
|
525
|
-
// Add entities and relationships
|
|
526
|
-
await brainy.add("Python is great for data science", { type: "fact" })
|
|
527
|
-
await brainy.add("JavaScript rules the web", { type: "fact" })
|
|
528
|
-
|
|
529
|
-
// Search by meaning
|
|
530
|
-
const results = await brainy.search("programming languages", 5)
|
|
531
|
-
|
|
532
|
-
// Optional: Production with S3/R2 storage (auto-detected in cloud environments)
|
|
533
|
-
const productionBrainy = new BrainyData({
|
|
534
|
-
storage: {
|
|
535
|
-
s3Storage: { bucketName: process.env.BUCKET_NAME }
|
|
536
|
-
}
|
|
537
|
-
})
|
|
538
|
-
```
|
|
539
|
-
|
|
540
|
-
**That's it! Same code, everywhere. Zero-to-Smart™**
|
|
541
|
-
|
|
542
|
-
Brainy automatically detects and optimizes for your environment:
|
|
543
|
-
|
|
544
|
-
| Environment | Storage | Optimization |
|
|
545
|
-
|-------------|---------|-------------|
|
|
546
|
-
| 🌐 Browser | OPFS | Web Workers, Memory Cache |
|
|
547
|
-
| 🟢 Node.js | FileSystem / S3 | Worker Threads, Clustering |
|
|
548
|
-
| ⚡ Serverless | S3 / Memory | Cold Start Optimization |
|
|
549
|
-
| 🔥 Edge | Memory / KV | Minimal Footprint |
|
|
550
|
-
|
|
551
|
-
## 🌐 Distributed Mode (NEW!)
|
|
552
|
-
|
|
553
|
-
**Scale horizontally with zero configuration!** Brainy now supports distributed deployments with automatic coordination:
|
|
554
|
-
|
|
555
|
-
- **🌐 Multi-Instance Coordination** - Multiple readers and writers working in harmony
|
|
556
|
-
- **🏷️ Smart Domain Detection** - Automatically categorizes data (medical, legal, product, etc.)
|
|
557
|
-
- **📊 Real-Time Health Monitoring** - Track performance across all instances
|
|
558
|
-
- **🔄 Automatic Role Optimization** - Readers optimize for cache, writers for throughput
|
|
559
|
-
- **🗂️ Intelligent Partitioning** - Hash-based partitioning for perfect load distribution
|
|
560
|
-
|
|
561
|
-
```javascript
|
|
562
|
-
// Writer Instance - Ingests data from multiple sources
|
|
563
|
-
const writer = new BrainyData({
|
|
564
|
-
storage: { s3Storage: { bucketName: 'my-bucket' } },
|
|
565
|
-
distributed: { role: 'writer' } // Explicit role for safety
|
|
566
|
-
})
|
|
567
|
-
|
|
568
|
-
// Reader Instance - Optimized for search queries
|
|
569
|
-
const reader = new BrainyData({
|
|
570
|
-
storage: { s3Storage: { bucketName: 'my-bucket' } },
|
|
571
|
-
distributed: { role: 'reader' } // 80% memory for cache
|
|
572
|
-
})
|
|
573
|
-
|
|
574
|
-
// Data automatically gets domain tags
|
|
575
|
-
await writer.add("Patient shows symptoms of...", {
|
|
576
|
-
diagnosis: "flu" // Auto-tagged as 'medical' domain
|
|
577
|
-
})
|
|
578
|
-
|
|
579
|
-
// Domain-aware search across all partitions
|
|
580
|
-
const results = await reader.search("medical symptoms", 10, {
|
|
581
|
-
filter: { domain: 'medical' } // Only search medical data
|
|
582
|
-
})
|
|
583
|
-
|
|
584
|
-
// Monitor health across all instances
|
|
585
|
-
const health = reader.getHealthStatus()
|
|
586
|
-
console.log(`Instance ${health.instanceId}: ${health.status}`)
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
### 🐳 NEW: Zero-Config Docker Deployment
|
|
590
|
-
|
|
591
|
-
**Deploy to any cloud with embedded models - no runtime downloads needed!**
|
|
592
|
-
|
|
593
|
-
```dockerfile
|
|
594
|
-
# One line extracts models automatically during build
|
|
595
|
-
RUN npm run download-models
|
|
596
|
-
|
|
597
|
-
# Deploy anywhere: Google Cloud, AWS, Azure, Cloudflare, etc.
|
|
598
|
-
```
|
|
599
|
-
|
|
600
|
-
- **⚡ 7x Faster Cold Starts** - Models embedded in container, no downloads
|
|
601
|
-
- **🌐 Universal Cloud Support** - Same Dockerfile works everywhere
|
|
602
|
-
- **🔒 Offline Ready** - No external dependencies at runtime
|
|
603
|
-
- **📦 Zero Configuration** - Automatic model detection and loading
|
|
604
|
-
|
|
605
|
-
```javascript
|
|
606
|
-
// Zero configuration - everything optimized automatically!
|
|
607
|
-
const brainy = new BrainyData() // Auto-detects environment & optimizes
|
|
608
250
|
await brainy.init()
|
|
609
|
-
|
|
610
|
-
// Caching happens automatically - no setup needed!
|
|
611
|
-
const results1 = await brainy.search('query', 10) // ~50ms first time
|
|
612
|
-
const results2 = await brainy.search('query', 10) // <1ms cached hit!
|
|
613
|
-
|
|
614
|
-
// Advanced pagination works instantly
|
|
615
|
-
const page1 = await brainy.searchWithCursor('query', 100)
|
|
616
|
-
const page2 = await brainy.searchWithCursor('query', 100, {
|
|
617
|
-
cursor: page1.cursor // Constant time, no matter how deep!
|
|
618
|
-
})
|
|
619
|
-
|
|
620
|
-
// Monitor auto-optimized performance
|
|
621
|
-
const stats = brainy.getCacheStats()
|
|
622
|
-
console.log(`Auto-tuned cache hit rate: ${(stats.search.hitRate * 100).toFixed(1)}%`)
|
|
623
251
|
```
|
|
624
252
|
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
### Core Capabilities
|
|
628
|
-
|
|
629
|
-
- **Vector Search** - Find semantically similar content using embeddings
|
|
630
|
-
- **MongoDB-Style Metadata Filtering** 🆕 - Advanced filtering with `$gt`, `$in`, `$regex`, `$and`, `$or` operators
|
|
631
|
-
- **Graph Relationships** - Connect data with meaningful relationships
|
|
632
|
-
- **JSON Document Search** - Search within specific fields with prioritization
|
|
633
|
-
- **Distributed Mode** - Scale horizontally with automatic coordination between instances
|
|
634
|
-
- **Real-Time Syncing** - WebSocket and WebRTC for distributed instances
|
|
635
|
-
- **Streaming Pipeline** - Process data in real-time as it flows through
|
|
636
|
-
- **Model Control Protocol** - Let AI models access your data
|
|
637
|
-
|
|
638
|
-
### Developer Experience
|
|
639
|
-
|
|
640
|
-
- **TypeScript Support** - Fully typed API with generics
|
|
641
|
-
- **Extensible Augmentations** - Customize and extend functionality
|
|
642
|
-
- **REST API** - Web service wrapper for HTTP endpoints
|
|
643
|
-
- **Auto-Complete** - IntelliSense for all APIs and types
|
|
644
|
-
|
|
645
|
-
## 🆚 Why Not Just Use...?
|
|
253
|
+
</details>
|
|
646
254
|
|
|
647
|
-
### vs. Multiple Databases
|
|
648
|
-
❌ **Pinecone + Neo4j + Elasticsearch** - 3 databases, sync nightmares, 3x the cost
|
|
649
|
-
✅ **Brainy** - One database, always synced, built-in intelligence
|
|
650
255
|
|
|
651
|
-
### vs. Traditional Solutions
|
|
652
|
-
❌ **PostgreSQL + pgvector + extensions** - Complex setup, performance issues
|
|
653
|
-
✅ **Brainy** - Zero config, purpose-built for AI, works everywhere
|
|
654
|
-
|
|
655
|
-
### vs. Cloud-Only Vector DBs
|
|
656
|
-
❌ **Pinecone/Weaviate/Qdrant** - Vendor lock-in, expensive, cloud-only
|
|
657
|
-
✅ **Brainy** - Run anywhere, your data stays yours, cost-effective
|
|
658
|
-
|
|
659
|
-
### vs. Graph Databases with "Vector Features"
|
|
660
|
-
❌ **Neo4j + vector plugin** - Bolt-on solution, not native, limited
|
|
661
|
-
✅ **Brainy** - Native vector+graph architecture from the ground up
|
|
662
256
|
|
|
663
257
|
## 📦 Advanced Features
|
|
664
258
|
|
|
@@ -668,229 +262,77 @@ console.log(`Auto-tuned cache hit rate: ${(stats.search.hitRate * 100).toFixed(1
|
|
|
668
262
|
```javascript
|
|
669
263
|
const results = await brainy.search("machine learning", 10, {
|
|
670
264
|
metadata: {
|
|
671
|
-
// Comparison operators
|
|
672
265
|
price: { $gte: 100, $lte: 1000 },
|
|
673
|
-
category: { $in: ["AI", "ML"
|
|
266
|
+
category: { $in: ["AI", "ML"] },
|
|
674
267
|
rating: { $gt: 4.5 },
|
|
675
|
-
|
|
676
|
-
// Logical operators
|
|
677
|
-
$and: [
|
|
678
|
-
{ status: "active" },
|
|
679
|
-
{ verified: true }
|
|
680
|
-
],
|
|
681
|
-
|
|
682
|
-
// Text operators
|
|
683
|
-
description: { $regex: "neural.*network", $options: "i" },
|
|
684
|
-
|
|
685
|
-
// Array operators
|
|
686
268
|
tags: { $includes: "tensorflow" }
|
|
687
269
|
}
|
|
688
270
|
})
|
|
689
271
|
```
|
|
690
272
|
|
|
691
|
-
**15+ operators
|
|
273
|
+
**15+ operators**: `$gt`, `$in`, `$regex`, `$and`, `$or`, etc.
|
|
692
274
|
|
|
693
275
|
</details>
|
|
694
276
|
|
|
695
277
|
<details>
|
|
696
|
-
<summary>🔗 <strong>Graph Relationships
|
|
278
|
+
<summary>🔗 <strong>Graph Relationships</strong></summary>
|
|
697
279
|
|
|
698
280
|
```javascript
|
|
699
|
-
// Create entities and relationships
|
|
700
281
|
const company = await brainy.add("OpenAI", { type: "company" })
|
|
701
282
|
const product = await brainy.add("GPT-4", { type: "product" })
|
|
702
|
-
const person = await brainy.add("Sam Altman", { type: "person" })
|
|
703
|
-
|
|
704
|
-
// Create meaningful relationships
|
|
705
283
|
await brainy.relate(company, product, "develops")
|
|
706
|
-
await brainy.relate(person, company, "leads")
|
|
707
|
-
await brainy.relate(product, person, "created_by")
|
|
708
|
-
|
|
709
|
-
// Traverse relationships
|
|
710
|
-
const products = await brainy.getVerbsBySource(company) // What OpenAI develops
|
|
711
|
-
const leaders = await brainy.getVerbsByTarget(company) // Who leads OpenAI
|
|
712
|
-
const connections = await brainy.findSimilar(product, {
|
|
713
|
-
relationType: "develops"
|
|
714
|
-
})
|
|
715
284
|
|
|
716
|
-
|
|
717
|
-
const results = await brainy.search("AI models", 10, {
|
|
718
|
-
includeVerbs: true,
|
|
719
|
-
verbTypes: ["develops", "created_by"],
|
|
720
|
-
searchConnectedNouns: true
|
|
721
|
-
})
|
|
285
|
+
const products = await brainy.getVerbsBySource(company)
|
|
722
286
|
```
|
|
723
287
|
|
|
724
288
|
</details>
|
|
725
289
|
|
|
726
290
|
<details>
|
|
727
|
-
<summary
|
|
728
|
-
|
|
729
|
-
```javascript
|
|
730
|
-
// Development: File system
|
|
731
|
-
const dev = new BrainyData({
|
|
732
|
-
storage: { fileSystem: { path: './data' } }
|
|
733
|
-
})
|
|
734
|
-
|
|
735
|
-
// Production: S3/R2
|
|
736
|
-
const prod = new BrainyData({
|
|
737
|
-
storage: { s3Storage: { bucketName: 'my-vectors' } }
|
|
738
|
-
})
|
|
739
|
-
|
|
740
|
-
// Browser: OPFS
|
|
741
|
-
const browser = new BrainyData() // Auto-detects OPFS
|
|
742
|
-
|
|
743
|
-
// Edge: Memory
|
|
744
|
-
const edge = new BrainyData({
|
|
745
|
-
storage: { memory: {} }
|
|
746
|
-
})
|
|
747
|
-
|
|
748
|
-
// Redis: High performance
|
|
749
|
-
const redis = new BrainyData({
|
|
750
|
-
storage: { redis: { connectionString: 'redis://...' } }
|
|
751
|
-
})
|
|
752
|
-
```
|
|
753
|
-
|
|
754
|
-
**Extend with any storage**: MongoDB, PostgreSQL, DynamoDB - [see storage adapters guide](docs/api-reference/storage-adapters.md)
|
|
755
|
-
|
|
756
|
-
</details>
|
|
757
|
-
|
|
758
|
-
<details>
|
|
759
|
-
<summary>🐳 <strong>Docker & Cloud Deployment</strong></summary>
|
|
291
|
+
<summary>🐳 <strong>Docker Deployment</strong></summary>
|
|
760
292
|
|
|
761
293
|
```dockerfile
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
COPY package*.json ./
|
|
766
|
-
RUN npm ci
|
|
767
|
-
COPY . .
|
|
768
|
-
RUN npm run download-models # Embed models for offline operation
|
|
769
|
-
RUN npm run build
|
|
770
|
-
|
|
771
|
-
FROM node:24-slim AS production
|
|
772
|
-
WORKDIR /app
|
|
773
|
-
COPY package*.json ./
|
|
774
|
-
RUN npm ci --only=production
|
|
775
|
-
COPY --from=builder /app/dist ./dist
|
|
776
|
-
COPY --from=builder /app/models ./models # Offline models included
|
|
777
|
-
CMD ["node", "dist/server.js"]
|
|
294
|
+
FROM node:24-slim
|
|
295
|
+
RUN npm run download-models # Embed models
|
|
296
|
+
CMD ["node", "server.js"]
|
|
778
297
|
```
|
|
779
298
|
|
|
780
|
-
Deploy
|
|
299
|
+
Deploy anywhere: AWS, GCP, Azure, Cloudflare
|
|
781
300
|
|
|
782
301
|
</details>
|
|
783
302
|
|
|
784
|
-
## 🚀 Getting Started in 30 Seconds
|
|
785
|
-
|
|
786
|
-
**The same Brainy code works everywhere - React, Vue, Angular, Node.js, Serverless, Edge Workers.**
|
|
787
|
-
|
|
788
|
-
```javascript
|
|
789
|
-
// This EXACT code works in ALL environments
|
|
790
|
-
import { BrainyData } from '@soulcraft/brainy'
|
|
791
|
-
|
|
792
|
-
const brainy = new BrainyData()
|
|
793
|
-
await brainy.init()
|
|
794
|
-
|
|
795
|
-
// Add nouns (entities)
|
|
796
|
-
const openai = await brainy.add("OpenAI", { type: "company" })
|
|
797
|
-
const gpt4 = await brainy.add("GPT-4", { type: "product" })
|
|
798
|
-
|
|
799
|
-
// Add verbs (relationships)
|
|
800
|
-
await brainy.relate(openai, gpt4, "develops")
|
|
801
|
-
|
|
802
|
-
// Vector search + Graph traversal
|
|
803
|
-
const similar = await brainy.search("AI companies", 5)
|
|
804
|
-
const products = await brainy.getVerbsBySource(openai)
|
|
805
|
-
```
|
|
806
|
-
|
|
807
|
-
<details>
|
|
808
|
-
<summary>🔍 <strong>See Framework Examples</strong></summary>
|
|
809
|
-
|
|
810
|
-
### React
|
|
811
|
-
|
|
812
|
-
```jsx
|
|
813
|
-
function App() {
|
|
814
|
-
const [brainy] = useState(() => new BrainyData())
|
|
815
|
-
useEffect(() => brainy.init(), [])
|
|
816
303
|
|
|
817
|
-
|
|
818
|
-
return await brainy.search(query, 10)
|
|
819
|
-
}
|
|
820
|
-
// Same API as above
|
|
821
|
-
}
|
|
822
|
-
```
|
|
304
|
+
## 📚 Documentation
|
|
823
305
|
|
|
824
|
-
|
|
306
|
+
- [Quick Start](docs/getting-started/)
|
|
307
|
+
- [API Reference](docs/api-reference/)
|
|
308
|
+
- [Examples](docs/examples/)
|
|
309
|
+
- [Brainy CLI](docs/brainy-cli.md)
|
|
310
|
+
- [Performance Guide](docs/optimization-guides/)
|
|
825
311
|
|
|
826
|
-
|
|
827
|
-
<script setup>
|
|
828
|
-
const brainy = new BrainyData()
|
|
829
|
-
await brainy.init()
|
|
830
|
-
// Same API as above
|
|
831
|
-
</script>
|
|
832
|
-
```
|
|
312
|
+
## ❓ Does Brainy Impact Performance?
|
|
833
313
|
|
|
834
|
-
|
|
314
|
+
**NO - Brainy actually IMPROVES performance:**
|
|
835
315
|
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
async ngOnInit() {
|
|
842
|
-
await this.brainy.init()
|
|
843
|
-
// Same API as above
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
```
|
|
847
|
-
|
|
848
|
-
### Node.js / Deno / Bun
|
|
849
|
-
|
|
850
|
-
```javascript
|
|
851
|
-
const brainy = new BrainyData()
|
|
852
|
-
await brainy.init()
|
|
853
|
-
// Same API as above
|
|
854
|
-
```
|
|
855
|
-
|
|
856
|
-
</details>
|
|
316
|
+
✅ **Zero runtime overhead** - Premium features are lazy-loaded only when used
|
|
317
|
+
✅ **Smaller than alternatives** - 643KB vs 12.5MB for TensorFlow.js
|
|
318
|
+
✅ **Built-in caching** - 95%+ cache hit rates reduce compute
|
|
319
|
+
✅ **Automatic optimization** - Gets faster as it learns your patterns
|
|
320
|
+
✅ **No network calls** - Works completely offline after setup
|
|
857
321
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
**Brainy automatically detects your environment and optimizes everything:**
|
|
861
|
-
|
|
862
|
-
| Environment | Storage | Optimization |
|
|
863
|
-
|-----------------|-----------------|----------------------------|
|
|
864
|
-
| 🌐 Browser | OPFS | Web Workers, Memory Cache |
|
|
865
|
-
| 🟢 Node.js | FileSystem / S3 | Worker Threads, Clustering |
|
|
866
|
-
| ⚡ Serverless | S3 / Memory | Cold Start Optimization |
|
|
867
|
-
| 🔥 Edge Workers | Memory / KV | Minimal Footprint |
|
|
868
|
-
| 🦕 Deno/Bun | FileSystem / S3 | Native Performance |
|
|
869
|
-
|
|
870
|
-
## 📚 Documentation & Resources
|
|
871
|
-
|
|
872
|
-
- **[🚀 Quick Start Guide](docs/getting-started/)** - Get up and running in minutes
|
|
873
|
-
- **[📖 API Reference](docs/api-reference/)** - Complete method documentation
|
|
874
|
-
- **[💡 Examples](docs/examples/)** - Real-world usage patterns
|
|
875
|
-
- **[⚡ Performance Guide](docs/optimization-guides/)** - Scale to millions of vectors
|
|
876
|
-
- **[🔧 Storage Adapters](docs/api-reference/storage-adapters.md)** - Universal storage compatibility
|
|
322
|
+
**The augmentation system and premium features are 100% optional and have ZERO impact unless explicitly activated.**
|
|
877
323
|
|
|
878
324
|
## 🤝 Contributing
|
|
879
325
|
|
|
880
|
-
We welcome contributions!
|
|
881
|
-
|
|
882
|
-
- [Contributing Guidelines](CONTRIBUTING.md)
|
|
883
|
-
- [Developer Documentation](docs/development/DEVELOPERS.md)
|
|
884
|
-
- [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
326
|
+
We welcome contributions! See [Contributing Guidelines](CONTRIBUTING.md)
|
|
885
327
|
|
|
886
328
|
## 📄 License
|
|
887
329
|
|
|
888
|
-
[MIT](LICENSE)
|
|
330
|
+
[MIT](LICENSE) - Core Brainy is FREE forever
|
|
889
331
|
|
|
890
332
|
---
|
|
891
333
|
|
|
892
334
|
<div align="center">
|
|
893
|
-
<strong>Ready to build the future of search
|
|
335
|
+
<strong>Ready to build the future of search?</strong>
|
|
894
336
|
|
|
895
|
-
**[Get Started →](docs/getting-started/) | [
|
|
337
|
+
**[Get Started →](docs/getting-started/) | [Examples →](docs/examples/) | [Discord →](https://discord.gg/brainy)**
|
|
896
338
|
</div>
|