{"id":16309527,"url":"https://github.com/golbin/imvectordb","last_synced_at":"2025-08-26T03:17:38.531Z","repository":{"id":193546986,"uuid":"689046577","full_name":"golbin/imvectordb","owner":"golbin","description":"Super simple in-memory vector DB for Node.js","archived":false,"fork":false,"pushed_at":"2023-09-10T03:27:42.000Z","size":88,"stargazers_count":37,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-22T12:41:50.749Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/golbin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2023-09-08T17:05:43.000Z","updated_at":"2024-04-22T12:41:50.750Z","dependencies_parsed_at":"2024-10-10T21:21:38.005Z","dependency_job_id":"d13c1f45-ae8a-4ed1-866d-0cf4e40ace0a","html_url":"https://github.com/golbin/imvectordb","commit_stats":null,"previous_names":["golbin/imvectordb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golbin%2Fimvectordb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golbin%2Fimvectordb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golbin%2Fimvectordb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golbin%2Fimvectordb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/golbin","download_url":"https://codeload.github.com/golbin/imvectordb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244084989,"owners_count":20395522,"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-10-10T21:21:36.539Z","updated_at":"2025-03-20T21:31:45.834Z","avatar_url":"https://github.com/golbin.png","language":"TypeScript","funding_links":[],"categories":["SDKs \u0026 Libraries"],"sub_categories":[],"readme":"# In-memory VectorDB\n\nSuper simple and easy-to-use in-memory vector DB for Node.js\n\nPerfect for quickly building prototypes or small-scale applications in Node.js.\n\nWith a compressed (ZIP) file size of just 3KB.\n\n## Installation\n\n```sh\nnpm install imvectordb\n```\n\n## Usage\n\nEasily integrate it into your project with just a few lines of code:\n\n```typescript\nimport { VectorDB } from 'imvectordb';\n\nconst db = new VectorDB();\n\ndb.addText(\"text for semantic search\")\n// ...add additional text as needed\n\ndb.queryText(\"text to search\")\n```\n\nThis library automatically uses OpenAI's \"text-embedding-ada-002\" model for embedding, so you'll need to set the `OPENAI_API_KEY` environment variable.\n\nYou can also add documents to the database using your own embedding models.\n\nHere's a complete guide:\n\n```typescript\nimport { VectorDB } from 'imvectordb';\n\nconst db = new VectorDB();\n\n// Add a new document to the database\ndb.add({\n    id: \"1\",\n    embedding: [0.014970540, ...],\n    metadata: {\n        text: \"original text\",\n        ... // additional metadata\n    }\n})\n\n// Perform a search and retrieve the top 10 similar documents\nconst queryVector = [0.014970540, ...]\nconst searchResults = await db.query(queryVector, 10)\n\n// Access search result details\nsearchResults[0].similarity\nsearchResults[0].document.id\nsearchResults[0].document.embedding\nsearchResults[0].document.metadata.text\n\n// Retrieve or delete a document by its ID\ndb.get(\"1\")\ndb.del(\"1\")\n\n// Save to or load from a file\ndb.dumpFile(\"filename.json\")\ndb.loadFile(\"filename.json\")\n\n// Terminate the Worker when it's no longer needed or when the server closes\ndb.terminate()\n```\n\nFor more examples, please check the \"samples\" folder and the available types.\n\n## Performance\n\nUse up to 10,000 documents; going over is not recommended. A few thousand is ideal.\n\nThere's significant room for performance improvement. Patches and PRs are welcome.\n\n```\nMachine: MackBook Air M2\nDimensions: 1,536 (text-embedding-ada)\n\n----------\nSearch in 100 documents, 10 times.\n----------\nTotal: 57.577ms\nAverage: 5.758ms\n\n----------\nSearch in 1000 documents, 10 times.\n----------\nTotal: 541.979ms\nAverage: 54.198ms\n\n----------\nSearch in 10000 documents, 10 times.\n----------\nTotal: 13430.621ms\nAverage: 1343.062ms\n```\n\n## Family\n\n- [LLM Chunk](https://github.com/golbin/llm-chunk)\n  - Super simple and easy-to-use text splitter for Node.js\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolbin%2Fimvectordb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgolbin%2Fimvectordb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolbin%2Fimvectordb/lists"}