Production-ready, open-source FastAPI application with PostgreSQL and blazing-fast full-text search.
This project provides a scalable API backend using FastAPI and PostgreSQL, featuring:
- Automatic full-text search on all text fields (via tsvector)
- Endpoints for health checks, product management, prompt handling, and prospect management
- Efficient ingestion and processing of large CSV files
- Python 3.11+
- FastAPI — Modern, high-performance REST API
- PostgreSQL — Robust relational database
- tsvector + GIN — Superfast full-text search
- Uvicorn — Lightning-fast ASGI server
- Pytest — Comprehensive testing
git clone <repo-url>
cd python
cp .env.sample .env # Add your Postgres credentials and settings
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtuvicorn app.main:app --reloadVisit localhost:8000 or onrender
FastAPI auto-generates interactive docs:
The prospects table includes a search_vector column (type: tsvector) computed from all text fields on insert/update. A GIN index enables fast, scalable full-text search:
SELECT * FROM prospects WHERE search_vector @@ plainto_tsquery('english', 'search terms');How it works:
- On every insert/update,
search_vectoris computed using PostgreSQL'sto_tsvector('english', ...). - The GIN index (
idx_prospects_search_vector) enables efficient search across large datasets.
The /prospects/process endpoint supports robust ingestion of large CSVs (e.g., 1300+ rows, 300KB+), following the same normalization and insertion pattern as /prospects/seed but optimized for scale.
Contributions welcome. Please open issues or submit pull requests.
This project is licensed under the MIT License. See LICENSE for details.