Skip to main content

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, each userId you provide gets isolated memory storage:

Database Schema

Here’s how isolation is enforced at the database level:
Every query automatically includes both identifiers:
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:
Result: Alice and Bob’s memories are completely separate, even though they use the same API key (your tenant).

Example 2: Multi-Tenant SaaS

You’re building a SaaS where each company gets their own account:
Result: Company A and Company B’s data is completely isolated at the tenant level, and their users are isolated within each tenant.
In a multi-tenant SaaS, each company should have their own API key. Don’t share API keys across companies.

User ID Best Practices

Use IDs from your authentication system (Auth0, Clerk, Firebase, etc.):
Each user must have a unique identifier:
If you have multiple contexts per user, use namespaced IDs:
Keep a record of how you generate user IDs for consistency:

Security Considerations

API Key Security

Always use API keys on the server:

User ID Validation

Always validate user IDs before using them:
Never trust user IDs from client requests. Always verify the user’s identity through your authentication system.

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