@soulcraft/brainy 0.51.0 β†’ 0.51.1

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.
Files changed (2) hide show
  1. package/README.md +245 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <div align="center>
1
+ <div align="center">
2
2
  <img src="./brainy.png" alt="Brainy Logo" width="200"/>
3
3
  <br/><br/>
4
4
 
@@ -69,6 +69,66 @@ const results = await brainy.search("AI language models", 5, {
69
69
 
70
70
  **That's it. You just built a knowledge graph with semantic search and faceted filtering in 8 lines.**
71
71
 
72
+ ## πŸ”₯ MAJOR UPDATES: What's New in v0.51, v0.49 & v0.48
73
+
74
+ ### 🎯 **v0.51: Revolutionary Developer Experience**
75
+
76
+ **Problem-focused approach that gets you productive in seconds!**
77
+
78
+ - βœ… **Problem-Solution Narrative** - Immediately understand why Brainy exists
79
+ - βœ… **8-Line Quickstart** - Three search types in one simple demo
80
+ - βœ… **Streamlined Documentation** - Focus on what matters most
81
+ - βœ… **Clear Positioning** - The only true Vector + Graph database
82
+
83
+ ### 🎯 **v0.49: Filter Discovery & Performance Improvements**
84
+
85
+ **Discover available filters and scale to millions of items!**
86
+
87
+ ```javascript
88
+ // Discover what filters are available - O(1) field lookup
89
+ const categories = await brainy.getFilterValues('category')
90
+ // Returns: ['electronics', 'books', 'clothing', ...]
91
+
92
+ const fields = await brainy.getFilterFields() // O(1) operation
93
+ // Returns: ['category', 'price', 'brand', 'rating', ...]
94
+ ```
95
+
96
+ - βœ… **Filter Discovery API**: O(1) field discovery for instant filter UI generation
97
+ - βœ… **Improved Performance**: Removed deprecated methods, now uses pagination everywhere
98
+ - βœ… **Better Scalability**: Hybrid indexing with O(1) field access scales to millions
99
+ - βœ… **Smart Caching**: LRU cache for frequently accessed filters
100
+ - βœ… **Zero Configuration**: Everything auto-optimizes based on usage patterns
101
+
102
+ ### πŸš€ **v0.48: MongoDB-Style Metadata Filtering**
103
+
104
+ **Powerful querying with familiar syntax - filter DURING search for maximum performance!**
105
+
106
+ ```javascript
107
+ const results = await brainy.search("wireless headphones", 10, {
108
+ metadata: {
109
+ category: { $in: ["electronics", "audio"] },
110
+ price: { $lte: 200 },
111
+ rating: { $gte: 4.0 },
112
+ brand: { $ne: "Generic" }
113
+ }
114
+ })
115
+ ```
116
+
117
+ - βœ… **15+ MongoDB Operators**: `$gt`, `$in`, `$regex`, `$and`, `$or`, `$includes`, etc.
118
+ - βœ… **Automatic Indexing**: Zero configuration, maximum performance
119
+ - βœ… **Nested Fields**: Use dot notation for complex objects
120
+ - βœ… **100% Backward Compatible**: Your existing code works unchanged
121
+
122
+ ### ⚑ **v0.46: Transformers.js Migration**
123
+
124
+ **Replaced TensorFlow.js for better performance and true offline operation!**
125
+
126
+ - βœ… **95% Smaller Package**: 643 kB vs 12.5 MB
127
+ - βœ… **84% Smaller Models**: 87 MB vs 525 MB models
128
+ - βœ… **True Offline**: Zero network calls after initial download
129
+ - βœ… **5x Fewer Dependencies**: Clean tree, no peer dependency issues
130
+ - βœ… **Same API**: Drop-in replacement, existing code works unchanged
131
+
72
132
  ## πŸ† Why Brainy Wins
73
133
 
74
134
  - 🧠 **Triple Search Power** - Vector + Graph + Faceted filtering in one query
@@ -84,27 +144,164 @@ const results = await brainy.search("AI language models", 5, {
84
144
  - **⚑ LLM Generation** - Built-in content generation powered by your knowledge graph
85
145
  - **🌊 Real-time Sync** - Live updates across distributed instances
86
146
 
87
- ## 🎯 Perfect For
147
+ ## 🎨 Build Amazing Things
88
148
 
89
- **πŸ€– AI Chat Applications** - ChatGPT-like apps with long-term memory and context
90
- **πŸ” Semantic Search** - Find "that thing like a cat but bigger" β†’ returns "tiger"
91
- **🧬 Knowledge Graphs** - Connect everything. Wikipedia meets Neo4j meets magic
149
+ **πŸ€– AI Chat Applications** - Build ChatGPT-like apps with long-term memory and context awareness
150
+ **πŸ” Semantic Search Engines** - Search by meaning, not keywords. Find "that thing that's like a cat but bigger" β†’ returns "tiger"
92
151
  **🎯 Recommendation Engines** - "Users who liked this also liked..." but actually good
93
- **πŸ“š Smart Documentation** - Docs that answer questions before you ask them
152
+ **🧬 Knowledge Graphs** - Connect everything to everything. Wikipedia meets Neo4j meets magic
153
+ **πŸ‘οΈ Computer Vision Apps** - Store and search image embeddings. "Find all photos with dogs wearing hats"
154
+ **🎡 Music Discovery** - Find songs that "feel" similar. Spotify's Discover Weekly in your app
155
+ **πŸ“š Smart Documentation** - Docs that answer questions. "How do I deploy to production?" β†’ relevant guides
156
+ **πŸ›‘οΈ Fraud Detection** - Find patterns humans can't see. Anomaly detection on steroids
157
+ **🌐 Real-Time Collaboration** - Sync vector data across devices. Figma for AI data
158
+ **πŸ₯ Medical Diagnosis Tools** - Match symptoms to conditions using embedding similarity
94
159
 
95
160
  ## 🌍 Works Everywhere - Same Code
96
161
 
162
+ **Write once, run anywhere.** Brainy auto-detects your environment and optimizes automatically:
163
+
164
+ ### 🌐 Browser Frameworks (React, Angular, Vue)
165
+
166
+ ```javascript
167
+ import { BrainyData } from '@soulcraft/brainy'
168
+
169
+ // SAME CODE in React, Angular, Vue, Svelte, etc.
170
+ const brainy = new BrainyData()
171
+ await brainy.init() // Auto-uses OPFS in browsers
172
+
173
+ // Add entities and relationships
174
+ const john = await brainy.add("John is a software engineer", { type: "person" })
175
+ const jane = await brainy.add("Jane is a data scientist", { type: "person" })
176
+ const ai = await brainy.add("AI Project", { type: "project" })
177
+
178
+ await brainy.relate(john, ai, "works_on")
179
+ await brainy.relate(jane, ai, "leads")
180
+
181
+ // Search by meaning
182
+ const engineers = await brainy.search("software developers", 5)
183
+
184
+ // Traverse relationships
185
+ const team = await brainy.getVerbsByTarget(ai) // Who works on AI Project?
186
+ ```
187
+
188
+ <details>
189
+ <summary>πŸ“¦ <strong>Full React Component Example</strong></summary>
190
+
191
+ ```jsx
192
+ import { BrainyData } from '@soulcraft/brainy'
193
+ import { useEffect, useState } from 'react'
194
+
195
+ function Search() {
196
+ const [brainy, setBrainy] = useState(null)
197
+ const [results, setResults] = useState([])
198
+
199
+ useEffect(() => {
200
+ const init = async () => {
201
+ const db = new BrainyData()
202
+ await db.init()
203
+ // Add your data...
204
+ setBrainy(db)
205
+ }
206
+ init()
207
+ }, [])
208
+
209
+ const search = async (query) => {
210
+ const results = await brainy?.search(query, 5) || []
211
+ setResults(results)
212
+ }
213
+
214
+ return <input onChange={(e) => search(e.target.value)} placeholder="Search..." />
215
+ }
216
+ ```
217
+
218
+ </details>
219
+
220
+ <details>
221
+ <summary>πŸ“¦ <strong>Full Angular Component Example</strong></summary>
222
+
223
+ ```typescript
224
+ import { Component, signal, OnInit } from '@angular/core'
225
+ import { BrainyData } from '@soulcraft/brainy'
226
+
227
+ @Component({
228
+ selector: 'app-search',
229
+ template: `<input (input)="search($event.target.value)" placeholder="Search...">`
230
+ })
231
+ export class SearchComponent implements OnInit {
232
+ brainy = new BrainyData()
233
+
234
+ async ngOnInit() {
235
+ await this.brainy.init()
236
+ // Add your data...
237
+ }
238
+
239
+ async search(query: string) {
240
+ const results = await this.brainy.search(query, 5)
241
+ // Display results...
242
+ }
243
+ }
244
+ ```
245
+
246
+ </details>
247
+
248
+ <details>
249
+ <summary>πŸ“¦ <strong>Full Vue Example</strong></summary>
250
+
251
+ ```vue
252
+ <script setup>
253
+ import { BrainyData } from '@soulcraft/brainy'
254
+ import { ref, onMounted } from 'vue'
255
+
256
+ const brainy = ref(null)
257
+ const results = ref([])
258
+
259
+ onMounted(async () => {
260
+ const db = new BrainyData()
261
+ await db.init()
262
+ // Add your data...
263
+ brainy.value = db
264
+ })
265
+
266
+ const search = async (query) => {
267
+ const results = await brainy.value?.search(query, 5) || []
268
+ setResults(results)
269
+ }
270
+ </script>
271
+
272
+ <template>
273
+ <input @input="search($event.target.value)" placeholder="Search..." />
274
+ </template>
275
+ ```
276
+
277
+ </details>
278
+
279
+ ### 🟒 Node.js / Serverless / Edge
280
+
97
281
  ```javascript
98
- // This EXACT code works in ALL environments
99
282
  import { BrainyData } from '@soulcraft/brainy'
100
283
 
284
+ // SAME CODE works in Node.js, Vercel, Netlify, Cloudflare Workers, Deno, Bun
101
285
  const brainy = new BrainyData()
102
- await brainy.init()
286
+ await brainy.init() // Auto-detects environment and optimizes
287
+
288
+ // Add entities and relationships
289
+ await brainy.add("Python is great for data science", { type: "fact" })
290
+ await brainy.add("JavaScript rules the web", { type: "fact" })
103
291
 
104
- // Works in: React, Vue, Angular, Node.js, Deno, Bun,
105
- // Cloudflare Workers, Vercel Edge, AWS Lambda, browsers, anywhere
292
+ // Search by meaning
293
+ const results = await brainy.search("programming languages", 5)
294
+
295
+ // Optional: Production with S3/R2 storage (auto-detected in cloud environments)
296
+ const productionBrainy = new BrainyData({
297
+ storage: {
298
+ s3Storage: { bucketName: process.env.BUCKET_NAME }
299
+ }
300
+ })
106
301
  ```
107
302
 
303
+ **That's it! Same code, everywhere. Zero-to-Smartβ„’**
304
+
108
305
  Brainy automatically detects and optimizes for your environment:
109
306
 
110
307
  | Environment | Storage | Optimization |
@@ -114,6 +311,44 @@ Brainy automatically detects and optimizes for your environment:
114
311
  | ⚑ Serverless | S3 / Memory | Cold Start Optimization |
115
312
  | πŸ”₯ Edge | Memory / KV | Minimal Footprint |
116
313
 
314
+ ## 🌐 Distributed Mode (NEW!)
315
+
316
+ **Scale horizontally with zero configuration!** Brainy now supports distributed deployments with automatic coordination:
317
+
318
+ - **🌐 Multi-Instance Coordination** - Multiple readers and writers working in harmony
319
+ - **🏷️ Smart Domain Detection** - Automatically categorizes data (medical, legal, product, etc.)
320
+ - **πŸ“Š Real-Time Health Monitoring** - Track performance across all instances
321
+ - **πŸ”„ Automatic Role Optimization** - Readers optimize for cache, writers for throughput
322
+ - **πŸ—‚οΈ Intelligent Partitioning** - Hash-based partitioning for perfect load distribution
323
+
324
+ ```javascript
325
+ // Writer Instance - Ingests data from multiple sources
326
+ const writer = new BrainyData({
327
+ storage: { s3Storage: { bucketName: 'my-bucket' } },
328
+ distributed: { role: 'writer' } // Explicit role for safety
329
+ })
330
+
331
+ // Reader Instance - Optimized for search queries
332
+ const reader = new BrainyData({
333
+ storage: { s3Storage: { bucketName: 'my-bucket' } },
334
+ distributed: { role: 'reader' } // 80% memory for cache
335
+ })
336
+
337
+ // Data automatically gets domain tags
338
+ await writer.add("Patient shows symptoms of...", {
339
+ diagnosis: "flu" // Auto-tagged as 'medical' domain
340
+ })
341
+
342
+ // Domain-aware search across all partitions
343
+ const results = await reader.search("medical symptoms", 10, {
344
+ filter: { domain: 'medical' } // Only search medical data
345
+ })
346
+
347
+ // Monitor health across all instances
348
+ const health = reader.getHealthStatus()
349
+ console.log(`Instance ${health.instanceId}: ${health.status}`)
350
+ ```
351
+
117
352
  ## πŸ†š Why Not Just Use...?
118
353
 
119
354
  ### vs. Multiple Databases
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "0.51.0",
3
+ "version": "0.51.1",
4
4
  "description": "A vector graph database using HNSW indexing with Origin Private File System storage",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",