Metadata-Version: 2.4
Name: backcraft-engine
Version: 3.2.6
Summary: Enterprise Grade FastAPI Generator with AI-powered business logic injection
Author: Backcraft Team
License: MIT
Project-URL: Homepage, https://github.com/backcraft/backcraft-engine
Project-URL: Documentation, https://backcraft.readthedocs.io
Project-URL: Repository, https://github.com/backcraft/backcraft-engine
Project-URL: Issues, https://github.com/backcraft/backcraft-engine/issues
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi
Requires-Dist: uvicorn[standard]
Requires-Dist: pydantic>=2.0
Requires-Dist: pydantic-settings
Requires-Dist: sqlalchemy>=2.0
Requires-Dist: alembic
Requires-Dist: asyncpg
Requires-Dist: psycopg2-binary
Requires-Dist: redis
Requires-Dist: aiofiles
Requires-Dist: openai
Requires-Dist: anthropic
Requires-Dist: langchain
Requires-Dist: tiktoken
Requires-Dist: typer[all]<0.13.0,>=0.9.0
Requires-Dist: rich>=13.0.0
Requires-Dist: click<8.2.0,>=8.1.0
Requires-Dist: prompt-toolkit
Requires-Dist: colorama
Requires-Dist: jinja2
Requires-Dist: inflect
Requires-Dist: black
Requires-Dist: isort
Requires-Dist: autopep8
Requires-Dist: ruff
Requires-Dist: mypy
Requires-Dist: bandit
Requires-Dist: safety
Requires-Dist: pre-commit
Requires-Dist: pytest-watch
Requires-Dist: pytest
Requires-Dist: pytest-asyncio
Requires-Dist: aiosqlite
Requires-Dist: faker
Requires-Dist: pyyaml
Requires-Dist: orjson
Requires-Dist: httpx
Requires-Dist: aiohttp
Requires-Dist: python-jose[cryptography]
Requires-Dist: passlib[bcrypt]
Requires-Dist: bcrypt<4.1
Requires-Dist: python-multipart
Requires-Dist: sendgrid
Requires-Dist: emails
Requires-Dist: aiosmtplib
Requires-Dist: celery[redis]
Requires-Dist: prometheus-client
Requires-Dist: prometheus-fastapi-instrumentator
Requires-Dist: sentry-sdk[fastapi]
Requires-Dist: structlog
Requires-Dist: slowapi
Requires-Dist: python-dotenv
Requires-Dist: pytz
Requires-Dist: pendulum
Requires-Dist: inflect
Requires-Dist: inflection
Requires-Dist: email-validator
Requires-Dist: phonenumbers
Requires-Dist: gunicorn
Requires-Dist: websockets
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: stripe
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: bandit; extra == "dev"
Requires-Dist: safety; extra == "dev"
Dynamic: license-file

# Backcraft

**Enterprise-grade FastAPI project generator with AI-powered business logic injection.**

Backcraft turns a project description — a natural-language prompt, an interactive
wizard, or a canvas file — into a complete, working FastAPI backend: SQLAlchemy
models with real relationships, Alembic migrations, JWT authentication, CRUD
routes, tests, Docker/Kubernetes manifests, and optional integrations (Stripe
payments, Celery task queues, Prometheus/Grafana monitoring). With AI business
logic injection enabled (the default), Claude fills in real validation rules,
workflows, and domain logic instead of leaving `# TODO` stubs.

## Requirements

- Python 3.9+
- An [Anthropic API key](https://console.anthropic.com/) for AI-powered generation
  (`fullauto`, `chat`, and business logic injection). Not required for `generate`
  with `--no-ai` or `use_business_logic=False`.

## Installation

```bash
pip install backcraft-engine
```

Or from source:

```bash
git clone <this-repository>
cd backcraft-backend
uv sync
```

## Quickstart

Set your Anthropic API key once (stored in `~/.backcraft/credentials`, never in
a project directory):

```bash
backcraft auth
```

Then generate a project from a one-line description:

```bash
backcraft fullauto "A task management API where users can create projects and tasks, with JWT authentication"
```

Backcraft analyzes the description, designs entities and relationships, shows
you a summary, and (after confirmation) generates the full project into
`./generated/<app-name>/`.

## Other ways to build a project

```bash
# Step-by-step interactive wizard (terminal UI)
backcraft builder

# Same wizard, with a browser-based visual canvas (Next.js + React Flow)
backcraft builder --web

# Conversational, multi-turn chat instead of a single prompt
backcraft chat

# Generate directly from an existing canvas file (JSON/YAML)
backcraft generate --canvas my_project.json

# Validate a canvas file or an existing generated project
backcraft validate ./my_project
```

Run `backcraft --help` or `backcraft <command> --help` for the full option list.

## What gets generated

- **Models & migrations**: SQLAlchemy 2.0 models (`Mapped`/`mapped_column`), with
  real `relationship()`/`ForeignKey` wiring for one-to-many, many-to-one, and
  many-to-many relationships, plus Alembic migrations.
- **API**: FastAPI routes and Pydantic schemas per entity, JWT authentication,
  health checks, rate limiting, and (optionally) OAuth2/API-key auth.
- **Tests**: pytest suites (unit, integration, e2e) generated alongside the app.
- **Infrastructure**: Dockerfile, docker-compose (dev/prod), GitHub Actions and
  GitLab CI pipelines, nginx config, deploy/backup scripts.
- **Optional integrations**, enabled per-project via the canvas:
  - Stripe checkout sessions + webhook handling
  - Celery task queue (worker + beat, with a docker-compose service each)
  - Prometheus metrics endpoint + scrape config, Grafana dashboard with
    provisioning
  - Kubernetes manifests (Deployment, Service, Ingress, ConfigMap, Secret, HPA)

## Configuration

Generated projects read their configuration from a `.env` file (see the
generated `.env.example`). Backcraft itself only needs `ANTHROPIC_API_KEY`,
which `backcraft auth` manages for you:

```bash
backcraft auth            # prompt for and store a key
backcraft auth --status   # check whether a key is configured
backcraft auth --clear    # remove the stored key
```

## Development

```bash
uv sync --extra dev

# Run the fast test suite (no API key required)
pytest tests/ -m "not slow and not requires_llm"

# Run the full suite, including the AI-powered generation tests
# (requires ANTHROPIC_API_KEY, calls the real Anthropic API, and is slow)
pytest tests/ -m "requires_llm"

# Lint and format
ruff check src/ && black src/ && isort src/
```

## License

MIT — see [LICENSE](LICENSE).
