2026-02-19 17:04:05 -08:00
|
|
|
---
|
|
|
|
|
title: Installation
|
|
|
|
|
slug: getting-started/installation
|
|
|
|
|
public: true
|
|
|
|
|
category: getting-started
|
|
|
|
|
template: guide
|
|
|
|
|
order: 1
|
2026-06-11 14:51:00 -07:00
|
|
|
description: Install Brainy with npm, bun, yarn, or pnpm. Works in Node.js 22+ and Bun 1.0+ (server-only since 8.0). TypeScript included.
|
2026-02-19 17:04:05 -08:00
|
|
|
next:
|
|
|
|
|
- getting-started/quick-start
|
2026-06-11 14:51:00 -07:00
|
|
|
- guides/storage-adapters
|
2026-02-19 17:04:05 -08:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Installation
|
|
|
|
|
|
|
|
|
|
## Requirements
|
|
|
|
|
|
|
|
|
|
- **Node.js 22+** or **Bun 1.0+**
|
|
|
|
|
- TypeScript is optional — Brainy ships with full type definitions
|
|
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
npm install @soulcraft/brainy
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Or with your preferred package manager:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
bun add @soulcraft/brainy
|
|
|
|
|
yarn add @soulcraft/brainy
|
|
|
|
|
pnpm add @soulcraft/brainy
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Verify
|
|
|
|
|
|
2026-02-19 17:46:18 -08:00
|
|
|
```typescript
|
2026-02-19 17:04:05 -08:00
|
|
|
import { Brainy } from '@soulcraft/brainy'
|
|
|
|
|
|
|
|
|
|
const brain = new Brainy()
|
|
|
|
|
await brain.init()
|
|
|
|
|
|
|
|
|
|
console.log('Brainy ready.')
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Native Acceleration (Optional)
|
|
|
|
|
|
refactor(8.0)!: remove orphaned zero-config subsystem + dead cloud/progressive-init storage vestige
The old config-generation subsystem (src/config/ + autoConfiguration.ts) was
superseded during the 8.0 rework and never wired into init(): it emitted settings
for a partitioning subsystem that no longer exists and probed deleted cloud env
vars. The live zero-config path is inline — recall preset → HNSW knobs, storage
auto-detect, auto persistMode, container-memory-aware cache sizing.
The storage progressive-init / cloud-detection cluster was equally dead after the
cloud adapters were dropped: isCloudStorage() is permanently false (no overriders),
scheduleBackgroundInit/runBackgroundInit were never called (the latter an empty
body), initMode was never assigned, and Brainy.isFullyInitialized()/
awaitBackgroundInit() were always-trivial with zero callers. scheduleCountPersist()
collapses to its only-ever-taken immediate write-through path.
Removed:
- src/config/{index,zeroConfig,storageAutoConfig,modelAutoConfig,sharedConfigManager}.ts
- src/utils/autoConfiguration.ts + the inert BrainyZeroConfig export
- Brainy.isFullyInitialized()/awaitBackgroundInit() (+ BrainyInterface decls)
- InitMode type, isCloudStorage/detectCloudEnvironment/resolveInitMode,
scheduleBackgroundInit/runBackgroundInit/ensureValidatedForWrite and their state
- Dead cloud env-var probes (K_SERVICE/K_REVISION/AWS_LAMBDA_FUNCTION_NAME/
FUNCTIONS_TARGET/AZURE_FUNCTIONS_ENVIRONMENT)
Kept (verified live): production-detection logging (environment.ts), container-
memory cache sizing (memoryDetection/paramValidation), on-disk hash bucketing
(sharding.ts).
Docs: scrubbed deleted-subsystem references (JS quantization knobs, cloud/OPFS
adapters, partitioning, old zero-config API) across 14 files; deleted two wholly-
obsolete feature docs (complete-feature-list, v3-features); rewrote
architecture/zero-config for 8.0.
~3,700 LOC removed. Build clean; 1392 unit + 24 db-mvcc green.
2026-06-15 11:11:21 -07:00
|
|
|
For production workloads, add Cortex for Rust-accelerated SIMD distance calculations and native embeddings:
|
2026-02-19 17:04:05 -08:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
npm install @soulcraft/cortex
|
|
|
|
|
```
|
|
|
|
|
|
2026-02-19 17:46:18 -08:00
|
|
|
```typescript
|
2026-02-19 17:04:05 -08:00
|
|
|
import { Brainy } from '@soulcraft/brainy'
|
|
|
|
|
|
2026-06-11 14:51:00 -07:00
|
|
|
const brain = new Brainy({ plugins: ['@soulcraft/cortex'] })
|
|
|
|
|
await brain.init() // native providers registered during init
|
2026-02-19 17:04:05 -08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Cortex delivers a **5.2x geometric mean speedup** — see [Brainy vs Cortex](/docs/cortex/comparison) for measured benchmarks.
|
|
|
|
|
|
2026-06-11 14:51:00 -07:00
|
|
|
## Server-only since 8.0
|
2026-02-19 17:04:05 -08:00
|
|
|
|
2026-06-11 14:51:00 -07:00
|
|
|
Brainy 8.0 runs on Node.js 22+ and Bun 1.0+. Browser support (OPFS storage,
|
|
|
|
|
Web Workers, in-browser WASM embeddings) was removed in 8.0 — the 7.x line
|
|
|
|
|
remains available on npm if you need it.
|
2026-02-19 17:04:05 -08:00
|
|
|
|
|
|
|
|
## TypeScript
|
|
|
|
|
|
|
|
|
|
Brainy ships with full TypeScript types. No `@types/` package needed:
|
|
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
|
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
|
|
|
|
|
|
|
|
|
const brain = new Brainy()
|
|
|
|
|
await brain.init()
|
|
|
|
|
|
|
|
|
|
const id = await brain.add({
|
|
|
|
|
data: 'Hello, Brainy',
|
|
|
|
|
type: NounType.Concept,
|
|
|
|
|
metadata: { created: Date.now() }
|
|
|
|
|
})
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Next Steps
|
|
|
|
|
|
|
|
|
|
- [Quick Start](/docs/getting-started/quick-start) — build your first knowledge graph in 60 seconds
|
|
|
|
|
- [Storage Adapters](/docs/guides/storage-adapters) — choose the right storage for your deployment
|