Retrieval-Augmented Generation pipeline: FastAPI backend with LangChain + Zvec (in-process vector DB) + OpenAI, plus a Next.js frontend you can wire up to the API.
backend/ # FastAPI + LangChain + Zvec API (Poetry)
frontend/ # Next.js app scaffold (Bun)
- Configure environment:
cp env.example .env- Set
OPENAI_API_KEY(and other values as needed).
- Run with Docker Compose:
docker-compose up --build
- Docs:
http://localhost:8000/docs
- Install with uv (recommended):
uv sync
- Or with pip:
pip install -e .
- Configure environment:
cp env.example .env- Set
OPENAI_API_KEY(and other values as needed).
- Run:
uvicorn app.main:app --reload- Or with uv:
uv run uvicorn app.main:app --reload
- Docs:
http://localhost:8000/docs
- Install (requires Bun):
cd frontendbun install
- Run dev server:
bun dev
- Point the UI to the backend API (default
http://localhost:8000); update env/config in the frontend as you build features.
APP_NAME/APP_DESCRIPTION: Shown in FastAPI docs.OPENAI_API_KEY,OPENAI_API_BASE,OPENAI_MODEL,OPENAI_EMBEDDING_MODEL: OpenAI credentials/models.ZVEC_DATABASE,ZVEC_COLLECTION_NAME: Zvec collection path and name.EMBEDDING_DIMENSION: Vector size (default 1536 fortext-embedding-3-small).DATA_DIRECTORY: Where uploaded/source documents are stored.
GET /health: Health check.POST /upload: Upload a document to be chunked and indexed into Zvec.POST /chat: Retrieval + generation over indexed docs.
- Zvec collection:
backend/data/zvec/<ZVEC_COLLECTION_NAME> - Uploaded/source docs:
backend/data/documents
- Zvec supports Linux (x86_64, ARM64) and macOS (ARM64) only. On Windows, run the backend in WSL or Docker.
- Keep your secrets in
backend/.env(ignored by git). - Defaults in code can be overridden via
.env. Align app metadata there as needed.