braintied
v0.1.0
Published
AI memory and conversation SDK with semantic search and embeddings
Downloads
3
Maintainers
Readme
Braintied
"Stripe for AI Brains" - Add intelligent memory and context to your app in 3 lines of code.
What is Braintied?
Braintied is a developer platform that makes it absurdly easy to add AI with memory to any application. Just like Stripe handles payments so you don't have to build a payment processor, Braintied handles intelligent conversation memory so you don't have to build an AI infrastructure.
Features
- Automatic Memory Management - AI automatically extracts and stores important facts
- Smart Context Retrieval - Relevant memories surface in each conversation
- Multi-Brain Architecture - Create different AI agents for different use cases
- Pre-built Components - Drop-in React components and hooks
- Background Processing - Heavy lifting happens asynchronously
- Type-Safe - Full TypeScript support
- Framework Agnostic - Works with Next.js, Express, React Native, etc.
Quick Start
1. Install
npm install braintied2. Get API Key
Sign up at braintied.com and get your API key.
3. Start Using
import BrainSDK from 'braintied';
const brain = new BrainSDK({ apiKey: process.env.BRAIN_API_KEY });
// That's it! Memory and context are automatic
const response = await brain.chat('Hello!', { userId: 'user-123' });Usage Examples
Basic Chat with Memory
import BrainSDK from 'braintied';
const brain = new BrainSDK({ apiKey: process.env.BRAIN_API_KEY });
// First conversation
await brain.chat('My name is Sarah and I love TypeScript', {
userId: 'user-123',
});
// Later conversation - it remembers!
const response = await brain.chat('What do I like?', {
userId: 'user-123',
});
// Response: "You love TypeScript!"React Component
'use client';
import { BrainProvider, ChatInterface } from 'braintied/react';
export default function Page() {
return (
<BrainProvider apiKey={process.env.NEXT_PUBLIC_BRAIN_API_KEY}>
<ChatInterface
userId={user.id}
placeholder="Ask me anything..."
/>
</BrainProvider>
);
}Multiple Brains per Project
const brain = new BrainSDK({ apiKey: process.env.BRAIN_API_KEY });
// Customer support agent
const supportBrain = brain.brain('customer-support');
await supportBrain.chat('How do I reset my password?', { userId: 'user-123' });
// Onboarding assistant
const onboardingBrain = brain.brain('onboarding');
await onboardingBrain.chat('Show me around', { userId: 'user-123' });Manual Memory Management
// Store a memory manually
await brain.remember('user-123', 'User prefers dark mode');
// Get all memories
const memories = await brain.getMemories('user-123');
// Search memories
const results = await brain.getMemories('user-123', {
query: 'preferences',
});
// Forget a specific memory
await brain.forget('user-123', memoryId);
// Forget all memories
await brain.forget('user-123');React Hooks
import { useBrain, useMemory } from 'braintied/react';
function ChatComponent() {
const { messages, input, handleInputChange, handleSubmit, isLoading } = useBrain(
'user-123',
{ brainId: 'customer-support' }
);
return (
<div>
{messages.map(msg => <div key={msg.id}>{msg.content}</div>)}
<form onSubmit={handleSubmit}>
<input value={input} onChange={handleInputChange} />
</form>
</div>
);
}
function MemoryPanel() {
const { memories, remember, forget } = useMemory('user-123');
return (
<div>
{memories.map(m => (
<div key={m.id}>
{m.content}
<button onClick={() => forget(m.id)}>Forget</button>
</div>
))}
</div>
);
}Architecture
Database Schema
- Projects - One per developer/organization
- Brains - Multiple per project (customer support, onboarding, etc.)
- Memories - Semantic memory with vector embeddings
- Conversations - Chat history with auto-summarization
API Endpoints
POST /api/v1/chat- Send a message with automatic memoryGET /api/v1/memory- Get memories for a userPOST /api/v1/memory- Store a memoryDELETE /api/v1/memory- Forget memories
Background Jobs (Inngest)
- Extract memories from conversations
- Store conversation history
- Generate conversation summaries
- Log usage for billing
Tech Stack
- Database: Supabase (PostgreSQL + pgvector)
- AI: Vercel AI SDK (Claude, GPT)
- Background Jobs: Inngest
- Framework: Next.js 15
- Type Safety: TypeScript throughout
Development
Setup
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Add your Supabase credentials and API keys
# Run development server
npm run devEnvironment Variables
# Supabase
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
# Anthropic
ANTHROPIC_API_KEY=your-anthropic-key
# OpenAI (for embeddings)
OPENAI_API_KEY=your-openai-key
# Inngest
INNGEST_EVENT_KEY=your-inngest-keyRoadmap
- [ ] Dashboard for developers to manage projects and brains
- [ ] Analytics and usage metrics
- [ ] Custom tool/function calling support
- [ ] React Native SDK
- [ ] Self-hosted option
- [ ] Multi-modal support (images, files)
- [ ] Stripe integration for billing
Contributing
Contributions welcome! Please read CONTRIBUTING.md first.
License
MIT
