apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: web-phoenix
  title: Elixir — Phoenix (full-stack with LiveView)
  description: |
    Full-stack Elixir web app on Bandit (default web server) with
    Phoenix conventions, Ecto persistence, and LiveView as the
    default interactive tier. Reach for channels only when LiveView
    is not the shape of the problem.
  tags:
    - elixir
    - web
    - phoenix
    - liveview
  links:
    - url: https://hexdocs.pm/phoenix/
      title: Phoenix
    - url: https://hexdocs.pm/phoenix_live_view/
      title: Phoenix LiveView
    - url: https://hexdocs.pm/bandit/
      title: Bandit
    - url: https://hexdocs.pm/oban/
      title: Oban
spec:
  owner: abp
  type: website
  parameters:
    - title: Stack Configuration
      required:
        - database
        - liveview
      properties:
        backend:
          title: Backend
          type: string
          const: phoenix
        frontend:
          title: Frontend
          type: string
          const: server-rendered-templates
          description: |
            Phoenix templates with LiveView when enabled. For a
            separate JS frontend pair with frontend-spa and treat
            this template as the API.
        liveview:
          title: LiveView
          type: string
          enum:
            - enabled
            - disabled
          enumNames:
            - 'Enabled — interactive UI by default'
            - 'Disabled — API + plain templates only'
        database:
          title: Database
          type: string
          enum:
            - postgres
            - sqlite
            - mysql
          enumNames:
            - 'Postgres — Phoenix default'
            - 'SQLite'
            - 'MySQL'
        background_jobs:
          title: Background Jobs
          type: string
          default: oban
          enum:
            - oban
            - none
          enumNames:
            - 'Oban — Postgres-backed jobs'
            - 'None'
        auth:
          title: Authentication
          type: string
          default: phoenix-gen-auth
          enum:
            - phoenix-gen-auth
            - guardian
            - none
          enumNames:
            - 'phx.gen.auth — Phoenix native session-based generator'
            - 'Guardian — JWT-based'
            - 'None'
        observability:
          title: Observability
          type: string
          default: telemetry
          enum:
            - telemetry
            - opentelemetry
            - none
          enumNames:
            - 'Telemetry — Phoenix-native event metrics'
            - 'OpenTelemetry'
            - 'None'
  tooling:
    package_manager: mix
    language_flavor: elixir
    test_runner: exunit
    lint_format: mix-format
    runtime_cli: mix-phx
  smoke_test: |
    GET / returns 200 with the Phoenix welcome page. One
    Phoenix.ConnTest test asserts the status and response body.
  switch_when: |
    Truly minimal API with no LiveView / templates / mailers →
    api-plug-bandit.
