Skip to content

Skelf-Research/memista

Repository files navigation

Memista

A lightweight vector search library for Rust

Crates.io Documentation License Rust Version Status


Memista combines SQLite for metadata storage with USearch for vector similarity search. It's designed for developers who need a simple, self-contained vector search solution without the complexity of dedicated vector databases.

Why Memista?

  • Zero infrastructure - Single binary, no external services required
  • Familiar storage - SQLite for metadata means easy debugging and backups
  • Simple API - REST endpoints that just work
  • Rust library - Embed directly in your application
  • Multi-tenant ready - Isolated databases via database_id

Note: Memista is experimental and best suited for prototypes, small-to-medium datasets, and applications where simplicity matters more than scale.

Quick Start

Install & Run

cargo install memista
memista

Server starts at http://127.0.0.1:8083

Store a vector

curl -X POST http://localhost:8083/v1/insert \
  -H "Content-Type: application/json" \
  -d '{
    "database_id": "my_app",
    "chunks": [{
      "embedding": [0.1, 0.2],
      "text": "Hello world",
      "metadata": "{\"source\": \"readme\"}"
    }]
  }'

Search for similar vectors

curl -X POST http://localhost:8083/v1/search \
  -H "Content-Type: application/json" \
  -d '{
    "database_id": "my_app",
    "embeddings": [[0.1, 0.2]],
    "num_results": 5
  }'

Use as a Library

Add to your Cargo.toml:

[dependencies]
memista = "0.1"
use memista::{AppState, ChunkData, InsertChunkRequest};
use async_sqlite::{PoolBuilder, JournalMode};
use std::sync::Arc;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let db_pool = PoolBuilder::new()
        .path("memista.db")
        .journal_mode(JournalMode::Wal)
        .open()
        .await?;

    let app_state = Arc::new(AppState { db_pool });

    // Now use app_state with Memista's functions
    Ok(())
}

API Endpoints

Endpoint Method Description
/v1/insert POST Store chunks with embeddings
/v1/search POST Find similar chunks
/v1/drop DELETE Remove a database
/openapi.json GET OpenAPI specification
/swagger-ui/ GET Interactive API docs

Configuration

# Environment variables (or use .env file)
DATABASE_PATH=memista.db    # SQLite file location
SERVER_HOST=127.0.0.1       # Bind address
SERVER_PORT=8083            # Listen port
LOG_LEVEL=info              # debug|info|warn|error

Project Structure

memista/
├── src/                    # Core library and server
├── examples/               # Usage examples
├── benchmarks/             # Performance scripts
├── documentation/          # MkDocs site
├── scripts/                # Dev utilities
└── config/                 # Sample configurations

Examples

cargo run --example basic_usage      # Start server programmatically
cargo run --example library_usage    # Direct library usage
cargo run --example advanced_usage   # Document processing pipeline
cargo run --example http_client      # HTTP client demo

Documentation

Local docs:

cd documentation && pip install -r requirements.txt && mkdocs serve

Limitations

Be aware of these constraints:

  • Embedding dimensions: Currently hardcoded to 2D (demo purposes)
  • Scale: Not tested beyond ~100k vectors
  • Persistence: Index rebuilds on dimension changes
  • No auth: Add a reverse proxy for production

Contributing

Contributions welcome! This is an experimental project, so:

  1. Open an issue first for major changes
  2. Keep PRs focused and small
  3. Add tests for new functionality

License

GPL-3.0 - Free to use, modify, and distribute with same license.


Built with SQLite + USearch + Actix-web