{
  "manifest_version": "1.0.0",
  "template": {
    "id": "d09f3f1e-378c-45c2-b7fe-b5662ca8d38a",
    "slug": "swetrix-analytics-template",
    "name": "Swetrix Analytics Template",
    "description": "Privacy-first analytics with funnels, sessions, and events on Railway.",
    "url": "https://railway.com/deploy/swetrix-analytics-template",
    "upstream": {
      "repo_url": "https://github.com/romeoxt/railway-template-swetrix-analytics"
    }
  },
  "services": [
    {
      "name": "Swetrix-API",
      "source": {
        "image": "swetrix/swetrix-api:v5.4.1"
      },
      "needs_volume": false,
      "http": false
    },
    {
      "name": "Redis",
      "source": {
        "image": "redis:8.2"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": false
    },
    {
      "name": "ClickHouse",
      "source": {
        "image": "clickhouse/clickhouse-server:25.8-alpine"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/clickhouse",
      "http": false
    },
    {
      "name": "Swetrix-FE",
      "source": {
        "image": "swetrix/swetrix-fe:v5.4.1"
      },
      "needs_volume": false,
      "http": false
    },
    {
      "name": "Gateway",
      "source": {
        "repo": "https://github.com/romeoxt/railway-template-swetrix-analytics"
      },
      "needs_volume": false,
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "BASE_URL",
      "service": "Swetrix-API",
      "description": "Public URL of the Swetrix dashboard (Gateway domain).",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "SMTP_MOCK",
      "service": "Swetrix-API",
      "description": "Skip real email sending during MVP setup (true).",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "REDIS_HOST",
      "service": "Swetrix-API",
      "description": "Redis hostname. Use short service name redis for private networking.",
      "secret": false,
      "strategy": "default",
      "default": "redis"
    },
    {
      "key": "REDIS_PORT",
      "service": "Swetrix-API",
      "description": "Redis port (6379).",
      "secret": false,
      "strategy": "default",
      "default": "6379"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "Swetrix-API",
      "description": "Redis password from the Redis service.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "CLICKHOUSE_HOST",
      "service": "Swetrix-API",
      "description": "ClickHouse HTTP endpoint on private networking.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "CLICKHOUSE_PORT",
      "service": "Swetrix-API",
      "description": "ClickHouse HTTP port (8123).",
      "secret": false,
      "strategy": "default",
      "default": "8123"
    },
    {
      "key": "CLICKHOUSE_USER",
      "service": "Swetrix-API",
      "description": "ClickHouse username.",
      "secret": false,
      "strategy": "default",
      "default": "default"
    },
    {
      "key": "SECRET_KEY_BASE",
      "service": "Swetrix-API",
      "description": "Secret key for session signing and encryption. Auto-generated at deploy.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "CLIENT_IP_HEADER",
      "service": "Swetrix-API",
      "description": "Header Gateway sends for real client IP (x-forwarded-for).",
      "secret": false,
      "strategy": "default",
      "default": "x-forwarded-for"
    },
    {
      "key": "CLICKHOUSE_DATABASE",
      "service": "Swetrix-API",
      "description": "ClickHouse database name for analytics events.",
      "secret": false,
      "strategy": "default",
      "default": "analytics"
    },
    {
      "key": "CLICKHOUSE_PASSWORD",
      "service": "Swetrix-API",
      "description": "ClickHouse password (must match ClickHouse service).",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DISABLE_REGISTRATION",
      "service": "Swetrix-API",
      "description": "Lock registration after the first user account is created.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "REDISHOST",
      "service": "Redis",
      "description": "Private hostname for this Redis instance.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDISPORT",
      "service": "Redis",
      "description": "Redis server port (6379).",
      "secret": false,
      "strategy": "default",
      "default": "6379"
    },
    {
      "key": "REDISUSER",
      "service": "Redis",
      "description": "Redis username for authenticated connections.",
      "secret": false,
      "strategy": "default",
      "default": "default"
    },
    {
      "key": "REDIS_URL",
      "service": "Redis",
      "description": "Full Redis connection URL (auto-composed from other vars).",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDISPASSWORD",
      "service": "Redis",
      "description": "Alias for REDIS_PASSWORD used by Railway Redis plugin.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "Redis",
      "description": "Redis password. Auto-generated at deploy.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "CLICKHOUSE_DB",
      "service": "ClickHouse",
      "description": "Default database created on first boot (analytics).",
      "secret": false,
      "strategy": "default",
      "default": "analytics"
    },
    {
      "key": "CLICKHOUSE_USER",
      "service": "ClickHouse",
      "description": "ClickHouse admin username.",
      "secret": false,
      "strategy": "default",
      "default": "default"
    },
    {
      "key": "CLICKHOUSE_PASSWORD",
      "service": "ClickHouse",
      "description": "ClickHouse password. Auto-generated at deploy.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "BASE_URL",
      "service": "Swetrix-FE",
      "description": "Public URL of the Swetrix dashboard (Gateway domain).",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "SWETRIX_FE_HOST",
      "service": "Gateway",
      "description": "Private hostname of the Swetrix frontend service (Railway internal DNS).",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "SWETRIX_FE_PORT",
      "service": "Gateway",
      "description": "Port the Swetrix FE container listens on. Railway sets $PORT to 8080.",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "SWETRIX_API_HOST",
      "service": "Gateway",
      "description": "Private hostname of the Swetrix API service (Railway internal DNS).",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "SWETRIX_API_PORT",
      "service": "Gateway",
      "description": "Port the Swetrix API container listens on (5005).",
      "secret": false,
      "strategy": "default",
      "default": "5005"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "swetrix-analytics-template"
      }
    },
    "cli": "railway deploy --template swetrix-analytics-template",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "d09f3f1e-378c-45c2-b7fe-b5662ca8d38a",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "6ec0b1fb-e4bb-488f-953b-b49e297e57bc": {
                  "icon": "https://swetrix.com/favicon.ico",
                  "name": "Swetrix-API",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "swetrix/swetrix-api:v5.4.1"
                  },
                  "variables": {
                    "BASE_URL": {
                      "isOptional": false,
                      "description": "Public URL of the Swetrix dashboard (Gateway domain).",
                      "defaultValue": "https://${{Gateway.RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "SMTP_MOCK": {
                      "isOptional": false,
                      "description": "Skip real email sending during MVP setup (true).",
                      "defaultValue": "true"
                    },
                    "REDIS_HOST": {
                      "isOptional": false,
                      "description": "Redis hostname. Use short service name redis for private networking.",
                      "defaultValue": "redis"
                    },
                    "REDIS_PORT": {
                      "isOptional": false,
                      "description": "Redis port (6379).",
                      "defaultValue": "6379"
                    },
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "description": "Redis password from the Redis service.",
                      "defaultValue": "${{Redis.REDISPASSWORD}}"
                    },
                    "CLICKHOUSE_HOST": {
                      "isOptional": false,
                      "description": "ClickHouse HTTP endpoint on private networking.",
                      "defaultValue": "http://${{ClickHouse.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "CLICKHOUSE_PORT": {
                      "isOptional": false,
                      "description": "ClickHouse HTTP port (8123).",
                      "defaultValue": "8123"
                    },
                    "CLICKHOUSE_USER": {
                      "isOptional": false,
                      "description": "ClickHouse username.",
                      "defaultValue": "default"
                    },
                    "SECRET_KEY_BASE": {
                      "isOptional": false,
                      "description": "Secret key for session signing and encryption. Auto-generated at deploy.",
                      "defaultValue": "{{SECRET_KEY_BASE}}"
                    },
                    "CLIENT_IP_HEADER": {
                      "isOptional": false,
                      "description": "Header Gateway sends for real client IP (x-forwarded-for).",
                      "defaultValue": "x-forwarded-for"
                    },
                    "CLICKHOUSE_DATABASE": {
                      "isOptional": false,
                      "description": "ClickHouse database name for analytics events.",
                      "defaultValue": "analytics"
                    },
                    "CLICKHOUSE_PASSWORD": {
                      "isOptional": false,
                      "description": "ClickHouse password (must match ClickHouse service).",
                      "defaultValue": "${{ClickHouse.CLICKHOUSE_PASSWORD}}"
                    },
                    "DISABLE_REGISTRATION": {
                      "isOptional": false,
                      "description": "Lock registration after the first user account is created.",
                      "defaultValue": "true"
                    }
                  }
                },
                "8c869a32-8bb6-4aa0-b011-14bf4b427952": {
                  "icon": "https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg",
                  "name": "Redis",
                  "deploy": {
                    "startCommand": "/bin/sh -c \"rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH\"",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "redis:8.2"
                  },
                  "variables": {
                    "REDISHOST": {
                      "isOptional": false,
                      "description": "Private hostname for this Redis instance.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "REDISPORT": {
                      "isOptional": false,
                      "description": "Redis server port (6379).",
                      "defaultValue": "6379"
                    },
                    "REDISUSER": {
                      "isOptional": false,
                      "description": "Redis username for authenticated connections.",
                      "defaultValue": "default"
                    },
                    "REDIS_URL": {
                      "isOptional": false,
                      "description": "Full Redis connection URL (auto-composed from other vars).",
                      "defaultValue": "redis://${{REDISUSER}}:${{REDIS_PASSWORD}}@${{REDISHOST}}:${{REDISPORT}}"
                    },
                    "REDISPASSWORD": {
                      "isOptional": false,
                      "description": "Alias for REDIS_PASSWORD used by Railway Redis plugin.",
                      "defaultValue": "${{REDIS_PASSWORD}}"
                    },
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "description": "Redis password. Auto-generated at deploy.",
                      "defaultValue": "{{REDIS_PASSWORD}}"
                    }
                  },
                  "volumeMounts": {
                    "8c869a32-8bb6-4aa0-b011-14bf4b427952": {
                      "mountPath": "/data"
                    }
                  }
                },
                "a7ef6850-4bc3-42e1-8839-c7c1daaa1949": {
                  "icon": "https://avatars.githubusercontent.com/u/54801242?s=200&v=4",
                  "name": "ClickHouse",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "clickhouse/clickhouse-server:25.8-alpine"
                  },
                  "variables": {
                    "CLICKHOUSE_DB": {
                      "isOptional": false,
                      "description": "Default database created on first boot (analytics).",
                      "defaultValue": "analytics"
                    },
                    "CLICKHOUSE_USER": {
                      "isOptional": false,
                      "description": "ClickHouse admin username.",
                      "defaultValue": "default"
                    },
                    "CLICKHOUSE_PASSWORD": {
                      "isOptional": false,
                      "description": "ClickHouse password. Auto-generated at deploy.",
                      "defaultValue": "{{CLICKHOUSE_PASSWORD}}"
                    }
                  },
                  "volumeMounts": {
                    "a7ef6850-4bc3-42e1-8839-c7c1daaa1949": {
                      "mountPath": "/var/lib/clickhouse"
                    }
                  }
                },
                "addca613-10b2-4fd2-b156-338e67b43a78": {
                  "icon": "https://swetrix.com/favicon.ico",
                  "name": "Swetrix-FE",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "swetrix/swetrix-fe:v5.4.1"
                  },
                  "variables": {
                    "BASE_URL": {
                      "isOptional": false,
                      "description": "Public URL of the Swetrix dashboard (Gateway domain).",
                      "defaultValue": "https://${{Gateway.RAILWAY_PUBLIC_DOMAIN}}"
                    }
                  }
                },
                "dee89ef1-a49f-4711-a4bb-eb4c0ed824eb": {
                  "icon": "https://raw.githubusercontent.com/romeoxt/railway-template-swetrix-analytics/main/website/icon.svg",
                  "name": "Gateway",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "repo": "https://github.com/romeoxt/railway-template-swetrix-analytics",
                    "rootDirectory": null
                  },
                  "variables": {
                    "SWETRIX_FE_HOST": {
                      "isOptional": false,
                      "description": "Private hostname of the Swetrix frontend service (Railway internal DNS).",
                      "defaultValue": "${{Swetrix-FE.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "SWETRIX_FE_PORT": {
                      "isOptional": false,
                      "description": "Port the Swetrix FE container listens on. Railway sets $PORT to 8080.",
                      "defaultValue": "8080"
                    },
                    "SWETRIX_API_HOST": {
                      "isOptional": false,
                      "description": "Private hostname of the Swetrix API service (Railway internal DNS).",
                      "defaultValue": "${{Swetrix-API.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "SWETRIX_API_PORT": {
                      "isOptional": false,
                      "description": "Port the Swetrix API container listens on (5005).",
                      "defaultValue": "5005"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "Gateway",
      "method": "GET",
      "path": "/",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 5,
    "needs_volume": true
  },
  "generated_at": "2026-09-15T22:14:40.394Z",
  "generator_version": "0.1.0",
  "status": "degraded",
  "validated_at": "2026-09-15T21:41:44.118Z",
  "success_rate_30d": 0,
  "validation": {
    "last_run_id": "run_fce0ed0ef40146efb474",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": false,
        "detail": "FAILED,SUCCESS,SUCCESS,SUCCESS,SUCCESS"
      }
    ]
  }
}
