{"id":13875907,"url":"https://github.com/not-pizza/victor","last_synced_at":"2025-07-16T10:32:13.008Z","repository":{"id":192336681,"uuid":"677815836","full_name":"not-pizza/victor","owner":"not-pizza","description":"Web-optimized vector database (written in Rust).","archived":false,"fork":false,"pushed_at":"2024-06-24T08:21:17.000Z","size":3871,"stargazers_count":187,"open_issues_count":18,"forks_count":8,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-11-08T15:54:33.174Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/not-pizza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-08-12T18:18:07.000Z","updated_at":"2024-11-02T17:38:30.000Z","dependencies_parsed_at":"2024-01-13T19:40:01.026Z","dependency_job_id":"916d1806-8012-4457-a75f-635092ad294d","html_url":"https://github.com/not-pizza/victor","commit_stats":null,"previous_names":["not-pizza/victor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/not-pizza%2Fvictor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/not-pizza%2Fvictor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/not-pizza%2Fvictor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/not-pizza%2Fvictor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/not-pizza","download_url":"https://codeload.github.com/not-pizza/victor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226122303,"owners_count":17576920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T06:00:49.444Z","updated_at":"2025-07-16T10:32:12.942Z","avatar_url":"https://github.com/not-pizza.png","language":"Rust","funding_links":[],"categories":["Rust","others","Embedded Vector Databases"],"sub_categories":[],"readme":"## Victor\n\nWeb-optimized vector database (written in Rust).\n\n## Features\n\n1. Rust API (using native filesystem, or a transient in-memory filesystem)\n2. Web API (Using the [Private Origin File System](https://web.dev/origin-private-file-system/))\n3. Very efficient vector storage format\n   1. For a vector with 1536 dimensions, our representation consumes 1.5 KB, while naively encoding with JSON would consume 20.6 KB.\n4. PCA for vector compression when storage space is low\n\n\n## JS Example\n\n#### Installation\n\n```\nnpm install victor-db\n```\n\n#### Usage\n\n```ts\nimport { Db } from \"victor\";\n\nconst db = await Db.new();\n\nconst content = \"My content!\";\nconst tags = [\"these\", \"are\", \"tags\"];\nconst embedding = new Float64Array(/* your embedding here */);\n\n// write to victor\nawait db.insert(content, embedding, tags);\n\n// read the 10 closest results from victor that are tagged with \"tags\"\n// (only 1 will be returned because we only inserted one embedding)\nconst result = await db.search(embedding, [\"tags\"], 10);\nassert(result[0].content == content);\n\n// clear database\nawait db.clear();\n```\n\nSee `www/` for a more complete example, including fetching embeddings from OpenAI.\n\n## Rust Example\n\n#### Installation\n\n```\ncargo add victor-db\n```\n\n#### Usage\n\nThe Rust API can automatically create embeddings for you with [fastembed-rs](https://github.com/anush008/fastembed-rs?tab=readme-ov-file)'s default model (currently [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5)).\n\n```rust\nuse std::path::PathBuf;\n\nuse victor_db::native::Db;\n\nlet _ = std::fs::create_dir(\"./victor_test_data\");\nlet mut victor = Db::new(PathBuf::from(\"./victor_test_data\"));\n\nvictor.clear_db().await.unwrap();\n\nvictor\n    .add(\n        vec![\"Pineapple\", \"Rocks\"], // documents\n        vec![\"Pizza Toppings\"],     // tags (only used for filtering)\n    )\n    .await;\n\nvictor\n    .add_single(\"Cheese pizza\", vec![\"Pizza Flavors\"])\n    .await; // Add another entry with no tags\n\n// read the 10 closest results from victor that are tagged with \"Pizza Toppings\"\n// (only 2 will be returned because we only inserted two embeddings)\nlet nearest = victor\n    .search(\"Hawaiian pizza\", vec![\"Pizza Toppings\"], 10)\n    .await\n    .first()\n    .unwrap()\n    .content\n    .clone();\nassert_eq!(nearest, \"Pineapple\".to_string());\n```\n\nThis example is also in the `/examples` directory. If you've cloned this repository, you can run it with `cargo run --example native_filesystem`.\n\n## Hacking\n\n1. Victor is written in Rust, and compiled to wasm with wasm-pack.\n\n   **Install wasm** pack with `cargo install wasm-pack` or `npm i -g wasm-pack`\n   (https://rustwasm.github.io/wasm-pack/installer/)\n\n2. **Build Victor** with `wasm-pack build --target web`\n\n3. **Set up the example project**, which is in `www/`.\n\n   If you use nvm, you can just run `cd www/ \u0026\u0026 nvm use`\n\n   Then, `npm i`.\n\n4. From `www/`, start the example project with `npm run start`.\n\n## Architecture\n\nRelevant code at `src/packed_vector.rs`.\n\n![Packed vector storage explanation](./assets/packed_vector_storage.png)\n\n---\n\n![File structure explanation](assets/file_structure.png)\n\n## Us\n\n[Sam Hall](https://twitter.com/Shmall27)\n\n[Andre Popovitch](https://twitter.com/ChadNauseam)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnot-pizza%2Fvictor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnot-pizza%2Fvictor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnot-pizza%2Fvictor/lists"}