railway add
Add a new service to your Railway project. You can add databases, GitHub repos, Docker images, or empty services.
Usage
Options
| Flag | Description |
|---|---|
-d, --database <TYPE> | Add a database (postgres, mysql, redis, mongo) |
-s, --service [NAME] | Create an empty service (optionally with a name) |
-r, --repo <REPO> | Create a service from a GitHub repo |
-i, --image <IMAGE> | Create a service from a Docker image |
-v, --variables <KEY=VALUE> | Environment variables to set on the service |
--verbose | Enable verbose logging |
--json | Output in JSON format |
Examples
Interactive mode
Prompts you to select what type of service to add.
Add a database
Add multiple databases at once:
Add from GitHub repo
Add from Docker image
Create an empty service
With a specific name:
Add with environment variables
Behavior
When you add a service, it's automatically linked to your current directory. For databases, the new service is automatically deployed.