| Crates.io | memista |
| lib.rs | memista |
| version | 0.1.0 |
| created_at | 2025-08-21 14:50:58.697733+00 |
| updated_at | 2025-08-21 14:50:58.697733+00 |
| description | High-performance vector search service with SQLite metadata storage and USearch vector indexing |
| homepage | https://github.com/sokratis-xyz/memista |
| repository | https://github.com/sokratis-xyz/memista |
| max_upload_size | |
| id | 1804928 |
| size | 168,718 |
Memista is a high-performance vector search library that combines SQLite for metadata storage with USearch for efficient vector similarity search. It provides both a library interface for embedding in Rust applications and a standalone HTTP server.
database_id partitioningAdd this to your Cargo.toml:
[dependencies]
memista = "0.1"
To install and run Memista as a standalone server:
# Clone the repository
git clone https://github.com/your-repo/memista.git
cd memista
# Build and run the application
cargo run
# Or build and install it
cargo build --release
./target/release/memista
The server will start on http://127.0.0.1:8083 by default.
You can also install it directly from crates.io:
cargo install memista
memista
use memista::{AppState, Config, create_app, insert_chunk, search};
use async_sqlite::{PoolBuilder, JournalMode};
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a database pool
let db_pool = PoolBuilder::new()
.path("memista.db")
.journal_mode(JournalMode::Wal)
.open()
.await?;
// Create application state
let app_state = Arc::new(AppState { db_pool });
// Insert some data
let insert_request = memista::InsertChunkRequest {
database_id: "my_database".to_string(),
chunks: vec![memista::ChunkData {
embedding: vec![0.1, 2.0],
text: "Hello, world!".to_string(),
metadata: "{\"source\": \"example\"}".to_string(),
}],
};
// You would typically call the insert_chunk function through the web API
// or integrate it directly into your application logic
Ok(())
}
use memista::{AppState, Config, create_app};
use async_sqlite::{PoolBuilder, JournalMode};
use actix_web::HttpServer;
use std::sync::Arc;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
// Load configuration
let config = Config::from_env().expect("Failed to load configuration");
// Create a database pool
let db_pool = PoolBuilder::new()
.path(&config.database_path)
.journal_mode(JournalMode::Wal)
.open()
.await
.expect("Failed to create database pool");
// Create application state
let app_state = Arc::new(AppState { db_pool });
// Start the HTTP server
let bind_address = format!("{}:{}", config.server_host, config.server_port);
HttpServer::new(move || {
create_app(app_state.clone())
})
.bind(bind_address)?
.run()
.await
}
The repository includes several examples demonstrating different ways to use Memista:
examples/basic_usage.rs)examples/library_usage.rs)examples/advanced_usage.rs)examples/http_client.rs)To run any example:
cargo run --example example_name
See the examples/README.md for more details on each example.
Memista provides a RESTful HTTP API for vector search operations:
Insert text chunks with their embeddings into a specified database.
curl -X POST http://localhost:8083/v1/insert \
-H \"Content-Type: application/json\" \
-d '{
\"database_id\": \"my_db\",
\"chunks\": [{
\"embedding\": [0.1, 0.2],
\"text\": \"Sample text\",
\"metadata\": \"{\\\"source\\\": \\\"document1\\\"}\"
}]
}'
Search for similar chunks using vector embeddings.
curl -X POST http://localhost:8083/v1/search \
-H \"Content-Type: application/json\" \
-d '{
\"database_id\": \"my_db\",
\"embeddings\": [[0.1, 0.2]],
\"num_results\": 5
}'
Drop a specific database and its associated vector index.
curl -X DELETE http://localhost:8083/v1/drop \
-H \"Content-Type: application/json\" \
-d '{
\"database_id\": \"my_db\"
}'
The service can be configured using environment variables:
| Variable | Description | Default |
|---|---|---|
DATABASE_PATH |
Path to SQLite database file | memista.db |
SERVER_HOST |
Host address to bind to | 127.0.0.1 |
SERVER_PORT |
Port to listen on | 8083 |
LOG_LEVEL |
Logging level (debug, info, warn, error) | info |
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request.