{
  "manifest_version": "1.0.0",
  "template": {
    "id": "1c720806-206a-4b74-86f2-75bb28917d2d",
    "slug": "trailbase-api",
    "name": "TrailBase",
    "description": "Single-executable app backend with SQLite, REST APIs and auth",
    "url": "https://railway.com/deploy/trailbase-api",
    "upstream": {
      "image": "caddy:2-alpine"
    }
  },
  "services": [
    {
      "name": "gateway",
      "source": {
        "image": "caddy:2-alpine"
      },
      "needs_volume": false,
      "http": true
    },
    {
      "name": "trailbase",
      "source": {
        "repo": "https://github.com/gridalpha/trailbase-railway"
      },
      "needs_volume": true,
      "volume_mount_path": "/app/traildepot",
      "http": false
    },
    {
      "name": "mailpit",
      "source": {
        "image": "axllent/mailpit:latest"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "gateway",
      "description": "Port Caddy listens on and the domain targets",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "CADDY_CONFIG",
      "service": "gateway",
      "description": "One-line Caddy JSON config: routes, trusted proxies, XFF rewrite",
      "secret": false,
      "strategy": "default",
      "default": "{\"admin\":{\"disabled\":true},\"logging\":{\"logs\":{\"default\":{\"level\":\"INFO\"}}},\"apps\":{\"http\":{\"servers\":{\"srv0\":{\"listen\":[\":{env.PORT}\"],\"trusted_proxies\":{\"source\":\"static\",\"ranges\":[\"100.64.0.0/10\",\"fd00::/8\",\"152.233.0.0/17\"]},\"routes\":[{\"match\":[{\"path\":[\"/healthz\"]}],\"handle\":[{\"handler\":\"static_response\",\"status_code\":200,\"body\":\"ok\"}]},{\"handle\":[{\"handler\":\"reverse_proxy\",\"flush_interval\":-1,\"headers\":{\"request\":{\"replace\":{\"X-Forwarded-For\":[{\"search_regexp\":\"\\\\s*,.*$\",\"replace\":\"\"}]},\"delete\":[\"X-Real-IP\",\"True-Client-IP\",\"Cf-Connecting-Ip\",\"Fly-Client-Ip\",\"X-Azure-Socketip\",\"Cloudfront-Viewer-Address\"]}},\"upstreams\":[{\"dial\":\"trailbase.railway.internal:4000\"}]}]}]}}}}}"
    },
    {
      "key": "PORT",
      "service": "trailbase",
      "description": "Port the app binds and Railway probes",
      "secret": false,
      "strategy": "default",
      "default": "4000"
    },
    {
      "key": "DEPOT",
      "service": "trailbase",
      "description": "Data directory; matches the volume mount",
      "secret": false,
      "strategy": "default",
      "default": "/app/traildepot"
    },
    {
      "key": "ADMIN_EMAIL",
      "service": "trailbase",
      "description": "Identity of the first admin account",
      "secret": false,
      "strategy": "default",
      "default": "admin@localhost"
    },
    {
      "key": "ADMIN_PASSWORD",
      "service": "trailbase",
      "description": "Password for the first admin account",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RUST_BACKTRACE",
      "service": "trailbase",
      "description": "Backtraces on panic",
      "secret": false,
      "strategy": "default",
      "default": "1"
    },
    {
      "key": "TINI_SUBREAPER",
      "service": "trailbase",
      "description": "tini is not PID 1 on Railway",
      "secret": false,
      "strategy": "default",
      "default": "1"
    },
    {
      "key": "TRAIL_EMAIL_SMTP_HOST",
      "service": "trailbase",
      "description": "SMTP host on the private network",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "TRAIL_EMAIL_SMTP_PORT",
      "service": "trailbase",
      "description": "Mailpit's plaintext SMTP port",
      "secret": false,
      "strategy": "default",
      "default": "1025"
    },
    {
      "key": "TRAIL_SERVER_SITE_URL",
      "service": "trailbase",
      "description": "Public URL in mail and OAuth redirects",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "TINI_KILL_PROCESS_GROUP",
      "service": "trailbase",
      "description": "Forward SIGTERM to child processes",
      "secret": false,
      "strategy": "default",
      "default": "1"
    },
    {
      "key": "TRAIL_EMAIL_SENDER_NAME",
      "service": "trailbase",
      "description": "Required whenever a sender address is set",
      "secret": false,
      "strategy": "default",
      "default": "TrailBase"
    },
    {
      "key": "TRAIL_EMAIL_SENDER_ADDRESS",
      "service": "trailbase",
      "description": "From address on outgoing mail",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "TRAIL_EMAIL_SMTP_ENCRYPTION",
      "service": "trailbase",
      "description": "Numeric enum: no SMTP encryption",
      "secret": false,
      "strategy": "default",
      "default": "1"
    },
    {
      "key": "TRAIL_SERVER_AUTH_IP_RATE_LIMIT",
      "service": "trailbase",
      "description": "Auth requests per IP per second",
      "secret": false,
      "strategy": "default",
      "default": "10"
    },
    {
      "key": "TRAIL_SERVER_S3_STORAGE_CONFIG_REGION",
      "service": "trailbase",
      "description": "Object storage region",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "TRAIL_SERVER_S3_STORAGE_CONFIG_ENDPOINT",
      "service": "trailbase",
      "description": "Object storage endpoint",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "TRAIL_SERVER_S3_STORAGE_CONFIG_ACCESS_KEY",
      "service": "trailbase",
      "description": "Bucket access key id",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "TRAIL_SERVER_S3_STORAGE_CONFIG_BUCKET_NAME",
      "service": "trailbase",
      "description": "Bucket holding uploaded files",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "TRAIL_SERVER_S3_STORAGE_CONFIG_SECRET_ACCESS_KEY",
      "service": "trailbase",
      "description": "Bucket secret key",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PORT",
      "service": "mailpit",
      "description": "Inbox UI port, probed by the health check",
      "secret": false,
      "strategy": "default",
      "default": "8025"
    },
    {
      "key": "MP_UI_AUTH",
      "service": "mailpit",
      "description": "Basic-auth credentials for the inbox",
      "secret": false,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "MP_DATABASE",
      "service": "mailpit",
      "description": "Message store on the volume",
      "secret": false,
      "strategy": "default",
      "default": "/data/mailpit.db"
    },
    {
      "key": "MP_MAX_MESSAGES",
      "service": "mailpit",
      "description": "Messages retained before rotation",
      "secret": false,
      "strategy": "default",
      "default": "5000"
    },
    {
      "key": "MP_UI_BIND_ADDR",
      "service": "mailpit",
      "description": "Dual-stack bind for the inbox UI",
      "secret": false,
      "strategy": "default",
      "default": "[::]:8025"
    },
    {
      "key": "MP_SMTP_BIND_ADDR",
      "service": "mailpit",
      "description": "Dual-stack bind for the SMTP listener",
      "secret": false,
      "strategy": "default",
      "default": "[::]:1025"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "trailbase-api"
      }
    },
    "cli": "railway deploy --template trailbase-api",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "1c720806-206a-4b74-86f2-75bb28917d2d",
            "serializedConfig": {
              "buckets": {
                "905e5410-574e-4547-923f-42695480d9ef": {
                  "name": "trailbase-files"
                }
              },
              "services": {
                "1a83e425-342d-4b03-87d3-7b18c9e829a2": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/caddy.svg",
                  "name": "gateway",
                  "deploy": {
                    "startCommand": "/bin/sh -c 'printf %s \"$CADDY_CONFIG\" > /etc/caddy/config.json; caddy validate --config /etc/caddy/config.json || exit 1; exec caddy run --config /etc/caddy/config.json'",
                    "healthcheckPath": "/healthz",
                    "restartPolicyType": "ALWAYS",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "caddy:2-alpine"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Port Caddy listens on and the domain targets",
                      "defaultValue": "8080"
                    },
                    "CADDY_CONFIG": {
                      "isOptional": false,
                      "description": "One-line Caddy JSON config: routes, trusted proxies, XFF rewrite",
                      "defaultValue": "{\"admin\":{\"disabled\":true},\"logging\":{\"logs\":{\"default\":{\"level\":\"INFO\"}}},\"apps\":{\"http\":{\"servers\":{\"srv0\":{\"listen\":[\":{env.PORT}\"],\"trusted_proxies\":{\"source\":\"static\",\"ranges\":[\"100.64.0.0/10\",\"fd00::/8\",\"152.233.0.0/17\"]},\"routes\":[{\"match\":[{\"path\":[\"/healthz\"]}],\"handle\":[{\"handler\":\"static_response\",\"status_code\":200,\"body\":\"ok\"}]},{\"handle\":[{\"handler\":\"reverse_proxy\",\"flush_interval\":-1,\"headers\":{\"request\":{\"replace\":{\"X-Forwarded-For\":[{\"search_regexp\":\"\\\\s*,.*$\",\"replace\":\"\"}]},\"delete\":[\"X-Real-IP\",\"True-Client-IP\",\"Cf-Connecting-Ip\",\"Fly-Client-Ip\",\"X-Azure-Socketip\",\"Cloudfront-Viewer-Address\"]}},\"upstreams\":[{\"dial\":\"trailbase.railway.internal:4000\"}]}]}]}}}}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:8080": {
                        "port": 8080
                      }
                    }
                  }
                },
                "5db99bdd-6096-4ee6-8e38-2aa9fe109463": {
                  "icon": "https://cdn.jsdelivr.net/gh/trailbaseio/trailbase@main/assets/favicon.svg",
                  "name": "trailbase",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/api/healthcheck",
                    "restartPolicyType": "ALWAYS",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "repo": "https://github.com/gridalpha/trailbase-railway",
                    "rootDirectory": null
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Port the app binds and Railway probes",
                      "defaultValue": "4000"
                    },
                    "DEPOT": {
                      "isOptional": false,
                      "description": "Data directory; matches the volume mount",
                      "defaultValue": "/app/traildepot"
                    },
                    "ADMIN_EMAIL": {
                      "isOptional": true,
                      "description": "Identity of the first admin account",
                      "defaultValue": "admin@localhost"
                    },
                    "ADMIN_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for the first admin account",
                      "defaultValue": "{{ADMIN_PASSWORD}}"
                    },
                    "RUST_BACKTRACE": {
                      "isOptional": true,
                      "description": "Backtraces on panic",
                      "defaultValue": "1"
                    },
                    "TINI_SUBREAPER": {
                      "isOptional": false,
                      "description": "tini is not PID 1 on Railway",
                      "defaultValue": "1"
                    },
                    "TRAIL_EMAIL_SMTP_HOST": {
                      "isOptional": false,
                      "description": "SMTP host on the private network",
                      "defaultValue": "${{mailpit.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "TRAIL_EMAIL_SMTP_PORT": {
                      "isOptional": false,
                      "description": "Mailpit's plaintext SMTP port",
                      "defaultValue": "1025"
                    },
                    "TRAIL_SERVER_SITE_URL": {
                      "isOptional": false,
                      "description": "Public URL in mail and OAuth redirects",
                      "defaultValue": "https://${{gateway.RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "TINI_KILL_PROCESS_GROUP": {
                      "isOptional": false,
                      "description": "Forward SIGTERM to child processes",
                      "defaultValue": "1"
                    },
                    "TRAIL_EMAIL_SENDER_NAME": {
                      "isOptional": false,
                      "description": "Required whenever a sender address is set",
                      "defaultValue": "TrailBase"
                    },
                    "TRAIL_EMAIL_SENDER_ADDRESS": {
                      "isOptional": false,
                      "description": "From address on outgoing mail",
                      "defaultValue": "noreply@${{gateway.RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "TRAIL_EMAIL_SMTP_ENCRYPTION": {
                      "isOptional": false,
                      "description": "Numeric enum: no SMTP encryption",
                      "defaultValue": "1"
                    },
                    "TRAIL_SERVER_AUTH_IP_RATE_LIMIT": {
                      "isOptional": true,
                      "description": "Auth requests per IP per second",
                      "defaultValue": "10"
                    },
                    "TRAIL_SERVER_S3_STORAGE_CONFIG_REGION": {
                      "isOptional": false,
                      "description": "Object storage region",
                      "defaultValue": "${{trailbase-files.REGION}}"
                    },
                    "TRAIL_SERVER_S3_STORAGE_CONFIG_ENDPOINT": {
                      "isOptional": false,
                      "description": "Object storage endpoint",
                      "defaultValue": "${{trailbase-files.ENDPOINT}}"
                    },
                    "TRAIL_SERVER_S3_STORAGE_CONFIG_ACCESS_KEY": {
                      "isOptional": false,
                      "description": "Bucket access key id",
                      "defaultValue": "${{trailbase-files.ACCESS_KEY_ID}}"
                    },
                    "TRAIL_SERVER_S3_STORAGE_CONFIG_BUCKET_NAME": {
                      "isOptional": false,
                      "description": "Bucket holding uploaded files",
                      "defaultValue": "${{trailbase-files.BUCKET}}"
                    },
                    "TRAIL_SERVER_S3_STORAGE_CONFIG_SECRET_ACCESS_KEY": {
                      "isOptional": false,
                      "description": "Bucket secret key",
                      "defaultValue": "${{trailbase-files.SECRET_ACCESS_KEY}}"
                    }
                  },
                  "volumeMounts": {
                    "5db99bdd-6096-4ee6-8e38-2aa9fe109463": {
                      "mountPath": "/app/traildepot"
                    }
                  }
                },
                "88f31c94-b8bf-4060-928d-5227e2dd37ca": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/mailpit.svg",
                  "name": "mailpit",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/livez",
                    "restartPolicyType": "ALWAYS",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "axllent/mailpit:latest"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Inbox UI port, probed by the health check",
                      "defaultValue": "8025"
                    },
                    "MP_UI_AUTH": {
                      "isOptional": false,
                      "description": "Basic-auth credentials for the inbox",
                      "defaultValue": "{{MP_UI_AUTH}}"
                    },
                    "MP_DATABASE": {
                      "isOptional": false,
                      "description": "Message store on the volume",
                      "defaultValue": "/data/mailpit.db"
                    },
                    "MP_MAX_MESSAGES": {
                      "isOptional": true,
                      "description": "Messages retained before rotation",
                      "defaultValue": "5000"
                    },
                    "MP_UI_BIND_ADDR": {
                      "isOptional": false,
                      "description": "Dual-stack bind for the inbox UI",
                      "defaultValue": "[::]:8025"
                    },
                    "MP_SMTP_BIND_ADDR": {
                      "isOptional": false,
                      "description": "Dual-stack bind for the SMTP listener",
                      "defaultValue": "[::]:1025"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:8025": {
                        "port": 8025
                      }
                    }
                  },
                  "volumeMounts": {
                    "88f31c94-b8bf-4060-928d-5227e2dd37ca": {
                      "mountPath": "/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "gateway",
      "method": "GET",
      "path": "/healthz",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-09-15T22:14:40.394Z",
  "generator_version": "0.1.0",
  "status": "degraded",
  "validated_at": "2026-09-15T19:05:04.106Z",
  "success_rate_30d": 0,
  "validation": {
    "last_run_id": "run_59336322233245a581be",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": false,
        "detail": "Your workspace has been restricted. Please contact support to resolve this."
      }
    ]
  }
}
