Metadata-Version: 2.4
Name: fastapi-server-kit
Version: 0.2.0
Summary: A production-grade FastAPI template with support for PostgreSQL, SQLite, and MySQL.
Author-email: atnatewoshw <icodeyt21@gmail.com>
License: MIT
Keywords: asyncio,fastapi,mysql,postgresql,sqlite,starter-template
Classifier: Framework :: FastAPI
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
Requires-Dist: aiomysql>=0.3.2
Requires-Dist: asyncpg>=0.31.0
Requires-Dist: fastapi[standard]>=0.129.2
Requires-Dist: pydantic-settings>=2.13.1
Requires-Dist: pytest>=9.0.2
Requires-Dist: python-dotenv>=1.2.1
Requires-Dist: questionary>=2.0.1
Requires-Dist: sqlalchemy>=2.0.46
Description-Content-Type: text/markdown

# FastAPI Server Kit

A production-grade FastAPI template and toolkit with support for PostgreSQL (Sync/Async), SQLite (Async), and MySQL (Async). Built for speed, scalability, and clean architecture.

## Features

- **Multi-Database Support**: Easily switch between SQLite, PostgreSQL, and MySQL.
- **SQLAlchemy 2.0 (Async)**: Modern ORM patterns with centralized session management.
- **Clean Architecture**: Organized into Core, Models, Repositories, Services, and Routers.
- **Alembic Migrations**: Ready-to-use async migration setup.
- **Environment Management**: Robust configuration using `pydantic-settings`.

## Installation & Quick Start

The easiest way to start a new project is to use `uvx`. No installation or pre-existing project is required.

```bash
# In an empty directory, run:
uvx fastapi-server-kit
```

This single command will trigger an **interactive setup**:
1.  **Project Name**: Choose your own folder name.
2.  **Database Selection**: Choose between **SQLite**, **PostgreSQL**, or **MySQL**.
3.  **Auto-Initialization**: The tool runs `uv sync` to set up your `.venv`.
4.  **Instant Start**: The FastAPI server launches immediately.

### CLI Flags (Automation)
For non-interactive use or CI/CD:
```bash
uvx fastapi-server-kit my-app --db postgres --no-input
```

### Alternative Installation
If you want to add the kit as a dependency to an existing project:

```bash
uv add fastapi-server-kit
```

## Manual Setup
If you prefer to clone the repository or use it as a template:

```bash
git clone https://github.com/atnatewoshw/fastapi-starter-template
cd fastapi-starter-template/server
```

### 2. Configure Environment
Create and configure your `.env` file from `.env_example`:

```bash
cp .env_example .env
```

### 3. Install Dependencies
```bash
uv sync
```

### 4. Running Locally
```bash
uv run uvicorn app.main:app --reload
```

## Project Structure

The kit follows a clean, modular directory layout:

```text
server/
├── app/
│   ├── core/          # Configuration and security
│   ├── models/        # SQLAlchemy models
│   ├── repositories/  # Data access layer
│   ├── routers/       # API endpoints
│   ├── schemas/       # Pydantic models
│   └── services/      # Business logic
├── tests/             # Unit and integration tests
├── cli.py             # Scaffolding CLI logic
└── pyproject.toml     # Project dependencies
```

## Database Migrations

Initialize your database:
```bash
uv run alembic upgrade head
```

Create a new migration:
```bash
uv run alembic revision --autogenerate -m "description"
```

## License

This project is licensed under the MIT License.
