Skip to content

Add purchased domains CLI management - #1007

Open
m-abdelwahab wants to merge 2 commits into
masterfrom
agent/domains-management
Open

m-abdelwahab wants to merge 2 commits into
masterfrom
agent/domains-management

Conversation

@m-abdelwahab

Copy link
Copy Markdown
Collaborator

Summary

Adds railway domains for managing Railway-purchased domains from the CLI.

This is separate from the existing singular railway domain command, which manages service-attached domains. The bare railway domains command intentionally requires a subcommand.

Purchasing and transferring domains are not implemented in the CLI. Search results provide a browser handoff to railway.com/domains.

Command Surface

# Search and availability
railway domains search [query...] [--limit N] [--json]
railway domains check <domain...> [--json]

# Owned domain inventory
railway domains list [--workspace <id-or-name>] [--status active|purchasing|expired|refunded|all] [--json]
railway domains ls [--workspace <id-or-name>] [--status active|purchasing|expired|refunded|all] [--json]
railway domains status <domain-or-id> [--workspace <id-or-name>] [--json]

# Auto-renew
railway domains auto-renew status <domain-or-id> [--workspace <id-or-name>] [--json]
railway domains auto-renew enable <domain-or-id> [--workspace <id-or-name>] [--json]
railway domains auto-renew disable <domain-or-id> [--workspace <id-or-name>] [--json]

# DNS records
railway domains dns list <domain> [--workspace <id-or-name>] [--json]

railway domains dns create <domain> \
  --type A|AAAA|ANAME|CNAME|MX|NS|SRV|TXT \
  --host <host> \
  --answer <value> \
  [--ttl <seconds>] \
  [--priority <number>] \
  [--workspace <id-or-name>] \
  [--json]

railway domains dns update <domain> <record-id> \
  --type A|AAAA|ANAME|CNAME|MX|NS|SRV|TXT \
  --host <host> \
  --answer <value> \
  [--ttl <seconds>] \
  [--priority <number>] \
  [--workspace <id-or-name>] \
  [--json]

railway domains dns delete <domain> <record-id> [--workspace <id-or-name>] [--yes] [--json]

# Nameserver delegation
railway domains nameservers list <domain-or-id> [--workspace <id-or-name>] [--json]
railway domains nameservers set <domain-or-id> <nameserver...> [--workspace <id-or-name>] [--yes] [--json]
railway domains nameservers reset <domain-or-id> [--workspace <id-or-name>] [--yes] [--json]

Search UX

In an interactive terminal, railway domains search opens a TUI similar to railway templates search.

  • Type to search.
  • Results update live through the domain search websocket.
  • Rows show availability, purchase price, and renewal price with color.
  • Enter selects the highlighted domain.
  • If the selected domain is purchasable, the CLI opens:
    https://railway.com/domains?q=<domain>&purchase=true
  • The URL is also printed as a fallback for SSH/headless environments.

Non-interactive and JSON behavior remains script-friendly:

railway domains search example --limit 10 --json
railway domains check example.com example.dev --json

Implementation Notes

  • Reuses the Railway domains websocket endpoint for search/check: wss://backboard.railway.com/domain-search
  • Search prices are parsed as decimal dollar values, matching the websocket response.
  • JSON search/check results include purchaseUrl only for purchasable domains.
  • Account-scoped operations use the GraphQL API for purchased domain inventory, DNS records, auto-renew, and nameserver delegation.
  • --json workspace resolution avoids interactive/fake-select output so JSON stays valid.
  • Nameserver validation allows 2-13 nameservers, matching the API schema.
  • Destructive operations require --yes in non-interactive mode.

Testing

cargo test domains::tests
cargo test purchased_domains_subcommands
cargo build --bin railway
cargo check
git diff --check

Also smoke-tested:

  • public domain search/check against the live websocket
  • authenticated domains list against a real Railway account
  • TUI search in a pseudo-terminal
  • Enter selection browser handoff fallback in a headless environment

@m-abdelwahab m-abdelwahab added the release/minor Author minor release label Jul 9, 2026
@m-abdelwahab
m-abdelwahab marked this pull request as ready for review July 14, 2026 10:21
…ement

Conflict resolutions:
- src/gql/schema.json: take master's schema; it already contains every railwayDomain* query/mutation and type the PR's .graphql files use (codegen builds clean)
- src/commands/sandbox.rs: drop the PR's region: None in SandboxCreateInput; master added the same field independently
@codyde codyde added release/skip Author no release and removed release/minor Author minor release labels Nov 10, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/skip Author no release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants