apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: api-plug-bandit
  title: Elixir — Plug + Bandit (lightweight)
  description: |
    Minimal Elixir HTTP service: Plug routing on Bandit (pure-Elixir,
    async-friendly, WebSocket-native web server). Pick this for
    very small APIs or middleware-focused services where Phoenix
    would be overkill.
  tags:
    - elixir
    - lightweight-api
    - plug
    - bandit
  links:
    - url: https://hexdocs.pm/plug/
      title: Plug
    - url: https://hexdocs.pm/bandit/
      title: Bandit
    - url: https://hexdocs.pm/mix/
      title: Mix
    - url: https://hexdocs.pm/ecto/
      title: Ecto
spec:
  owner: abp
  type: service
  parameters:
    - title: Stack Configuration
      required:
        - database
      properties:
        backend:
          title: Backend
          type: string
          const: plug-bandit
        frontend:
          title: Frontend
          type: string
          const: api-only
        database:
          title: Database
          type: string
          enum:
            - postgres
            - sqlite
            - mysql
            - none
          enumNames:
            - 'Postgres — default'
            - 'SQLite'
            - 'MySQL'
            - 'None — stateless service'
        persistence:
          title: Persistence Library
          type: string
          default: ecto
          enum:
            - ecto
            - none
          enumNames:
            - 'Ecto — database wrapper + query DSL'
            - 'None — raw DB driver'
        background_jobs:
          title: Background Jobs
          type: string
          default: none
          enum:
            - none
            - oban
          enumNames:
            - 'None'
            - 'Oban — Postgres-backed jobs'
        auth:
          title: Authentication
          type: string
          default: none
          enum:
            - none
            - guardian
          enumNames:
            - 'None'
            - 'Guardian — JWT-based'
        observability:
          title: Observability
          type: string
          default: none
          enum:
            - none
            - opentelemetry
          enumNames:
            - 'None'
            - 'OpenTelemetry'
  tooling:
    package_manager: mix
    language_flavor: elixir
    test_runner: exunit
    lint_format: mix-format
    runtime_cli: mix
  smoke_test: |
    GET /health returns 200. One ExUnit test uses Plug.Test to
    invoke the router and asserts the response.
  switch_when: |
    Need full-stack web / LiveView / channels / mailers / asset
    pipeline / production conventions → web-phoenix.
