|
2 | 2 |
|
3 | 3 |  |
4 | 4 |
|
5 | | -> Production ready, open-source FastAPI application with PostgreSQL and blazing-fast full-text search |
| 5 | +This project is a FastAPI-based backend for collecting, organizing, and serving business data. It brings together PostgreSQL storage, API endpoints, and a few practical automation features such as AI prompt handling, email sending, and data integration with services like GitHub, Flickr, and YouTube. |
6 | 6 |
|
7 | | -#### Overview |
| 7 | +The app is designed to be a reliable backend layer for internal tools, admin workflows, or front-end applications that need structured data and simple API access. |
8 | 8 |
|
9 | | -This project provides a scalable API backend using FastAPI and PostgreSQL, featuring: |
| 9 | +## Table of contents |
10 | 10 |
|
11 | | -- Automatic full-text search on all text fields (via tsvector) |
12 | | -- Endpoints for health checks, product management, prompt handling (via `/prompt`), notify email, and prospect management |
13 | | -- Efficient ingestion and processing of large CSV files |
| 11 | +- [Project overview](docs/overview.md) |
| 12 | +- [Architecture](docs/architecture.md) |
| 13 | +- [Setup and development](docs/setup.md) |
| 14 | +- [API reference](docs/api.md) |
| 15 | +- [Integrations](docs/integrations.md) |
| 16 | +- [Database](docs/database.md) |
| 17 | +- [Testing](docs/testing.md) |
| 18 | +- [Deployment](docs/deployment.md) |
14 | 19 |
|
15 | | -#### Features |
| 20 | +## Quick note |
16 | 21 |
|
17 | | -- **Python 3.11+** |
18 | | -- **FastAPI** — Modern, high-performance REST API |
19 | | -- **PostgreSQL** — Robust relational database |
20 | | -- **tsvector + GIN** — Superfast full-text search |
21 | | -- **Uvicorn** — Lightning-fast ASGI server |
22 | | -- **Pytest** — Comprehensive testing |
| 22 | +If you want to get started, the best place to begin is the [setup guide](docs/setup.md). If you want to understand the system as a whole, start with the [overview](docs/overview.md). |
23 | 23 |
|
24 | | -#### Install & Use |
25 | | - |
26 | | -#### 1. Clone & Setup Environment |
27 | | - |
28 | | -```bash |
29 | | -git clone https://github.com/goldlabelapps/python.git |
30 | | -cd python |
31 | | -cp .env.sample .env # Add your Postgres credentials and settings |
32 | | -python -m venv venv |
33 | | -source venv/bin/activate |
34 | | -pip install -r requirements.txt |
35 | | -``` |
36 | | - |
37 | | -#### 2. Run the App |
38 | | - |
39 | | -```bash |
40 | | -uvicorn app.main:app --reload |
41 | | -``` |
42 | | - |
43 | | -Visit [localhost:8000](http://localhost:8000) or [onrender](https://nx-ai.onrender.com) |
44 | | - |
45 | | -#### API Documentation |
46 | | - |
47 | | -FastAPI auto-generates interactive docs: |
48 | | - |
49 | | -- [Swagger UI](https://nx-ai.onrender.com/docs) |
50 | | -- [ReDoc](https://nx-ai.onrender.com/redoc) |
51 | | - |
52 | | -#### Notable Endpoints |
53 | | - |
54 | | -- `GET /health` — Health check |
55 | | -- `GET /prompt` or `GET /prompts` — Prompt table metadata (`record_count`, `columns`) |
56 | | -- `POST /prompt` — LLM prompt completion (formerly `/llm`) |
57 | | -- `GET/POST /notify/email` — Send email via Resend API (see implementation in `app/api/notify/email.py`) |
58 | | -- `GET /prospects` — Paginated prospects |
59 | | -- `POST /prospects/process` — Bulk CSV ingestion |
60 | | - |
61 | | -#### Full-Text Search (tsvector) |
62 | | - |
63 | | -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: |
64 | | - |
65 | | -```sql |
66 | | -SELECT * FROM prospects WHERE search_vector @@ plainto_tsquery('english', 'search terms'); |
67 | | -``` |
68 | | - |
69 | | -**How it works:** |
70 | | -- On every insert/update, `search_vector` is computed using PostgreSQL's `to_tsvector('english', ...)`. |
71 | | -- The GIN index (`idx_prospects_search_vector`) enables efficient search across large datasets. |
72 | | - |
73 | | -#### Processing Large CSV Files |
74 | | - |
75 | | -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. |
76 | | - |
77 | | -#### Contributing |
78 | | - |
79 | | -Contributions welcome. Please open issues or submit pull requests. |
80 | | - |
81 | | -#### License |
82 | | - |
83 | | -This project is licensed under the MIT License. See [LICENSE](LICENSE) for details. |
| 24 | +Before deployment, make sure the frontend origin is included in `ALLOWED_ORIGINS`; otherwise browser requests from that domain will be rejected by CORS. |
0 commit comments