---
title: "Deploy rail-tunnel"
description: "Self-hosted tunneling server for Railway - expose localhost to internet"
category: "Other"
url: https://railway.com/deploy/rail-tunnel
---

# Deploy rail-tunnel

Self-hosted tunneling server for Railway - expose localhost to internet

**[Deploy rail-tunnel on Railway](https://railway.com/template/rail-tunnel)**

- **Category:** Other
- **Total deploys:** 50

## Template content

### rail-tunnel

- **Source:** isaui/rail-tunnel

## Documentation

# Deploy and Host rail-tunnel on Railway

Rail Tunnel is a professional tunneling server that exposes your local development servers to the internet via WebSocket connections. Built with Go, it enables developers to securely share localhost applications for testing, demos, and collaboration. Use `npx rail-tunnel tunnel --port  --remote https://your-app.railway.app` to instantly tunnel any local port.

## About Hosting rail-tunnel

Deploying rail-tunnel on Railway requires zero configuration - Railway automatically detects the Go application and builds it using the included Dockerfile. The server exposes WebSocket endpoints for tunnel clients and proxies HTTP requests to connected local development servers. After deployment, developers install the CLI (`npm install -g rail-tunnel`) and connect their local apps using the simple command format. Railway automatically handles environment variables like PORT and provides HTTPS endpoints for secure tunneling connections.

## Common Use Cases

- **Local Development Sharing** - Share localhost apps with teammates instantly using `npx rail-tunnel tunnel --port  --remote https://your-app.railway.app`
- **Webhook Testing** - Receive webhooks from GitHub, Stripe, PayPal directly on your local development environment without ngrok
- **Mobile API Testing** - Test your local backend API from mobile devices and different networks seamlessly for responsive development

## Dependencies for rail-tunnel Hosting

None

### Deployment Dependencies

- [Rail Tunnel CLI](https://www.npmjs.com/package/rail-tunnel) - NPM package for connecting local apps
- [Go Gin Framework](https://gin-gonic.com/) - Web framework for HTTP and WebSocket handling
- [Gorilla WebSocket](https://github.com/gorilla/websocket) - WebSocket implementation for real-time tunneling

## Implementation Details

After deployment, connect any local application:

```bash
# Install CLI globally
npm install -g rail-tunnel

# Tunnel your localhost to Railway
npx rail-tunnel tunnel --port  --remote https://your-app.railway.app

# Your localhost: is now accessible via Railway URL
```

The server handles multiple concurrent connections and provides health monitoring endpoints at `/_tunnel/health`.

## Why Deploy rail-tunnel on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying rail-tunnel on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.



## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — [Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/rail-tunnel
