
Domain
Add Railway-generated or custom domains and retrieve the public URL for a deployed service via the Railway CLI.
Overview
Domain is an agent skill for the Ship phase that adds, lists, and removes Railway service domains and returns DNS records for custom hostname setup.
Install
npx skills add https://github.com/railwayapp/railway-skills --skill domainWhat is this skill?
- Generate one Railway-provided domain per service with railway domain --json
- Add custom domains and return CNAME (and related) DNS records for the user’s DNS provider
- Target a specific service with --service backend
- Read domains from environment config networking (serviceDomains vs customDomains)
- Remove custom domains via the environment skill workflow
- Maximum 1 Railway-provided domain per service
Adoption & trust: 783 installs on skills.sh; 274 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your service is deployed on Railway but you do not have a stable URL or you need DNS steps for a custom domain.
Who is it for?
Indie hackers shipping backends or full-stack apps on Railway who want the agent to run documented CLI steps instead of clicking through the dashboard.
Skip if: Non-Railway hosts, local-only development without deployment, or complex multi-region DNS beyond what Railway returns.
When should I use this skill?
User wants to add a domain, generate a Railway domain, check current domains, get the URL for a service, or remove a domain.
What do I get? / Deliverables
You get a railway.app hostname or structured DNS records to paste into your registrar, plus paths to inspect or remove existing domains.
- Public railway.app URL or custom domain binding
- JSON DNS record list for registrar configuration
Recommended Skills
Journey fit
Domains and public URLs are launch-prep work immediately after deploy—canonical under ship before distribution and SEO. Launch subphase covers making the service reachable on a stable hostname, including DNS instructions for custom domains.
How it compares
Railway CLI domain recipes—not generic nginx certbot docs or a third-party DNS MCP.
Common Questions / FAQ
Who is domain for?
Solo builders and small teams deploying on Railway who need programmatic domain setup and URL discovery from Claude Code or similar agents.
When should I use domain?
Right after a successful Railway deploy when you need a public link, when adding a custom domain, or when cleaning up old hostnames before launch.
Is domain safe to install?
It invokes Railway CLI against your linked project; confirm project context and review Security Audits on this Prism page before granting Bash railway:* access.
SKILL.md
READMESKILL.md - Domain
# Domain Management Add, view, or remove domains for Railway services. ## When to Use - User asks to "add a domain", "generate a domain", "get a URL" - User wants to add a custom domain - User asks "what's the URL for my service" - User wants to remove a domain ## Add Railway Domain Generate a railway-provided domain (max 1 per service): ```bash railway domain --json ``` For a specific service: ```bash railway domain --json --service backend ``` ### Response Returns the generated domain URL. Service must have a deployment. ## Add Custom Domain ```bash railway domain example.com --json ``` ### Response Returns required DNS records: ```json { "domain": "example.com", "dnsRecords": [ { "type": "CNAME", "host": "@", "value": "..." } ] } ``` Tell user to add these records to their DNS provider. ## Read Current Domains Use `environment` skill to see configured domains, or query directly: ```graphql query domains($envId: String!) { environment(id: $envId) { config(decryptVariables: false) } } ``` Domains are in `config.services.<serviceId>.networking`: - `serviceDomains` - Railway-provided domains - `customDomains` - User-provided domains ## Remove Domain Use `environment` skill to remove domains: ### Remove custom domain ```json { "services": { "<serviceId>": { "networking": { "customDomains": { "<domainId>": null } } } } } ``` ### Remove railway domain ```json { "services": { "<serviceId>": { "networking": { "serviceDomains": { "<domainId>": null } } } } } ``` Then use `environment` skill to apply and commit the change. ## CLI Options | Flag | Description | |------|-------------| | `[DOMAIN]` | Custom domain to add (omit for railway domain) | | `-p, --port <PORT>` | Port to connect | | `-s, --service <NAME>` | Target service (defaults to linked) | | `--json` | JSON output | ## Composability - **Read domains**: Use `environment` skill - **Remove domains**: Use `environment` skill - **Apply removal**: Use `environment` skill - **Check service**: Use `service` skill ## Error Handling ### No Service Linked ``` No service linked. Use --service flag or run `railway service` to select one. ``` ### Domain Already Exists ``` Service already has a railway-provided domain. Maximum 1 per service. ``` ### No Deployment ``` Service has no deployment. Deploy first with `railway up`. ``` ### Invalid Domain ``` Invalid domain format. Use a valid domain like "example.com" or "api.example.com". ``` # Environment Config Reference The `EnvironmentConfig` object is used to configure services, volumes, and shared variables in Railway. ## Structure ```json { "services": { "<serviceId>": { "source": { ... }, "build": { ... }, "deploy": { ... }, "variables": { ... }, "networking": { ... } } }, "sharedVariables": { ... }, "volumes": { ... }, "buckets": { ... } } ``` Only include fields being changed. The patch is merged with existing config. Apply changes via CLI: `echo '<json>' | railway environment edit --json` ## Service Config ### Source | Field | Type | Description | |-------|------|-------------| | `image` | string | Docker image (e.g., `nginx:latest`) | | `repo` | string | Git repository URL | | `branch` | string | Git branch to deploy | | `commitSha` | string | Specific commit SHA | | `rootDirectory` | string | Root directory (monorepos) | | `checkSuites` | boolean | Wait for GitHub check suites | | `autoUpdates.type` | disabled \| patch \| minor | Auto-update policy for Docker images | ### Build | Field | Type | Description | |-------|------|-------------| | `builder` | NIXPACKS \| DOCKERFILE \| RAILPACK | Build system | | `buildCommand` | string | Command for