Overview
Satori implements a robust multi-tenant architecture that ensures complete data isolation between tenants and their end users. This page explains how isolation works and why it matters for your application.Two-Level Isolation Model
Satori uses a hierarchical isolation model with two levels:Level 1: Tenant Isolation (clerkUserId)
Each API key is tied to a specific Clerk user ID (the tenant). All memories created with that key belong to that tenant’s account.Tenants are completely isolated from each other. Developer A can never access Developer B’s data, even if they know the user IDs.
Level 2: User Isolation (userId)
Within your tenant account, eachuserId you provide gets isolated memory storage:
Database Schema
Here’s how isolation is enforced at the database level:It’s impossible to query memories without both identifiers, ensuring complete isolation.
Isolation Guarantees
Tenant Isolation
Guarantee: Tenants can never access each other’s dataEnforced by:
- API key verification
- Database-level filtering
- Automatic query scoping
User Isolation
Guarantee: Users within a tenant can never access each other’s memoriesEnforced by:
- Required userId parameter
- Composite database indexes
- Query-level filtering
Cross-Tenant Protection
Guarantee: Even with a valid userId, cross-tenant access is impossibleEnforced by:
- API key binding to clerkUserId
- Middleware authentication
- Database constraints
Data Encryption
Guarantee: Data is encrypted at rest and in transitEnforced by:
- PostgreSQL encryption
- TLS/HTTPS connections
- Secure key storage
Practical Examples
Example 1: Multi-User Application
You’re building a chat application with 1000 users:Example 2: Multi-Tenant SaaS
You’re building a SaaS where each company gets their own account:User ID Best Practices
Use stable, unique identifiers
Use stable, unique identifiers
Use IDs from your authentication system (Auth0, Clerk, Firebase, etc.):
Consider namespacing for complex scenarios
Consider namespacing for complex scenarios
If you have multiple contexts per user, use namespaced IDs:
Document your user ID strategy
Document your user ID strategy
Keep a record of how you generate user IDs for consistency:
Security Considerations
API Key Security
- Server-Side Only
- Never Client-Side
- Environment Variables
Always use API keys on the server:
User ID Validation
Always validate user IDs before using them:Testing Isolation
Verify isolation in your tests:Compliance and Privacy
Satori’s isolation model helps you comply with privacy regulations:GDPR Compliance
User data is isolated and can be deleted per user with
deleteMemory()Data Residency
Choose your deployment region to comply with data residency requirements
Right to be Forgotten
Delete all memories for a user to fulfill deletion requests
Data Portability
Export all memories for a user with
getAllMemories()Next Steps
Authentication
Learn about API key management
How It Works
Understand the memory lifecycle
Integration Guide
Implement isolation in your app
API Reference
Explore the complete API