All guides
EngineeringOutline · expanding soon
Building a Sales Pipeline with FastAPI, PostgreSQL, and APScheduler
Architectural notes from building Cold Scout — the open-source AI lead generation pipeline — with FastAPI, async SQLAlchemy, PostgreSQL, and APScheduler.
5 min readBy Samrat Kumar Das
Cold Scout's backend is a useful reference architecture for anyone building an async data pipeline: FastAPI for the HTTP surface, async SQLAlchemy for DB I/O, APScheduler for background jobs, and Pydantic everywhere for the contract.
Why each piece
- FastAPI — async-first, OpenAPI spec for free, dependency injection that maps cleanly to per-request DB sessions.
- SQLAlchemy 2.x async — the only Python ORM that's caught up with async cleanly. Use the imperative
select()style, not the ORM-implicit lazy-load pattern. - PostgreSQL — JSONB for the lead enrichment blobs, full relational for everything else.
- APScheduler — cron-style jobs in-process. Enough scale for most freelancer/agency workloads. Graduate to Celery + Redis if you outgrow it.
This article is a stub
The full version walks through the actual repo structure, the workers, the retry logic, and the migrations strategy. Coming soon.