LocalStack pgvector Extension 🚀
localstack-extension-pgvector is a professional extension for LocalStack designed to simplify the development of AI-driven applications and Vector Search. This extension automatically enables pgvector on every PostgreSQL instance running in LocalStack and provides a web interface via pgweb.
✨ Key Features
- Auto-Enable pgvector: Automatically executes
CREATE EXTENSION IF NOT EXISTS vector;when a PostgreSQL container starts. - pgweb Integration: Automatically launches a
pgweb(Web UI) instance as a sidecar to visualize your vector data. - Seamless Integration: Supports standard RDS and PostgreSQL instances in LocalStack.
- Health Check Endpoint: Verify extension status via a dedicated HTTP endpoint.
🛠️ Installation
Using LocalStack Dashboard (Recommended)
Click the badge above or open the LocalStack Extensions Dashboard and enter this repository URL:
https://github.com/Nocturnailed-Community/localstack-extension-pgvector
Using CLI
Use the following command to install the extension locally:
localstack extensions install "https://github.com/Nocturnailed-Community/localstack-extension-pgvector"
Local Development (Editable Mode)
- Clone this repository.
- Run:
pip install -e .
- Restart LocalStack.
🐳 Using Docker Compose
For easy local development, you can use the provided docker-compose.yml:
- Start LocalStack:
docker compose up -d
- The extension will be installed automatically. Check status:
curl http://localhost:4566/pgvector-status
🛠️ Usage
- Start LocalStack:
localstack start - Launch PostgreSQL/RDS:
Use AWS CLI or SDK to create a database instance. Example:
awslocal rds create-db-instance --db-instance-identifier mydb --engine postgres --allocated-storage 20
- Access pgweb:
Open your browser and navigate to
http://localhost:8081to view your data. - Check Status:
Verify if the extension is active:
http://localhost:4566/pgvector-status
📡 API Reference (v0.2.0)
All endpoints are accessible via http://localhost:4566/pgvector/...
Status
curl http://localhost:4566/pgvector/status
Table Management
List tables:
curl http://localhost:4566/pgvector/tables
Create a table (with vector column):
curl -X POST http://localhost:4566/pgvector/tables \
-H "Content-Type: application/json" \
-d '{
"table_name": "documents",
"columns": [
{"name": "id", "type": "SERIAL PRIMARY KEY"},
{"name": "content", "type": "TEXT"},
{"name": "embedding", "type": "vector(3)"}
]
}'
Get table schema:
curl http://localhost:4566/pgvector/tables/documents/schema
Drop a table:
curl -X DELETE http://localhost:4566/pgvector/tables/documents
Data Operations
Insert rows:
curl -X POST http://localhost:4566/pgvector/tables/documents/data \
-H "Content-Type: application/json" \
-d '{
"rows": [
{"content": "Hello AI", "embedding": "[1,2,3]"},
{"content": "Vector DB", "embedding": "[4,5,6]"}
]
}'
Get rows (with pagination):
curl "http://localhost:4566/pgvector/tables/documents/data?limit=10&offset=0"
Update rows:
curl -X PUT http://localhost:4566/pgvector/tables/documents/data \
-H "Content-Type: application/json" \
-d '{"set": {"content": "Updated"}, "where": "id = 1"}'
Delete rows:
curl -X DELETE http://localhost:4566/pgvector/tables/documents/data \
-H "Content-Type: application/json" \
-d '{"where": "id = 1"}'
Raw SQL Query
curl -X POST http://localhost:4566/pgvector/query \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT * FROM pg_extension WHERE extname = '\''vector'\'';"}'
🔍 Vector Similarity Search
curl -X POST http://localhost:4566/pgvector/search \
-H "Content-Type: application/json" \
-d '{
"table_name": "documents",
"column": "embedding",
"query_vector": [1, 2, 3],
"distance": "cosine",
"limit": 5
}'
Supported distance metrics: cosine, l2, inner_product
👨💻 Contributors
- Muhammad Ikhwan Fathulloh (@Muhammad-Ikhwan-Fathulloh)
- Email:
muhammadikhwanfathulloh17@gmail.com
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by Noc Lab as part of the LocalStack ecosystem.
Metadata
Release files for localstack-extension-pgvector 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| localstack_extension_pgvector-0.2.0.tar.gz | 6.8 kB | Without provenance | Details for localstack_extension_pgvector-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| localstack_extension_pgvector-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for localstack_extension_pgvector-0.2.0-py3-none-any.whl |
Total release size: 14.6 kB
Release files / localstack_extension_pgvector-0.2.0.tar.gz
| Download URL | localstack_extension_pgvector-0.2.0.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6732826dc22db7ddc7c8077fe5edfe2baeff0309cb4c962c227280c2b42e528
|
|
BLAKE2b-256 checksum How to use checksums |
ae192861bdac141b52ff2e82bcaddcc41244f59a05da0bffff7bea433091c215
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0
|
Release files / localstack_extension_pgvector-0.2.0-py3-none-any.whl
| Download URL | localstack_extension_pgvector-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ec130749c4a21b37179cd6c1a706f7ae5d884837b225e73e3e63d77d3665006
|
|
BLAKE2b-256 checksum How to use checksums |
3fb751c551da7197e544f39e729fbc1f4e1f20badc49588c593c907adaa1e042
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0
|
Security for localstack-extension-pgvector 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.