Warning: This demo must be served over HTTP to work properly. If you're seeing this message or the demo isn't working, please:

1. Open a terminal in the project root directory
2. Run: `npx http-server`
3. Navigate to http://localhost:8080/examples/demo.html

## 🚀 Key Features

Explore all of Brainy's powerful capabilities in this interactive demo:

#### 🏃‍♂️ Run Everywhere

Run Brainy in a browser, container, serverless cloud service or the terminal!

#### 🔍 Vector Search

Find semantically similar content using embeddings (like having ESP for your data!)

#### 🌐 Graph Database

Connect data with meaningful relationships (your data's social network)

#### 🌊 Streaming Pipeline

Process data in real-time as it flows through the system (like a data waterslide!)

#### 🧩 Extensible Augmentations

Customize and extend functionality with pluggable components (LEGO blocks for your data!)

#### 🔌 Built-in Conduits

Sync and scale across instances with WebSocket and WebRTC (your data's teleportation system!)

#### 🤖 TensorFlow Integration

Use TensorFlow.js for high-quality embeddings (included as a required dependency)

#### 🧠 Adaptive Intelligence

Automatically optimizes for your environment and usage patterns

#### 🌍 Cross-Platform

Works everywhere you do: browsers, Node.js, and server environments

#### 💾 Persistent Storage

Data persists across sessions and scales to any size (no memory loss here!)

#### 🔧 TypeScript Support

Fully typed API with generics (for those who like their code tidy)

#### 📱 CLI Tools

Powerful command-line interface for data management (command line wizardry)

#### 📊 Data Visualization

Interactive graph and vector space visualizations

#### ☁️ Cloud Ready

Easy deployment to Google, AWS, Azure, and other cloud platforms

## 🏁 Quick Start

### Node.js Environment

    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'
    })

### Browser Environment

You can import the browser-optimized version in two ways:

#### Option 1: Using the browser-specific import

    // 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()
    // ...

#### Option 2: Using a script tag in HTML

    <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.

## Interactive Brainy Explorer

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.

### Database Operations

Initialize the database, add sample data, or clear all data.

Database not initialized. Click "Initialize Database" to start.
Database visualization will appear here after initialization

### Data Model Management

Create entities (nouns), define relationships (verbs), and manage your data schema.

Noun Type:
ID (optional):
Name:
Description/Content:
Tags (comma-separated):
Verb Type:
Source Noun:
Target Noun:
Relationship Strength (0.0 - 1.0):
Relationship Description:
Entity operations will appear here...

### Vector Search & Semantic Queries

Perform semantic searches using vector embeddings and similarity matching.

Search Query:
Search Type:
Search results will appear here...
Search results visualization

### Data Visualization

Interactive visualizations of your graph data and vector spaces.

Select a visualization type above
Zoom

### CLI Command Interface

Simulate CLI commands and explore Brainy's command-line interface.

brainy$
Available Commands:
brainy init - Initialize a new database
brainy add <data> - Add data to the database
brainy search <query> - Search for entities
brainy relate <from> <to> - Create relationships
brainy export - Export database
brainy status - Show database status
brainy help - Show all commands

### Feature Demonstrations

Explore specific features and capabilities of Brainy with guided demonstrations.

### 🔍 HNSW Vector Search

Demonstrate fast approximate nearest neighbor search with hierarchical navigable small world graphs.

### 🌐 Graph Traversal

Show graph traversal algorithms and relationship queries.

### 🧠 Embedding Pipeline

Demonstrate automatic text-to-vector conversion and similarity computation.

### 📊 Real-time Updates

Show live data synchronization and event streaming capabilities.

### 💾 Storage Backends

Compare different storage options: memory, filesystem, and cloud.

### 🔧 TypeScript Integration

Show type-safe operations and schema validation.

Select a feature above to see a detailed demonstration...