# Railway Deployment Tutorial for an AI-Generated App

> A beginner Railway deployment tutorial for publishing a vibe-coded AI app from GitHub, including secrets, domains, logs, and updates.

![Railway service page](/assets/blog/how-to-publish-an-ai-generated-app-on-railway/01-service-page.png)

## Before you start

This Railway deployment tutorial is for an AI-generated app that needs a running server, such as an API, login system, database connection, or background process. Railway is a practical **vibe coding hosting** option because it can build the code from GitHub, run the server, and redeploy later changes automatically.

Before you begin, make sure you have:

- A Railway account connected to GitHub
- A GitHub repository for the app
- A working local version of the app
- The names and values of any required environment variables

Keep real secrets outside Git. Never commit an API key, database password, private token, or populated `.env` file.

## 1. Make the app production-ready

AI coding tools often create a development command but forget the production setup. Your app **must have a start command**, and its server must listen on the port specified by Railway’s `PORT` environment variable.

Check these parts before publishing:

- **Start command:** Add a production command such as `npm start` or `uvicorn main:app`.
- **Port:** Read the port from the environment instead of fixing it to `3000` or `8000`.
- **Host:** Bind the server to `0.0.0.0`, not only `localhost`.
- **Dependencies:** Commit the manifest and lockfile, such as `package.json` and `package-lock.json`.

For Express, use `process.env.PORT || 3000` and listen on `0.0.0.0`. For FastAPI, a start command could be `uvicorn main:app --host 0.0.0.0 --port $PORT`. Railway documents more examples in its [public networking troubleshooting guide](https://docs.railway.com/networking/troubleshooting/application-failed-to-respond).

## 2. Push it to GitHub

Create a GitHub repository, then upload or push the app. Before the first push:

1. Add `.env`, private keys, and local database files to `.gitignore`.
2. Commit the source code, dependency files, and production configuration.
3. Confirm that the repository contains the server entry point.

An `.env.example` file may list variable names such as `OPENAI_API_KEY=` without including real values. This helps you remember what Railway needs without exposing credentials.

## 3. Create a Railway project from the repo

In Railway, choose **New Project**, select **Deploy from GitHub repo**, and authorize access if prompted. Pick the repository and deployment branch. Railway will inspect the project, install its dependencies, build it, and run the detected start command.

If detection fails, open the service’s Settings and enter a custom command under Deploy. Railway explains this option in its [start command documentation](https://docs.railway.com/deployments/start-command).

![Railway GitHub autodeploy guide](/assets/blog/how-to-publish-an-ai-generated-app-on-railway/02-github-deploy.png)

## 4. Add environment variables

Open the service, select **Variables**, and add each required value with **New Variable** or the Raw Editor. Common examples include:

- `OPENAI_API_KEY` for an AI provider
- `DATABASE_URL` for persistent data
- `NODE_ENV=production` for a Node app

Enter secrets in Railway, never in a Git commit. Railway injects variables into the build and running service. It also supplies `PORT`, so you normally should not create that variable yourself. Review and deploy staged changes after editing variables. See [Railway’s variables guide](https://docs.railway.com/variables) for the current controls.

## 5. Generate a public Railway domain

A deployed service is not automatically public. To expose it:

1. Open the service’s **Settings** tab.
2. Find **Networking**, then **Public Networking**.
3. Select **Generate Domain**.

Railway creates an HTTPS address ending in `.up.railway.app`. Confirm that its target port matches the port used by your server. The [official domain guide](https://docs.railway.com/networking/domains/working-with-domains) also covers custom domains and SSL.

![Railway public domain guide](/assets/blog/how-to-publish-an-ai-generated-app-on-railway/03-public-domain.png)

## 6. Test the deployment and logs

Open the public URL in a private browser window. Test the home page and one real server action, such as submitting a form, signing in, or sending an AI request. A page loading correctly does not prove that its API calls work.

| Symptom | What to inspect |
|---|---|
| Application failed to respond | Host and `PORT` binding |
| Service exits immediately | Start command and missing dependencies |
| Feature fails in production | Environment variables and external URLs |
| Build fails | Build logs and dependency versions |

Click the deployment to inspect build and runtime output. Railway captures messages written to standard output and standard error. Its [logging guide](https://docs.railway.com/observability/logs) notes a limit of **500 log lines per second per replica**, so avoid noisy debug logging in production.

## Update the app

Push a new commit to the connected branch when you want to update the app. GitHub-linked services normally start a fresh deployment automatically, as described in Railway’s [GitHub autodeploy guide](https://docs.railway.com/deployments/github-autodeploys). Test the public domain again after the deployment succeeds.

For client work, you can place that live demo beside a proposal, deck, or instructions in a private Revdoku bucket. The shared Revdoku link stays the same while you update the deliverables, and password or email gates let you control access and see when a client opens them.

## Deployment checklist

| Item | What to check | Why it matters |
|---|---|---|
| **Start command** | A production server command exists | Railway needs a process to run |
| **Networking** | Server uses `0.0.0.0` and Railway’s `PORT` | Public requests can reach the app |
| **Secrets** | Values exist only in Railway | Credentials stay out of Git |
| **Domain** | A Railway domain is generated | The app becomes publicly accessible |
| **Testing** | Pages, server actions, and logs work | The deployment is ready to share |

Your site is live.

Just ask to &ldquo;publish to Revdoku&rdquo; to
publish your HTML pages presentation dashboard app prototype game prototype
as a fast and secure website

from your Codex , Claude or another AI app publish files or folders

Connect
Skill
MCP

Paste this into your AI app.

Copy

Install the Revdoku skill in your AI app.

Copy
npx skills add revdoku/revdoku --skill revdoku -g

Choose your AI app to connect through MCP.

Codex CLI
Claude Code
Other

Copy codex mcp add revdoku --url https://app.revdoku.com/mcp
codex mcp login revdoku

Copy claude mcp add --transport http revdoku https://app.revdoku.com/mcp
claude mcp login revdoku

Transport Streamable HTTP Auth Browser OAuth

Copy https://app.revdoku.com/mcp

Open the MCP setup guide &rarr;

Free · Public or protected · Visitor analytics · Forms and email alerts Building websites for clients? Explore Revdoku for agencies →

---

[View the canonical page](https://revdoku.com/blog/how-to-publish-an-ai-generated-app-on-railway/) · [Browse llms.txt](https://revdoku.com/llms.txt)
