---
title: "Deploy LlamaIndex Apps | Streamlit on the Port the Platform Assigns"
description: "Streamlit apps that bind the assigned port. The stock one never does."
category: "AI/ML"
url: https://railway.com/deploy/llamaindex-apps-or-streamlit-on-the-port
---

# Deploy LlamaIndex Apps | Streamlit on the Port the Platform Assigns

Streamlit apps that bind the assigned port. The stock one never does.

**[Deploy LlamaIndex Apps | Streamlit on the Port the Platform Assigns on Railway](https://railway.com/template/llamaindex-apps-or-streamlit-on-the-port)**

- **Creator:** Pavel Volkov's Projects
- **Category:** AI/ML
- **Total deploys:** 1

## Template content

### chat-with-pdf

- **Source:** https://github.com/ak40u/llama-index-railway
- **Start command:** `streamlit run streamlit_app.py --server.port $PORT --server.address 0.0.0.0 --server.headless true`
- **Health check:** /_stcore/health
- **Public domain:** Yes

### summarize-url

- **Source:** https://github.com/ak40u/llama-index-railway
- **Start command:** `streamlit run streamlit_app.py --server.port $PORT --server.address 0.0.0.0 --server.headless true`
- **Health check:** /_stcore/health
- **Public domain:** Yes

## Documentation

# LlamaIndex apps on Streamlit

Two small LlamaIndex apps - chat with a PDF, and summarize a URL - deployed as
separate services.

## What this fixes

The existing LlamaIndex Apps template reports **0% health**: no deployment of it
succeeds. The cause is one line, and it is in the template rather than the code.

Its start command is a bare `streamlit run streamlit_app.py`. Streamlit then
listens on its own default port, which is not the port the platform assigns and
routes to. The template does set a `PORT` variable - but Streamlit does not read
`PORT`; it wants `--server.port` or `STREAMLIT_SERVER_PORT`, so that variable
changes nothing.

Here the start command passes it explicitly:

```
streamlit run streamlit_app.py --server.port $PORT --server.address 0.0.0.0 --server.headless true
```

`--server.headless true` matters in a container too: without it Streamlit tries
to open a browser and prompts for an email on first run.

## Verified

Both services deployed and answered `/_stcore/health` with `ok`, and their logs
show a clean start with no import errors. The apps themselves need an OpenAI API
key, which you enter in the app's own sidebar - that part is not exercised here,
and nothing in this template asks you for a key up front.

## The apps

- **chat-with-pdf** - upload a PDF, ask questions about it
- **summarize-url** - give it a link, get a summary

Both are unmodified from the upstream project by alphasec, MIT licensed:
https://github.com/alphasecio/llama-index

The only change is the start command.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/llamaindex-apps-or-streamlit-on-the-port
