Metadata-Version: 2.4
Name: inifastapi
Version: 0.1.1
Summary: A reusable FastAPI project initializer with production-oriented templates.
Author: Haoyue
License: MIT
Requires-Python: ==3.12.10
Requires-Dist: jinja2>=3.1.6
Requires-Dist: typer>=0.24.1
Description-Content-Type: text/markdown

# inifastapi

`inifastapi` is a reusable FastAPI project initializer. It generates a stronger personal FastAPI engineering template around a fixed layout: `app/`, `app/api/v1/`, `app/config/`, `app/schemas/`, `app/services/`, `app/utils/`, plus top-level `dockers/`, `scripts/`, `tests/`, `logs/`, and optional `alembic/`.

## Requirements

`uv` must be installed on the machine. The scaffold uses `uv` both to run the CLI and to bootstrap the generated FastAPI project.

## Usage

You do not need to install `inifastapi` first if it has been published. The recommended one-off command is:

```bash
uvx inifastapi init
uvx inifastapi init my-service
```

More examples:

```bash
uvx inifastapi init my-service --with-database --with-auth
uvx inifastapi init my-service --with-task-queue --with-ci --ci-provider github
```

`init` runs as an interactive wizard. If you pass `my-service`, it is used as the prefilled project name; the wizard still lets you confirm the project name, target directory, application title, description, and feature flags. The generated package is always `app`, and the project always uses the fixed non-`src` layout above. Database, auth, cache, task queue, Docker, and CI are all selectable in the wizard, and the generated project bootstraps the matching dependencies with `uv`.

## Published Package

If `inifastapi` is available on PyPI, prefer `uvx` for one-off usage:

```bash
uvx inifastapi init
uvx inifastapi init my-service
```

This downloads and runs the scaffold temporarily. It does not add `inifastapi` to the generated project's dependencies.

## Local Development

If you are working from this repository before publishing, use the local environment:

```bash
uv sync --group dev
uv run inifastapi init
uv run inifastapi init my-service
```

You can also run the local source tree without installing it globally:

```bash
uvx --from . inifastapi init
uvx --from . inifastapi init my-service
```

## Install

If you want a persistent local development environment for the scaffold itself:

```bash
uv sync --group dev
```

## Features

- Auto-registered routers from `app/api/v1/`
- `pydantic-settings` configuration
- Lifespan-aware app factory in `app/utils/build_app.py`
- Request logging and security middleware
- File + console logging with noise control in `app/utils/logging.py`
- Service-oriented layout under `app/services/`
- Root `run.py`, `dockers/`, `scripts/`, `tests/`, and `logs/`
- Optional PostgreSQL + SQLAlchemy + Alembic
- Optional JWT auth service with password hashing and demo user bootstrap
- Optional Redis cache skeleton
- Optional Celery + RabbitMQ skeleton
- Optional Docker and CI templates
- `uv`-managed `pyproject.toml`, `uv.lock`, and `.venv`

## Development

```bash
uv run python -m pytest
```
