← Blog

Monitor your SaaS on Railway — public health check

Railway runs your API container or web service with a generated public URL (*.up.railway.app) or a custom domain. External uptime monitoring needs that URL plus a GET /health (or /api/health) that returns 200 without authentication.

Pair this guide with the generic Health check quickstart. Next.js on Vercel: Vercel monitoring.

1. Expose a health route in your service

Express (Node) example:

app.get("/health", (_req, res) => {
  res.status(200).json({ status: "ok", service: "my-saas" });
});

FastAPI (Python) example:

@app.get("/health")
def health():
    return {"status": "ok"}

Bind the app to process.env.PORT (Railway injects it). Deploy from GitHub or railway up.

Optional: ping Postgres with SELECT 1 when DATABASE_URL is set — return 503 if you want StillOnline to mark down when the DB is unreachable (same trade-off as Vercel guide).

2. Confirm the public Railway URL

In the Railway service → SettingsNetworking → enable Public Networking. Copy the HTTPS URL, e.g. https://my-saas-production.up.railway.app.

From your laptop:

curl -sS -w "\n%{http_code}\n" https://my-saas-production.up.railway.app/health

You want body JSON and trailing 200. If you see 502, the process is not listening on PORT yet. If 404, the path does not match your framework mount (/api prefix, etc.).

3. Custom domain (recommended before launch)

Point api.yourproduct.com CNAME to Railway. Wait for TLS, then curl the custom host — that is the URL you monitor long-term, not the ephemeral default hostname if you rotate services.

4. Register StillOnline

  1. Start free.
  2. Project with a public status slug.
  3. HTTP checkhttps://api.yourproduct.com/health (or Railway default host), GET, status 200, interval 5 min.
  4. Embed the status page link for customers.
  5. Pro+: automate with stillonline-mcp (MCP article).
PlanWhat you get
Free1 URL, public status page, 24h history
Pro ($9)10 URLs, private pages, API/MCP, 90d history

See Pricing. StillOnline is hosted SaaS — we do not run inside your Railway project.

5. Railway-specific ops notes

  • Sleep / scale to zero — if your plan sleeps idle services, external monitors show downtime while asleep; keep one replica or disable sleep for production APIs.
  • Migrations — brief 502 during deploy is normal; tune check intervals or accept a blip.
  • Workers vs web — monitor the web service users hit, not a background worker with no HTTP server.
  • Multiple services — Free = one URL; combine behind a gateway health or upgrade to Pro.

Compare alternatives: Best uptime 2026 · vs Uptime Kuma if you considered self-hosting instead.

FAQ

Railway private networking only?

StillOnline cannot reach private URLs. Public Networking or a tunnel is required.

Monitor default *.up.railway.app or custom domain?

Prefer custom domain before marketing the status page — fewer surprises when regenerating Railway defaults.

POST health with auth?

StillOnline Free checks use GET without custom headers. Use a public GET path or Pro features if your stack evolves.

Same project for API and worker?

Monitor the HTTP web service. Workers need separate observability (logs/metrics), not a fake /health on a queue consumer unless it exposes HTTP.

How is Railway different from Vercel for monitoring?

Both need a public HTTPS health URL. Implementation differs (long-running container vs serverless route) — see platform posts above.