apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: web-rails
  title: Ruby — Rails (batteries-included)
  description: |
    Modern Rails web app with Hotwire/Turbo, Active Record + migrations,
    Solid Queue (jobs), Solid Cache (cache), Solid Cable (websockets),
    Propshaft (assets), built-in session-based auth generator, and
    Kamal as the default deploy tool.
  tags:
    - ruby
    - web
    - rails
  links:
    - url: https://guides.rubyonrails.org/
      title: Rails Guides
    - url: https://kamal-deploy.org/
      title: Kamal
    - url: https://bundler.io/
      title: Bundler
    - url: https://hotwired.dev/
      title: Hotwire / Turbo
spec:
  owner: abp
  type: website
  parameters:
    - title: Stack Configuration
      required:
        - database
      properties:
        backend:
          title: Backend
          type: string
          const: rails
        frontend:
          title: Frontend
          type: string
          const: server-rendered-templates
          description: |
            ERB templates with Hotwire/Turbo + Stimulus. For a separate
            JS frontend pair with frontend-spa and treat this as the API.
        database:
          title: Database
          type: string
          enum:
            - postgres
            - sqlite
            - mysql
          enumNames:
            - 'Postgres — default for production'
            - 'SQLite — development / single-tenant (now production-viable with Solid Trifecta)'
            - 'MySQL'
        background_jobs:
          title: Background Jobs
          type: string
          default: solid-queue
          enum:
            - solid-queue
            - sidekiq
            - none
          enumNames:
            - 'Solid Queue — Rails default, database-backed'
            - 'Sidekiq — Redis-backed, mature ecosystem'
            - 'None'
        auth:
          title: Authentication
          type: string
          default: rails-native
          enum:
            - rails-native
            - devise
            - none
          enumNames:
            - 'Rails native — built-in session-based generator'
            - 'Devise — full-featured authentication gem'
            - 'None'
        cache:
          title: Cache
          type: string
          default: solid-cache
          enum:
            - solid-cache
            - redis
            - memory
          enumNames:
            - 'Solid Cache — Rails default, database-backed'
            - 'Redis'
            - 'In-memory (development only)'
        deploy:
          title: Deploy
          type: string
          default: kamal
          enum:
            - kamal
            - heroku
            - render
            - fly
            - container
          enumNames:
            - 'Kamal — Rails default'
            - 'Heroku'
            - 'Render'
            - 'Fly.io'
            - 'Container (build only)'
        observability:
          title: Observability
          type: string
          default: none
          enum:
            - none
            - opentelemetry
          enumNames:
            - 'None'
            - 'OpenTelemetry'
  tooling:
    package_manager: bundler
    language_flavor: ruby
    test_runner: minitest
    lint_format: standard
    runtime_cli: rails
  smoke_test: |
    GET / returns the Rails welcome page. One Minitest integration
    test uses ActionDispatch::IntegrationTest and asserts the status.
  switch_when: |
    Need only a small API with no admin/templates → api-sinatra.
    Want explicit clean-architecture slices → Hanami (future
    sibling).
