apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: web-saturn
  title: F# — Saturn (Rails-inspired full-stack)
  description: |
    F# web framework built on top of Giraffe with Rails-inspired
    conventions: pipelines, scopes/routers, controller actions, and
    application-level configuration. Pick this when convention-over-
    configuration in F# matters more than minimal handler surface.
  tags:
    - fsharp
    - web
    - saturn
    - giraffe
  links:
    - url: https://saturnframework.org/
      title: Saturn
    - url: https://giraffe.wiki/
      title: Giraffe
    - url: https://fsharp.org/
      title: F#
    - url: https://fsprojects.github.io/fantomas/
      title: Fantomas
spec:
  owner: abp
  type: website
  parameters:
    - title: Stack Configuration
      required:
        - database
      properties:
        backend:
          title: Backend
          type: string
          const: saturn
        frontend:
          title: Frontend
          type: string
          const: server-rendered-templates
          description: |
            Giraffe.ViewEngine for HTML rendering, optionally Razor.
            For a separate JS frontend pair with frontend-spa and
            treat Saturn as the API.
        database:
          title: Database
          type: string
          enum:
            - postgres
            - sqlserver
            - sqlite
          enumNames:
            - 'Postgres — Npgsql provider'
            - 'SQL Server — first-party provider'
            - 'SQLite'
        persistence:
          title: Persistence
          type: string
          default: ef-core
          enum:
            - ef-core
            - dapper
            - sqlhydra
          enumNames:
            - 'Entity Framework Core — full ORM'
            - 'Dapper — micro-ORM, hand-written SQL'
            - 'SqlHydra — F#-native typed query DSL'
        background_jobs:
          title: Background Jobs
          type: string
          default: hosted-service
          enum:
            - hosted-service
            - hangfire
            - none
          enumNames:
            - 'IHostedService — built-in'
            - 'Hangfire — durable, dashboard, retries'
            - 'None'
        auth:
          title: Authentication
          type: string
          default: aspnet-identity
          enum:
            - aspnet-identity
            - jwt-bearer
            - none
          enumNames:
            - 'ASP.NET Core Identity — built-in user store'
            - 'JWT Bearer — token-based'
            - 'None'
        observability:
          title: Observability
          type: string
          default: none
          enum:
            - none
            - opentelemetry
          enumNames:
            - 'None'
            - 'OpenTelemetry'
  tooling:
    package_manager: dotnet-nuget
    language_flavor: fsharp
    test_runner: expecto-or-xunit
    lint_format: fantomas
    runtime_cli: dotnet
  smoke_test: |
    GET / returns 200 with the welcome page. One Expecto (or xUnit)
    test uses WebApplicationFactory and asserts the response.
  switch_when: |
    Want a small functional handler stack without Saturn's
    conventions → api-giraffe. Need C# MVC controllers / Blazor →
    web-aspnet-mvc.
