apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: api-fastapi
  title: Python — FastAPI
  description: |
    Python services: ML-adjacent work, Python-first teams, API
    backends, or HTMX-style server-rendered apps where the team's
    strength is Python.
  tags:
    - python
    - lightweight-api
    - fastapi
  links:
    - url: https://fastapi.tiangolo.com/
      title: FastAPI
    - url: https://docs.astral.sh/uv/
      title: uv
    - url: https://docs.pytest.org/
      title: pytest
    - url: https://docs.astral.sh/ruff/
      title: ruff
spec:
  owner: abp
  type: service
  parameters:
    - title: Stack Configuration
      required:
        - database
      properties:
        backend:
          title: Backend
          type: string
          const: fastapi
        frontend:
          title: Frontend
          description: |
            For a standalone JS frontend, pair with frontend-spa or
            fullstack-sveltekit and treat this template as the API.
          type: string
          default: none
          enum:
            - none
            - htmx-jinja
            - separate
          enumNames:
            - 'None — API-only with OpenAPI'
            - 'HTMX + Jinja — server-rendered with light interactivity'
            - 'Separate frontend app — name the paired template'
        database:
          title: Database
          type: string
          enum:
            - postgres
            - sqlite
          enumNames:
            - 'Postgres — default for production'
            - 'SQLite — local-first / development'
        background_jobs:
          title: Background Jobs
          type: string
          default: none
          enum:
            - none
            - celery
            - rq
            - arq
          enumNames:
            - 'None'
            - 'Celery — Redis or RabbitMQ broker'
            - 'RQ — Redis-only, simpler'
            - 'arq — asyncio-native'
  tooling:
    package_manager: uv
    language_flavor: python
    type_checker: mypy
    test_runner: pytest
    lint_format: ruff
    runtime_cli: uvicorn
  smoke_test: |
    GET /health returns {"status": "ok"}. One pytest test uses
    FastAPI TestClient and asserts the JSON.
  switch_when: |
    TypeScript-heavy work or Cloudflare-only deployment →
    edge-api-cf-hono. Content site → static-site-astro.
