railway-templates

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Railway Templates

Railway 模板

Search and deploy services from Railway's template marketplace.
从Railway的模板市场搜索并部署服务。

When to Use

适用场景

  • User asks to "add Postgres", "add Redis", "add a database"
  • User asks to "add Ghost", "add Strapi", "add n8n", or any other service
  • User wants to find templates for a use case (e.g., "CMS", "storage", "monitoring")
  • User asks "what templates are available?"
  • User wants to deploy a pre-configured service
  • 用户要求“添加Postgres”、“添加Redis”、“添加数据库”
  • 用户要求“添加Ghost”、“添加Strapi”、“添加n8n”或其他任何服务
  • 用户想要为特定用例查找模板(例如“CMS”、“存储”、“监控”)
  • 用户询问“有哪些可用模板?”
  • 用户想要部署预配置的服务

Common Template Codes

常用模板代码

CategoryTemplateCode
DatabasesPostgreSQL
postgres
Redis
redis
MySQL
mysql
MongoDB
mongodb
CMSGhost
ghost
Strapi
strapi
StorageMinio
minio
Automationn8n
n8n
MonitoringUptime Kuma
uptime-kuma
For other templates, use the search query below.
分类模板代码
数据库PostgreSQL
postgres
Redis
redis
MySQL
mysql
MongoDB
mongodb
内容管理系统(CMS)Ghost
ghost
Strapi
strapi
存储Minio
minio
自动化n8n
n8n
监控Uptime Kuma
uptime-kuma
其他模板,请使用下方的搜索查询。

Prerequisites

前提条件

Get project context:
bash
railway status --json
Extract:
  • id
    - project ID
  • environments.edges[0].node.id
    - environment ID
Get workspace ID:
bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query getWorkspace($projectId: String!) {
    project(id: $projectId) { workspaceId }
  }' \
  '{"projectId": "PROJECT_ID"}'
SCRIPT
获取项目上下文:
bash
railway status --json
提取:
  • id
    - 项目ID
  • environments.edges[0].node.id
    - 环境ID
获取工作区ID:
bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query getWorkspace($projectId: String!) {
    project(id: $projectId) { workspaceId }
  }' \
  '{"projectId": "PROJECT_ID"}'
SCRIPT

Search Templates

搜索模板

List available templates with optional filters:
bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query templates($first: Int, $verified: Boolean) {
    templates(first: $first, verified: $verified) {
      edges {
        node {
          name
          code
          description
          category
        }
      }
    }
  }' \
  '{"first": 20, "verified": true}'
SCRIPT
列出可用模板,可添加可选过滤器:
bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query templates($first: Int, $verified: Boolean) {
    templates(first: $first, verified: $verified) {
      edges {
        node {
          name
          code
          description
          category
        }
      }
    }
  }' \
  '{"first": 20, "verified": true}'
SCRIPT

Arguments

参数

ArgumentTypeDescription
first
IntNumber of results (max ~100)
verified
BooleanOnly verified templates
recommended
BooleanOnly recommended templates
参数类型描述
first
Int结果数量(最大约100)
verified
Boolean仅显示已验证模板
recommended
Boolean仅显示推荐模板

Rate Limit

速率限制

10 requests per minute. Don't spam searches.
每分钟10次请求。请勿频繁重复搜索。

Get Template Details

获取模板详情

Fetch a specific template by code:
bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query template($code: String!) {
    template(code: $code) {
      id
      name
      description
      serializedConfig
    }
  }' \
  '{"code": "postgres"}'
SCRIPT
Returns:
  • id
    - template ID (needed for deployment)
  • serializedConfig
    - service configuration (needed for deployment)
通过代码获取特定模板:
bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query template($code: String!) {
    template(code: $code) {
      id
      name
      description
      serializedConfig
    }
  }' \
  '{"code": "postgres"}'
SCRIPT
返回:
  • id
    - 模板ID(部署所需)
  • serializedConfig
    - 服务配置(部署所需)

Deploy Template

部署模板

Step 1: Fetch Template

步骤1:获取模板

bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query template($code: String!) {
    template(code: $code) {
      id
      serializedConfig
    }
  }' \
  '{"code": "postgres"}'
SCRIPT
bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query template($code: String!) {
    template(code: $code) {
      id
      serializedConfig
    }
  }' \
  '{"code": "postgres"}'
SCRIPT

Step 2: Deploy to Project

步骤2:部署到项目

bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'mutation deployTemplate($input: TemplateDeployV2Input!) {
    templateDeployV2(input: $input) {
      projectId
      workflowId
    }
  }' \
  '{
    "input": {
      "templateId": "TEMPLATE_ID_FROM_STEP_1",
      "serializedConfig": SERIALIZED_CONFIG_FROM_STEP_1,
      "projectId": "PROJECT_ID",
      "environmentId": "ENVIRONMENT_ID",
      "workspaceId": "WORKSPACE_ID"
    }
  }'
SCRIPT
Important:
serializedConfig
is the exact JSON object from the template query, not a string.
bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'mutation deployTemplate($input: TemplateDeployV2Input!) {
    templateDeployV2(input: $input) {
      projectId
      workflowId
    }
  }' \
  '{
    "input": {
      "templateId": "TEMPLATE_ID_FROM_STEP_1",
      "serializedConfig": SERIALIZED_CONFIG_FROM_STEP_1,
      "projectId": "PROJECT_ID",
      "environmentId": "ENVIRONMENT_ID",
      "workspaceId": "WORKSPACE_ID"
    }
  }'
SCRIPT
重要提示
serializedConfig
是从模板查询中获取的精确JSON对象,而非字符串。

Composability

可组合性

  • Connect services: Use railway-environment skill to add variable references
  • View deployed service: Use railway-service skill
  • Check logs: Use railway-deployment skill
  • Add domains: Use railway-domain skill
  • 连接服务:使用railway-environment技能添加变量引用
  • 查看已部署服务:使用railway-service技能
  • 查看日志:使用railway-deployment技能
  • 添加域名:使用railway-domain技能