apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: api-sinatra
  title: Ruby — Sinatra (lightweight)
  description: |
    Small Ruby API or focused service with route-handler style and
    minimal framework concepts. Pick this for demos, microservices,
    and tiny web apps where Rails would be overkill.
  tags:
    - ruby
    - lightweight-api
    - sinatra
  links:
    - url: https://sinatrarb.com/
      title: Sinatra
    - url: https://bundler.io/
      title: Bundler
    - url: https://rspec.info/
      title: RSpec
spec:
  owner: abp
  type: service
  parameters:
    - title: Stack Configuration
      required:
        - database
      properties:
        backend:
          title: Backend
          type: string
          const: sinatra
        frontend:
          title: Frontend
          type: string
          const: api-only
        database:
          title: Database
          type: string
          enum:
            - postgres
            - sqlite
            - mysql
            - none
          enumNames:
            - 'Postgres — default for persistent services'
            - 'SQLite — development / single-process'
            - 'MySQL'
            - 'None — stateless service'
        background_jobs:
          title: Background Jobs
          type: string
          default: none
          enum:
            - none
            - sidekiq
          enumNames:
            - 'None'
            - 'Sidekiq — Redis-backed'
        auth:
          title: Authentication
          type: string
          default: none
          enum:
            - none
            - rack-warden
          enumNames:
            - 'None'
            - 'Rack + Warden — session-based'
        observability:
          title: Observability
          type: string
          default: none
          enum:
            - none
            - opentelemetry
          enumNames:
            - 'None'
            - 'OpenTelemetry'
  tooling:
    package_manager: bundler
    language_flavor: ruby
    test_runner: rspec
    lint_format: standard
    runtime_cli: rackup
  smoke_test: |
    GET /health returns 200. One RSpec request test hits the route
    via Rack::Test and asserts the status.
  switch_when: |
    Need admin / ActiveRecord / migrations / Hotwire / mailers /
    full-stack conventions → web-rails. Want explicit slice
    boundaries and dry-rb → Hanami (future sibling). Routing-tree
    minimalism → Roda (future sibling).
