Installation
Get Brainy up and running in under a minute.
Package Managers
Install Brainy using your preferred package manager:
npm install @soulcraft/brainy
Verify Installation
Create a simple test file to verify everything works:
test.js
import { Brainy } from '@soulcraft/brainy'
const brain = new Brainy()
await brain.init()
console.log('Brainy is ready!', brain.version)
Run it:
$ node test.js
Brainy is ready! 5.0.0
Brainy is ready! 5.0.0
Environment Support
Brainy runs everywhere JavaScript runs:
| Environment | Status | Storage |
|---|---|---|
| Node.js 18+ | ✓ Full support | File system |
| Browsers (Chrome, Firefox, Safari) | ✓ Full support | OPFS / IndexedDB |
| Deno | ✓ Full support | File system |
| Bun | ✓ Full support | File system |
| Cloudflare Workers | ✓ Full support | R2 / KV |
| AWS Lambda | ✓ Full support | S3 / EFS |
Browser Usage
For browser environments, Brainy uses the Origin Private File System (OPFS) for persistent storage:
app.js
import { Brainy } from '@soulcraft/brainy'
// Brainy auto-detects browser environment
const brain = new Brainy()
await brain.init()
// Data persists across page reloads
await brain.add({ data: "This persists in the browser" })
TypeScript
Brainy includes TypeScript types out of the box. No additional packages needed:
app.ts
import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
const brain = new Brainy()
await brain.init()
// Full type safety and autocomplete
const id = await brain.add({
data: "TypeScript example",
nounType: NounType.Concept,
metadata: { typed: true }
})