| Crates.io | zoey-storage-sql |
| lib.rs | zoey-storage-sql |
| version | 0.1.1 |
| created_at | 2026-01-09 23:57:02.597008+00 |
| updated_at | 2026-01-09 23:57:02.597008+00 |
| description | SQL database adapters (PostgreSQL, SQLite) for ZoeyAI |
| homepage | |
| repository | https://github.com/Agent-Zoey/Zoey.git |
| max_upload_size | |
| id | 2033189 |
| size | 352,619 |
Always watching over your data
SQL storage adapters for ZoeyAI
SQLite and PostgreSQL implementations of the IDatabaseAdapter trait from zoey-core. The default choice for most deployments.
Add to your Cargo.toml:
[dependencies]
zoey-core = "0.1"
zoey-storage-sql = "0.1"
use zoey_core::{AgentRuntime, RuntimeOpts, IDatabaseAdapter};
use zoey_storage_sql::SqliteAdapter;
use std::sync::Arc;
#[tokio::main]
async fn main() -> zoey_core::Result<()> {
// In-memory database
let mut adapter = SqliteAdapter::new(":memory:");
// Or file-based
// let mut adapter = SqliteAdapter::new("./zoey.db");
adapter.init().await?;
let opts = RuntimeOpts::default()
.with_adapter(Arc::new(adapter));
let runtime = AgentRuntime::new(opts).await?;
Ok(())
}
use zoey_core::{AgentRuntime, RuntimeOpts, IDatabaseAdapter};
use zoey_storage_sql::PostgresAdapter;
use std::sync::Arc;
#[tokio::main]
async fn main() -> zoey_core::Result<()> {
let mut adapter = PostgresAdapter::new(
"postgres://user:password@localhost:5432/zoey"
);
adapter.init().await?;
let opts = RuntimeOpts::default()
.with_adapter(Arc::new(adapter));
let runtime = AgentRuntime::new(opts).await?;
Ok(())
}
# SQLite
ZOEY_DB_PATH=./zoey.db
# PostgreSQL
DATABASE_URL=postgres://user:password@localhost:5432/zoey
let adapter = PostgresAdapter::new_with_pool_size(
"postgres://localhost/zoey",
max_connections: 10,
);
-- Enable pgvector (run once)
CREATE EXTENSION IF NOT EXISTS vector;
SQLite uses a simple cosine similarity implementation for vector search. For production vector workloads, consider PostgreSQL with pgvector or zoey-storage-vector.
| Scenario | Recommended |
|---|---|
| Local development | SQLite |
| Edge/embedded deployment | SQLite |
| Production web service | PostgreSQL |
| High-volume vector search | PostgreSQL + pgvector |
| Serverless | Supabase or SQLite |
| Crate | Description |
|---|---|
zoey-core |
Core runtime and IDatabaseAdapter trait |
zoey-storage-mongo |
MongoDB adapter |
zoey-storage-supabase |
Supabase adapter |
zoey-storage-vector |
Local vector storage |
MIT License - See LICENSE for details.
ð Your secrets are safe with Zoey