This repository integrates Node.js with pgvector, enabling efficient similarity searches and vector storage in PostgreSQL.
To set up the development environment:
. ./developer_setup.shTo run the application using Docker:
docker-compose up --build- Integration of pgvector for handling vector similarity searches.
- Seamless setup with Docker for streamlined development and testing.
- Easy-to-use developer scripts for local environment setup.
Ensure you have the following installed:
- Node.js (v16 or higher recommended)
- PostgreSQL with the pgvector extension installed
- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/your-repo/node-pgvector.git cd node-pgvector -
Install dependencies:
npm install
-
Start the application using Docker:
docker-compose up --build
-
Alternatively, run locally for development:
. ./developer_setup.sh
This project provides an example integration of pgvector with a Node.js backend. You can use it as a template for applications requiring vector-based data queries.
Ensure your database is configured with the pgvector extension:
CREATE EXTENSION IF NOT EXISTS vector;
You can then store and query vector data, for example:
CREATE TABLE items (
id SERIAL PRIMARY KEY,
embedding VECTOR(3)
);
INSERT INTO items (embedding) VALUES ('[1, 2, 3]');
SELECT * FROM items
ORDER BY embedding <-> '[1, 1, 1]';
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch.
- Submit a pull request with detailed descriptions of your changes.
This project is licensed under the MIT License. See the LICENSE file for details.