railway-templates
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRailway 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
常用模板代码
| Category | Template | Code |
|---|---|---|
| Databases | PostgreSQL | |
| Redis | | |
| MySQL | | |
| MongoDB | | |
| CMS | Ghost | |
| Strapi | | |
| Storage | Minio | |
| Automation | n8n | |
| Monitoring | Uptime Kuma | |
For other templates, use the search query below.
| 分类 | 模板 | 代码 |
|---|---|---|
| 数据库 | PostgreSQL | |
| Redis | | |
| MySQL | | |
| MongoDB | | |
| 内容管理系统(CMS) | Ghost | |
| Strapi | | |
| 存储 | Minio | |
| 自动化 | n8n | |
| 监控 | Uptime Kuma | |
其他模板,请使用下方的搜索查询。
Prerequisites
前提条件
Get project context:
bash
railway status --jsonExtract:
- - project ID
id - - environment ID
environments.edges[0].node.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 - - 环境ID
environments.edges[0].node.id
获取工作区ID:
bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
'query getWorkspace($projectId: String!) {
project(id: $projectId) { workspaceId }
}' \
'{"projectId": "PROJECT_ID"}'
SCRIPTSearch 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}'
SCRIPTArguments
参数
| Argument | Type | Description |
|---|---|---|
| Int | Number of results (max ~100) |
| Boolean | Only verified templates |
| Boolean | Only recommended templates |
| 参数 | 类型 | 描述 |
|---|---|---|
| Int | 结果数量(最大约100) |
| Boolean | 仅显示已验证模板 |
| 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"}'
SCRIPTReturns:
- - template ID (needed for deployment)
id - - service configuration (needed for deployment)
serializedConfig
通过代码获取特定模板:
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"}'
SCRIPTbash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
'query template($code: String!) {
template(code: $code) {
id
serializedConfig
}
}' \
'{"code": "postgres"}'
SCRIPTStep 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"
}
}'
SCRIPTImportant: is the exact JSON object from the template query, not a string.
serializedConfigbash
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重要提示:是从模板查询中获取的精确JSON对象,而非字符串。
serializedConfigComposability
可组合性
- 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技能