Database Operations
Initialize the database, add sample data, or clear all data.
A lightweight but powerful graph & vector data platform for AI applications across any environment
Explore all of Brainy's powerful capabilities in this interactive demo:
Run Brainy in a browser, container, serverless cloud service or the terminal!
Find semantically similar content using embeddings (like having ESP for your data!)
Connect data with meaningful relationships (your data's social network)
Process data in real-time as it flows through the system (like a data waterslide!)
Customize and extend functionality with pluggable components (LEGO blocks for your data!)
Sync and scale across instances with WebSocket and WebRTC (your data's teleportation system!)
Use TensorFlow.js for high-quality embeddings (included as a required dependency)
Automatically optimizes for your environment and usage patterns
Works everywhere you do: browsers, Node.js, and server environments
Data persists across sessions and scales to any size (no memory loss here!)
Fully typed API with generics (for those who like their code tidy)
Powerful command-line interface for data management (command line wizardry)
Interactive graph and vector space visualizations
Easy deployment to Google, AWS, Azure, and other cloud platforms
import {BrainyData, NounType, VerbType} from '@soulcraft/brainy'
// Create and initialize the database
const db = new BrainyData()
await db.init()
// Add data (automatically converted to vectors)
const catId = await db.add("Cats are independent pets", {
noun: NounType.Thing,
category: 'animal'
})
const dogId = await db.add("Dogs are loyal companions", {
noun: NounType.Thing,
category: 'animal'
})
// Search for similar items
const results = await db.searchText("feline pets", 2)
console.log(results)
// Returns items similar to "feline pets" with similarity scores
// Add a relationship between items
await db.addVerb(catId, dogId, {
verb: VerbType.RelatedTo,
description: 'Both are common household pets'
})
You can import the browser-optimized version in two ways:
// Import the browser-optimized version
import {BrainyData, NounType, VerbType} from '@soulcraft/brainy/browser'
// Use the same API as in Node.js
const db = new BrainyData()
await db.init()
// ...
<script type="module">
// Import Brainy library directly as a module
import {BrainyData, NounType, VerbType} from '../node_modules/@soulcraft/brainy/dist/brainy.js'
// Use the same API as in Node.js
const db = new BrainyData()
await db.init()
// ...
</script>
Modern bundlers like Webpack, Rollup, and Vite will automatically select the browser-optimized version when targeting browser environments.
This interactive demo allows you to experiment with all of Brainy's features. Initialize the database, add data, create relationships, and perform searches - all with real-time visualizations.
Initialize the database, add sample data, or clear all data.
Create entities (nouns), define relationships (verbs), and manage your data schema.
Perform semantic searches using vector embeddings and similarity matching.
Interactive visualizations of your graph data and vector spaces.
Simulate CLI commands and explore Brainy's command-line interface.
Explore specific features and capabilities of Brainy with guided demonstrations.
Demonstrate fast approximate nearest neighbor search with hierarchical navigable small world graphs.
Show graph traversal algorithms and relationship queries.
Demonstrate automatic text-to-vector conversion and similarity computation.
Show live data synchronization and event streaming capabilities.
Compare different storage options: memory, filesystem, and cloud.
Show type-safe operations and schema validation.