Metadata-Version: 2.4
Name: pratham-backend
Version: 0.2.1
Summary: Scaffold a FastAPI + SQLAlchemy backend boilerplate in seconds
Project-URL: Homepage, https://github.com/prathamdmehta/pratham-backend
Project-URL: Repository, https://github.com/prathamdmehta/pratham-backend
Author: Pratham
License-Expression: MIT
Keywords: backend,boilerplate,cli,fastapi,scaffold,sqlalchemy
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.10
Requires-Dist: jinja2>=3.1
Requires-Dist: typer>=0.12
Description-Content-Type: text/markdown

# pratham-backend

A CLI that generates a ready-to-code FastAPI + SQLAlchemy + SQLite
backend project — folders, DB session wiring, an example CRUD
resource, and tests — so you can skip straight to writing business
logic instead of rebuilding the same plumbing every time.

## Install & use

```bash
# one-off, no permanent install (like npx)
uvx pratham-backend init "My API"

# or install it properly
pip install pratham-backend
pratham-backend init "My API"
```

This creates a `my_api/` folder with a working FastAPI app.

## Optional: authentication

Add `--auth` to generate a full JWT + Google OAuth auth module alongside
the base project:

```bash
pratham-backend init "My API" --auth
```

This adds:
- Repository pattern (`app/repositories/`) — generic `BaseRepository` + `UserRepository`
- Service layer (`app/services/auth_service.py`) — registration, login, JWT issuance, Google token exchange
- Validation — Pydantic schemas with real constraints (email format, password length)
- Centralized error handling (`app/core/exceptions.py`) — every error returns the same `{"error_code", "detail"}` shape
- Routes: `POST /auth/register`, `POST /auth/login`, `GET /auth/me` (protected), `GET /auth/google/login`, `GET /auth/google/callback`

Without `--auth`, none of this is included — the base project stays
auth-free.

## Local development

```bash
cd pratham-backend
pip install -e . --break-system-packages   # editable install
pratham-backend init "Demo Project"
pratham-backend init "Demo Project Auth" --auth
```
