apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: api-giraffe
  title: F# — Giraffe (lightweight)
  description: |
    Functional F# HTTP API on top of ASP.NET Core. Giraffe gives you
    composable handler functions (Express/Suave-style) over the
    Kestrel server. Pick this for compact F# services that prefer
    function composition over MVC controllers.
  tags:
    - fsharp
    - lightweight-api
    - giraffe
  links:
    - url: https://giraffe.wiki/
      title: Giraffe
    - url: https://fsharp.org/
      title: F#
    - url: https://fsprojects.github.io/fantomas/
      title: Fantomas
    - url: https://github.com/haf/expecto
      title: Expecto
spec:
  owner: abp
  type: service
  parameters:
    - title: Stack Configuration
      required:
        - database
      properties:
        backend:
          title: Backend
          type: string
          const: giraffe
        frontend:
          title: Frontend
          type: string
          const: api-only
        database:
          title: Database
          type: string
          enum:
            - postgres
            - sqlserver
            - sqlite
            - none
          enumNames:
            - 'Postgres — Npgsql provider'
            - 'SQL Server — first-party provider'
            - 'SQLite'
            - 'None — stateless service'
        persistence:
          title: Persistence
          type: string
          default: dapper
          enum:
            - dapper
            - sqlhydra
            - ef-core
            - none
          enumNames:
            - 'Dapper — micro-ORM, hand-written SQL'
            - 'SqlHydra — F#-native typed query DSL'
            - 'Entity Framework Core — full ORM'
            - 'None — raw ADO.NET'
        background_jobs:
          title: Background Jobs
          type: string
          default: hosted-service
          enum:
            - hosted-service
            - hangfire
            - none
          enumNames:
            - 'IHostedService — built-in background tasks'
            - 'Hangfire — durable, dashboard, retries'
            - 'None'
        auth:
          title: Authentication
          type: string
          default: none
          enum:
            - none
            - jwt-bearer
          enumNames:
            - 'None'
            - 'JWT Bearer — Microsoft.AspNetCore.Authentication.JwtBearer'
        observability:
          title: Observability
          type: string
          default: none
          enum:
            - none
            - opentelemetry
          enumNames:
            - 'None'
            - 'OpenTelemetry'
        native_aot:
          title: Native AOT
          type: string
          default: disabled
          enum:
            - disabled
            - enabled
          enumNames:
            - 'Disabled — JIT runtime'
            - 'Enabled — Native AOT publish (limits some F# features)'
  tooling:
    package_manager: dotnet-nuget
    language_flavor: fsharp
    test_runner: expecto-or-xunit
    lint_format: fantomas
    runtime_cli: dotnet
  smoke_test: |
    GET /health returns 200. One Expecto (or xUnit) test uses
    WebApplicationFactory + Giraffe's testHost helpers and asserts
    the response status.
  switch_when: |
    Want Rails-inspired controller/view/scope conventions in F# →
    web-saturn. Need C# MVC features specifically →
    web-aspnet-mvc.
