Railway Integration
Railway is a modern deployment platform that makes it easy to deploy web applications, databases, and services. The EnvManager Railway integration allows you to automatically sync your environment variables from EnvManager directly to your Railway projects and services.
When you connect Railway to EnvManager, your variables stay in sync automatically. No more copy-pasting variables or managing secrets in multiple places.
What You Can Do
With the Railway integration, you can:
- Connect your Railway account with a secure API token
- Choose your sync target - sync to specific services or shared project variables
- Map environments - control which EnvManager environment syncs to which Railway environment
- Automatic syncing - variables update in Railway whenever you change them in EnvManager
- Manual sync control - trigger syncs on demand when you need them
- Track sync history - see when variables were synced and if any errors occurred
Before You Begin
To connect Railway, you need:
- An EnvManager account with a project created
- A Railway account with at least one project
- Admin or Owner role in your EnvManager organization (required to manage integrations)
- A Railway API token (we'll show you how to create one)
Understanding Railway Variables
Railway supports two types of variable storage:
| Type | Description | Best For |
|---|---|---|
| Service Variables | Variables specific to one service only | Service-specific configuration like PORT, REDIS_URL |
| Shared Variables | Variables available to all services in a project | Common config like DATABASE_URL, API_KEY shared across services |
EnvManager lets you choose which type to sync to based on your needs.
About Railway Workspaces: If you're part of multiple Railway teams, you can choose which workspace to sync from during setup. Personal projects use your personal account.
Connecting Your Railway Account
Navigate to Integrations
From your EnvManager project, click the Integrations tab in the navigation menu.
Open the Railway Connection Modal
Find the Railway card and click the Connect button.
Create a Railway API Token
You need an API token from Railway:
- Open railway.app/account/tokens in a new tab
- Click Create Token
- Give it a name like "EnvManager Sync"
- Important: Leave the "Workspace" field unselected to allow access to all your workspaces
- Click Create and copy the token immediately (you won't see it again)
Security Note: Railway tokens have full access to your account. Store them securely and never share them publicly. You can revoke tokens anytime from Railway's token management page.
Enter Connection Details
Back in EnvManager:
- Connection Name - Give this connection a friendly name (e.g., "My Railway Account")
- API Token - Paste the token you copied from Railway
- Click Validate Token to test the connection
Validate Your Connection
EnvManager will check if the token works and show:
- A success checkmark if the token is valid
- Your Railway account email
- The number of workspaces you have access to
Select a Workspace (If Applicable)
If you have multiple Railway workspaces, choose which one to sync projects from. Personal projects are in your personal account.
Complete the Connection
Click Connect to save the connection. Your Railway account is now linked to this EnvManager organization.
Configuring Your Sync
After connecting Railway, you need to configure where and how your variables should sync.
Open Configuration
On the Railway integration card, click Configure to open the sync configuration modal.
Choose Your Railway Project
- Select Workspace - Choose between your personal account or a team workspace (if applicable)
- Search Projects - Use the search box to filter if you have many projects
- Select Project - Pick the Railway project you want to sync to
Choose Your Sync Target
You'll see two options:
Shared Variables (Recommended)
Variables are synced to the project level and available to all services. This is ideal when:
- Multiple services need the same configuration
- You have shared resources like databases
- You want to manage variables in one place
Specific Service
Variables are synced to one service only. Choose this when:
- You have service-specific configuration
- Different services need different values for the same key
- You want to isolate variables per service
Select the option that fits your needs. If you choose "Specific Service", a dropdown will appear to select which service.
Map Your Environments
Railway projects have environments like "production" and "staging". You need to map your EnvManager environments to Railway environments.
For each EnvManager environment (Development, Staging, Production):
- Check the Railway environment(s) you want to sync to
- You can map one EnvManager environment to multiple Railway environments
- Unchecked environments won't receive variable updates
Example Mapping:
- EnvManager "Production" → Railway "production" ✓
- EnvManager "Staging" → Railway "staging" ✓
- EnvManager "Development" → Railway "staging" ✓ (if you want dev to also update staging)
Environment names are color-coded to help you match them correctly. Production environments show in green, staging in yellow, and development in blue.
Configure Sync Options
Choose what and when to sync:
| Option | Description | Recommended |
|---|---|---|
| Auto-sync | Automatically sync when variables change in EnvManager | Enabled for most use cases |
| Sync secrets | Include secret variables (they'll be visible in Railway) | Enabled |
| Sync regular variables | Include non-secret variables | Enabled |
About Secrets in Railway: When you sync secret variables to Railway, they become visible in the Railway dashboard. Railway's "sealed variables" feature (which hides values) can only be created through Railway's UI, not through the API.
Save Configuration
Review your settings and click Save Configuration. Your sync is now active.
Syncing Variables
Automatic Syncing
If you enabled auto-sync, EnvManager will automatically push variables to Railway whenever:
- You add a new variable
- You edit an existing variable's value
- You delete a variable
Changes typically appear in Railway within seconds.
Manual Syncing
You can trigger a sync manually at any time:
Click Sync Now
On the Railway integration card, click the Sync Now button.
Watch the Progress
A progress indicator shows the sync status. The sync will:
- Gather variables from mapped EnvManager environments
- Push them to the configured Railway target
- Update each mapped Railway environment
- Show success or error status
Verify in Railway
Open your Railway project dashboard to confirm the variables appeared correctly.
Manual sync is useful when you want to ensure variables are updated immediately or if you want to verify the integration is working correctly.
Viewing Sync History
Track all sync operations to troubleshoot issues or verify when variables were updated.
Expand Sync History
On the Railway integration card, click Sync History to expand the history section.
Review Sync Entries
Each entry shows:
- Timestamp - When the sync occurred
- Status - Success, partial success, or error
- Details - Number of variables synced, which environments were updated
- Error Message - If the sync failed, why it failed
Load More History
Click Load More at the bottom to see older sync operations.
Understanding Sync Statuses
| Status | Meaning | What to Do |
|---|---|---|
| Success | All variables synced successfully | Nothing needed |
| Partial Success | Some environments synced, others failed | Check error details for specific environment issues |
| Error | Sync completely failed | Review error message, check Railway token is still valid |
Managing Your Connection
Updating Configuration
To change which Railway project or service you sync to:
- Click Configure on the Railway integration card
- Make your changes (select different project, service, or environment mappings)
- Click Save Configuration
The new configuration takes effect immediately for the next sync.
Disconnecting Railway
To remove the Railway integration:
- Click the Disconnect button on the Railway integration card
- Confirm the disconnection in the dialog that appears
Important: Disconnecting does NOT remove variables from Railway. Your variables remain in Railway projects, but future changes in EnvManager won't sync.
Reconnecting
If you disconnect and want to reconnect later:
- Click Connect again and go through the connection process
- You can use the same Railway token or create a new one
- You'll need to reconfigure your sync target and environment mappings
Tips & Best Practices
Start with Manual Sync
When setting up Railway integration for the first time:
- Configure the sync with auto-sync disabled
- Trigger a manual sync to verify everything works
- Check Railway to confirm variables appeared correctly
- Enable auto-sync once you're confident it's working
Map Environments Carefully
Think about your deployment workflow:
- If Railway's "staging" is for testing → map EnvManager's "Staging" environment
- If Railway's "production" is live → map EnvManager's "Production" environment only
- Avoid mapping the same Railway environment to multiple EnvManager environments unless intentional
Use Shared Variables for Common Config
Database URLs, API endpoints, and other shared configuration work best as shared variables. This avoids duplicating the same variable across multiple services.
Use Service Variables for Service-Specific Config
Port numbers, service-specific feature flags, and service-specific API keys work best as service variables. This keeps each service's configuration isolated.
Monitor Sync History
Check the sync history periodically, especially after major changes:
- Verify successful syncs after adding many variables
- Catch errors early before they affect deployments
- Use timestamps to correlate EnvManager changes with Railway deployments
Keep Your Token Secure
Your Railway API token has full access to your account:
- Store it securely in EnvManager (we encrypt it)
- Don't share the token with others
- Rotate tokens periodically for security
- Revoke old tokens from Railway's token management page
Troubleshooting
"Invalid token" error during connection
Cause: The Railway API token is incorrect, expired, or doesn't have proper permissions.
Solution:
- Go to railway.app/account/tokens
- Verify the token still exists and hasn't been revoked
- Create a new token and ensure "Workspace" is left unselected
- Try connecting again with the new token
Variables not appearing in Railway
Cause: Environment mapping might be incorrect, or the sync failed silently.
Solution:
- Click Configure and verify your environment mappings
- Check that at least one Railway environment is mapped for each EnvManager environment
- Review the sync history for error messages
- Try a manual sync and watch for errors
- Verify you have permission to edit variables in the Railway project
Sync shows "Partial Success"
Cause: Some Railway environments synced successfully, but others failed.
Solution:
- Expand the sync history entry to see which environment failed
- Check if that Railway environment still exists
- Verify the Railway project structure hasn't changed
- Try syncing again to see if it was a temporary issue
Changes in EnvManager not syncing automatically
Cause: Auto-sync might be disabled, or the sync is failing.
Solution:
- Click Configure and verify "Auto-sync" is enabled
- Check the sync history for recent failed syncs
- Verify your Railway token is still valid (not revoked)
- Try a manual sync to test if the connection still works
"Project not found" error
Cause: The Railway project was deleted or moved to a different workspace.
Solution:
- Click Configure to update your sync target
- Select the correct workspace if the project was moved
- Choose the new project or service
- Save the updated configuration
Variables synced but Railway service not picking them up
Cause: Railway services may need a redeploy to pick up new variables.
Solution:
- Verify variables appear in Railway's project dashboard
- Trigger a redeploy of your Railway service
- Railway automatically redeploys on variable changes, but manual redeploys may be needed in some cases
Related Topics
Variables Overview
Learn how to create and manage variables in EnvManager.
Environments
Understand environments and how they organize your variables.
Vercel Integration
Connect Vercel for seamless frontend deployments.
Access Control
Manage who can configure integrations and sync variables.