Skip to main content

Enterprise AI backend template generator for FastAPI and RAG systems

Project description

fastapi-rag

fastapi-rag is an installable Python CLI that generates production-grade FastAPI backends for AI applications, RAG systems, internal copilots, and enterprise SaaS platforms.

It is intended to behave like a real developer tool, not a local scaffold script.

What It Does

After installation:

fastapi-rag new myapp
cd myapp
docker compose up --build

The generated project includes:

  • FastAPI application structure
  • JWT authentication
  • SQLAlchemy async setup
  • provider abstractions for DB, cache, queue, LLM, and vector stores
  • RAG ingestion and query pipeline
  • Redis and Celery integration
  • Docker Compose startup
  • health endpoints, metrics, and observability wiring
  • tests and developer docs

Repository Structure

src/fastapi_rag/
├── cli/
│   └── main.py
├── generators/
│   └── project_generator.py
├── renderer/
│   └── jinja_renderer.py
├── templates/
│   └── full_rag/
└── utils/
    └── package_resources.py

Installation

Local development install

pip install -e .

Package build

python -m build

This generates:

  • wheel in dist/*.whl
  • source distribution in dist/*.tar.gz

Install after publishing

pip install fastapi-rag

Quick Start

Generate a new backend:

fastapi-rag new myapp

The CLI will ask for:

  1. project name
  2. LLM provider
  3. vector database
  4. database provider
  5. cache provider

Then it will:

  1. load the packaged template
  2. copy it into ./myapp
  3. render all Jinja variables
  4. output a complete backend project

Run the generated project:

cd myapp
docker compose up --build

Supported Provider Defaults

The packaged template currently supports or models:

  • LLM: echo, openai, ollama
  • Vector DB: qdrant, chroma, pgvector, pinecone
  • Database: postgresql, mysql
  • Cache: redis, dragonfly
  • Queue: celery

Architecture Overview

The generated backend uses a modular architecture with:

  • app/api/
  • app/core/
  • app/db/
  • app/modules/
  • app/providers/
  • app/services/
  • app/workers/

The generator itself is separated from the scaffold so packaging and runtime template access stay reliable after installation.

Package-Safe Template Loading

Templates are loaded with importlib.resources, not fragile relative paths.

That means fastapi-rag can work after:

  • pip install -e .
  • pip install fastapi-rag
  • wheel installation
  • source distribution installation

Development Workflow

Install local dependencies:

pip install -e .[dev]

Run tests:

pytest

Build distributions:

python -m build

Validate package metadata:

twine check dist/*

CI and Release Automation

This repository includes GitHub Actions workflows for:

  • CI test and build verification
  • version and release automation
  • TestPyPI publishing
  • PyPI publishing

Workflows:

  • .github/workflows/ci.yml
  • .github/workflows/release-please.yml
  • .github/workflows/publish-testpypi.yml
  • .github/workflows/publish-pypi.yml

Publishing

Build locally

python -m build

Upload to TestPyPI

twine upload --repository testpypi dist/*

Install from TestPyPI

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple fastapi-rag

Versioning

This repository is configured for conventional commits and release-please.

Expected examples:

  • feat: add anthropic provider prompt option
  • fix: include templates in sdist build
  • docs: improve publishing guide

Release automation updates:

  • version in pyproject.toml
  • release PR
  • git tag
  • GitHub release
  • changelog

Documentation

License

This project is released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_rag-0.1.0.tar.gz (118.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_rag-0.1.0-py3-none-any.whl (179.7 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_rag-0.1.0.tar.gz.

File metadata

  • Download URL: fastapi_rag-0.1.0.tar.gz
  • Upload date:
  • Size: 118.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for fastapi_rag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b59b9fc81530cab0bc8459e502ae2801057aebec86be15d8711ac16e9862362f
MD5 b28dcc90cb97e2af6826a58bfcb0a062
BLAKE2b-256 bc71c7e784c43ec737607ba98f88c34d16a3875895f760e9ba85dfd39e9b8f80

See more details on using hashes here.

File details

Details for the file fastapi_rag-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fastapi_rag-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 179.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for fastapi_rag-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 894e056d414c86fed924ebf01eac228a39af4b2e2023f221c6d29002e9d2b7cc
MD5 ab374e726999de312afc985973d4f897
BLAKE2b-256 563e616b3a61ac6236ccdd5abe13b4e4fda820fc8c511d7d6d3a54e5793f0aa2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page