diff --git a/docs/src/pages/docs/reference/storage/_meta.ts b/docs/src/pages/docs/reference/storage/_meta.ts
index 1a7657893a..e15c3221d3 100644
--- a/docs/src/pages/docs/reference/storage/_meta.ts
+++ b/docs/src/pages/docs/reference/storage/_meta.ts
@@ -1,5 +1,7 @@
const meta = {
- "mastra-storage": "Mastra Storage",
+ libsql: "LibSQL Storage",
+ postgresql: "PostgreSQL Storage",
+ upstash: "Upstash Storage",
};
export default meta;
diff --git a/docs/src/pages/docs/reference/storage/libsql.mdx b/docs/src/pages/docs/reference/storage/libsql.mdx
new file mode 100644
index 0000000000..19f72a1a7b
--- /dev/null
+++ b/docs/src/pages/docs/reference/storage/libsql.mdx
@@ -0,0 +1,69 @@
+---
+title: "LibSQL Storage | Storage System | Mastra Core"
+description: Documentation for the LibSQL storage implementation in Mastra.
+---
+
+# LibSQL Storage
+
+The LibSQL storage implementation provides a SQLite-compatible storage solution that can run both in-memory and as a persistent database.
+
+## Installation
+
+```bash
+npm install @mastra/storage-libsql
+```
+
+## Usage
+
+```typescript copy showLineNumbers
+import { LibSQLStorage } from "@mastra/storage-libsql";
+
+// In-memory database (development)
+const storage = new LibSQLStorage({
+ url: "file::memory:?cache=shared"
+});
+
+// Persistent database (production)
+const storage = new LibSQLStorage({
+ url: process.env.DATABASE_URL
+});
+```
+
+## Parameters
+
+
+
+## Additional Notes
+
+### In-Memory vs Persistent Storage
+
+The in-memory configuration (`file::memory:?cache=shared`) is useful for:
+- Development and testing
+- Temporary storage that doesn't need to persist
+- Quick prototyping
+
+For production use cases, use a persistent database URL:
+- Local file: `file:local.db`
+- Remote LibSQL: `libsql://your-database.turso.io`
+
+### Schema Management
+
+The storage implementation handles schema creation and updates automatically. It creates the following tables:
+- `threads`: Stores conversation threads
+- `messages`: Stores individual messages
+- `metadata`: Stores additional metadata for threads and messages
diff --git a/docs/src/pages/docs/reference/storage/mastra-storage.mdx b/docs/src/pages/docs/reference/storage/mastra-storage.mdx
deleted file mode 100644
index fb392030fe..0000000000
--- a/docs/src/pages/docs/reference/storage/mastra-storage.mdx
+++ /dev/null
@@ -1,286 +0,0 @@
----
-title: "MastraStorage Class Reference | Storage System | Mastra Core"
-description: Documentation for the MastraStorage class, the core interface for managing persistent data storage in Mastra applications.
----
-
-# MastraStorage
-
-The MastraStorage class provides a unified interface for persistent storage operations in Mastra applications. It handles storage of workflow states, conversation threads, messages, and evaluation data.
-
-## Constructor Options
-
-
-
-## Core Tables
-
-The storage system manages four primary tables:
-
-
-
-
-## Methods
-
-",
- description: "Initialize storage tables and connections",
- },
- {
- name: "createTable(options)",
- type: "Promise",
- description: "Create a new table with specified schema",
- options: [
- {
- name: "tableName",
- type: "TABLE_NAMES",
- description: "Name of the table to create",
- },
- {
- name: "schema",
- type: "Record",
- description: "Schema definition for the table columns",
- }
- ],
- },
- {
- name: "clearTable(options)",
- type: "Promise",
- description: "Clear all data from a table",
- options: [
- {
- name: "tableName",
- type: "TABLE_NAMES",
- description: "Name of the table to clear",
- }
- ],
- },
- {
- name: "insert(options)",
- type: "Promise",
- description: "Insert a record into a table",
- options: [
- {
- name: "tableName",
- type: "TABLE_NAMES",
- description: "Target table name",
- },
- {
- name: "record",
- type: "Record",
- description: "Record data to insert",
- }
- ],
- },
- {
- name: "load(options)",
- type: "Promise",
- description: "Load a record from a table",
- options: [
- {
- name: "tableName",
- type: "TABLE_NAMES",
- description: "Source table name",
- },
- {
- name: "keys",
- type: "Record",
- description: "Key-value pairs to identify the record",
- }
- ],
- },
- {
- name: "getThreadById(options)",
- type: "Promise",
- description: "Retrieve a thread by its ID",
- options: [
- {
- name: "threadId",
- type: "string",
- description: "ID of the thread to retrieve",
- }
- ],
- },
- {
- name: "saveThread(options)",
- type: "Promise",
- description: "Save or update a thread",
- options: [
- {
- name: "thread",
- type: "StorageThreadType",
- description: "Thread data to save",
- }
- ],
- },
- {
- name: "deleteThread(options)",
- type: "Promise",
- description: "Delete a thread and its messages",
- options: [
- {
- name: "id",
- type: "string",
- description: "ID of the thread to delete",
- }
- ],
- },
- {
- name: "getMessages(options)",
- type: "Promise",
- description: "Get all messages for a thread",
- options: [
- {
- name: "threadId",
- type: "string",
- description: "ID of the thread to get messages for",
- }
- ],
- },
- {
- name: "saveMessages(options)",
- type: "Promise",
- description: "Save multiple messages",
- options: [
- {
- name: "messages",
- type: "MessageType[]",
- description: "Array of messages to save",
- }
- ],
- },
- {
- name: "persistWorkflowSnapshot(options)",
- type: "Promise",
- description: "Save a workflow snapshot",
- options: [
- {
- name: "workflowName",
- type: "string",
- description: "Name of the workflow",
- },
- {
- name: "runId",
- type: "string",
- description: "ID of the workflow run",
- },
- {
- name: "snapshot",
- type: "WorkflowRunState",
- description: "Workflow snapshot data",
- }
- ],
- },
- {
- name: "loadWorkflowSnapshot(options)",
- type: "Promise",
- description: "Load a workflow snapshot",
- options: [
- {
- name: "workflowName",
- type: "string",
- description: "Name of the workflow",
- },
- {
- name: "runId",
- type: "string",
- description: "ID of the workflow run",
- }
- ],
- },
- ]}
-/>
-
-## Types
-
-### StorageColumn
-
-Defines the schema for table columns:
-
-```typescript
-interface StorageColumn {
- type: 'text' | 'timestamp';
- primaryKey?: boolean;
- nullable?: boolean;
-}
-```
-
-### StorageThreadType
-
-Represents a conversation thread:
-
-```typescript
-interface StorageThreadType {
- id: string;
- title: string;
- metadata: Record;
- createdAt: Date;
- updatedAt: Date;
-}
-```
-
-## Example Usage
-
-```typescript copy filename=src/storage/index.ts
-import { MastraStorage } from "@mastra/core";
-
-class MyStorage extends MastraStorage {
- constructor() {
- super({ name: 'my-storage' });
- }
-
- async init() {
- // Initialize tables and set up connections
- await this.createTable({
- tableName: 'threads',
- schema: {
- id: { type: 'text', primaryKey: true },
- title: { type: 'text' },
- metadata: { type: 'text' },
- created_at: { type: 'timestamp' },
- updated_at: { type: 'timestamp' },
- }
- });
- }
-
- // Implement other abstract methods...
-}
-
-const storage = new MyStorage();
-await storage.init();
-```
-
-For a concrete implementation, see the `MastraStorageLibSql` class which provides a SQLite-based storage solution.
diff --git a/docs/src/pages/docs/reference/storage/postgresql.mdx b/docs/src/pages/docs/reference/storage/postgresql.mdx
new file mode 100644
index 0000000000..196551d1d8
--- /dev/null
+++ b/docs/src/pages/docs/reference/storage/postgresql.mdx
@@ -0,0 +1,86 @@
+---
+title: "PostgreSQL Storage | Storage System | Mastra Core"
+description: Documentation for the PostgreSQL storage implementation in Mastra.
+---
+
+# PostgreSQL Storage
+
+The PostgreSQL storage implementation provides a production-ready storage solution using PostgreSQL databases.
+
+## Installation
+
+```bash
+npm install @mastra/storage-pg
+```
+
+## Usage
+
+```typescript copy showLineNumbers
+import { PostgresStorage } from "@mastra/storage-pg";
+
+const storage = new PostgresStorage({
+ connectionString: process.env.DATABASE_URL,
+ // Optional: Configure connection pool
+ pool: {
+ max: 20,
+ idleTimeoutMillis: 30000
+ }
+});
+```
+
+## Parameters
+
+
+
+## Additional Notes
+
+### Connection Pooling
+
+The PostgreSQL storage implementation uses connection pooling to manage database connections efficiently. The pool configuration allows you to:
+- Control the maximum number of concurrent connections
+- Set idle connection timeout
+- Manage connection lifecycle
+
+### Schema Management
+
+The storage implementation handles schema creation and updates automatically. It creates the following tables:
+- `threads`: Stores conversation threads
+- `messages`: Stores individual messages
+- `metadata`: Stores additional metadata for threads and messages
+
+### Production Considerations
+
+For production deployments:
+- Use SSL connections for security
+- Configure appropriate pool sizes based on your workload
+- Monitor connection usage and pool metrics
+- Set up proper database backups and maintenance
diff --git a/docs/src/pages/docs/reference/storage/upstash.mdx b/docs/src/pages/docs/reference/storage/upstash.mdx
new file mode 100644
index 0000000000..cda3d75890
--- /dev/null
+++ b/docs/src/pages/docs/reference/storage/upstash.mdx
@@ -0,0 +1,82 @@
+---
+title: "Upstash Storage | Storage System | Mastra Core"
+description: Documentation for the Upstash storage implementation in Mastra.
+---
+
+# Upstash Storage
+
+The Upstash storage implementation provides a serverless-friendly storage solution using Upstash's Redis-compatible key-value store.
+
+## Installation
+
+```bash
+npm install @mastra/storage-upstash
+```
+
+## Usage
+
+```typescript copy showLineNumbers
+import { UpstashStorage } from "@mastra/storage-upstash";
+
+const storage = new UpstashStorage({
+ url: process.env.UPSTASH_URL,
+ token: process.env.UPSTASH_TOKEN
+});
+```
+
+## Parameters
+
+
+
+## Additional Notes
+
+### Key Structure
+
+The Upstash storage implementation uses a key-value structure:
+- Thread keys: `{prefix}thread:{threadId}`
+- Message keys: `{prefix}message:{messageId}`
+- Metadata keys: `{prefix}metadata:{entityId}`
+
+### Serverless Benefits
+
+Upstash storage is particularly well-suited for serverless deployments:
+- No connection management needed
+- Pay-per-request pricing
+- Global replication options
+- Edge-compatible
+
+### Data Persistence
+
+Upstash provides:
+- Automatic data persistence
+- Point-in-time recovery
+- Cross-region replication options
+
+### Performance Considerations
+
+For optimal performance:
+- Use appropriate key prefixes to organize data
+- Monitor Redis memory usage
+- Consider data expiration policies if needed