Self-host Dify on Railway for LLM apps and RAG chatbots

By Tracklayer · Updated 2026-11-20

Short answer: deploy a Dify template on Railway and open its gateway URL. Tracklayer’s Dify template runs the complete Dify 1.17 stack, including the console, API, workers, plugin daemon, code sandbox, Postgres, Redis and the Weaviate vector store, as fifteen services behind one HTTPS domain. Secrets are generated at deploy, so no input is required.

Deploy Dify on Railway

What Dify is for

Dify is an open-source platform for building LLM applications. You design chatbots, RAG knowledge bases, agents and multi-step workflows in a visual editor and publish them as web apps or APIs. Typical uses named in the template:

Why a single container is not enough

Self-hosting Dify means running far more than one container. The console talks to a Flask API. Celery workers index documents and run workflows, a beat scheduler fires timed jobs, a plugin daemon installs and runs plugins, and a code sandbox executes user code. Postgres stores metadata, Redis carries queues and locks, Weaviate holds embeddings, and uploaded files need object storage. A template wires all of that together.

Which AI app builder templates people deploy on Railway

TemplateCreatorDeploymentsServices
flowise-railwayHenry Heng's Projects8,5121
Langflow–2,8522
flowise-with-n8n-ai-automationderekcheungsa's Projects1,9743
AnythingLLMTimothy Carambat's Projects1,9721
DifyJack1,87111
Langflowalphasec1,2842
FlowiseAIProtemplate7822
Langflow Pre-releases–3582

Railway marketplace data as of 2026-11-19. Full ranking: Best AI app builder templates on Railway.

Dify, Flowise, Langflow and similar tools overlap but differ in scope. Check each template page for the services it deploys and whether it pins versions.

Deploy Dify on Railway, step by step

These steps use Tracklayer’s Dify 1.17 AI App Studio template.

  1. Deploy the template. Nothing needs to be entered. It creates the Gateway (the only public service), Web, API, API WebSocket, Worker, Worker Beat, Plugin Daemon, Sandbox, two SSRF proxies, Agent Backend, Agent Sandbox, Weaviate, Postgres, Redis and a Railway Bucket.
  2. Wait for the API to finish migrating. The first boot takes 1 to 3 minutes. Watch the API logs.
  3. Open the install page. Go to the Gateway URL plus /install. Dify asks for an init password: copy INIT_PASSWORD from the API service variables.
  4. Create the owner account. Then add a model provider under Settings, Model Provider. This installs a plugin from the Dify marketplace.
  5. Optional: custom domain. Add it to the Gateway service, set DIFY_PUBLIC_URL on API to https://your.domain and NEXT_PUBLIC_SOCKET_URL on Web to wss://your.domain, then redeploy.
  6. Optional: email. Set MAIL_TYPE (smtp or resend), MAIL_DEFAULT_SEND_FROM and the matching variables on API, Worker and Worker Beat to enable invitations and password resets.

What is stored where

Postgres, Redis, Weaviate, the plugin daemon, the code sandbox and the agent sandbox each use a volume. Uploaded files and generated assets go to a Railway Bucket. Two Squid proxies filter outgoing requests so the sandboxes cannot reach private networks. Back up Postgres and the Weaviate volume before major upgrades.

Costs

Railway bills usage, and fifteen services in one project means memory across the services is the main cost driver. The Worker and Plugin Daemon grow under load, and each running plugin adds roughly 100 to 150 MB.

The template’s own resource table gives about 2.2 GB of RAM idle and about 5.1 GB under typical team use, with about 7.3 GB of volume. At Railway’s unit prices that is roughly $26 per month idle and $64 per month typical, plus about $0.15 per month for 10 GB of uploads in the Bucket.

These are estimates from upstream defaults and typical footprints, not measurements on Railway. The template lists Hobby as the minimum plan and recommends Pro for teams.

Scaling and upgrades

Limitations and licence

Dify is distributed under the Dify Open Source License, which is Apache 2.0 with additional conditions. Running it for your own organisation is permitted. Operating it as a multi-tenant service for third parties, or removing the logo and copyright from the console, requires a commercial licence from LangGenius. This is a community template and is not affiliated with LangGenius.

Other options

See the full ranking of AI app builder templates on Railway. If you only need a chat interface rather than an app builder, see ChatGPT-style UIs on Railway. For all guides, see /guides/.

FAQ

How do I log in to Dify the first time?

Wait for the API logs to show the migrations finished, which takes 1 to 3 minutes on first boot. Open the Gateway URL at /install, enter INIT_PASSWORD from the API service variables, then create the owner account. Add a model provider under Settings, Model Provider.

Is my data kept across redeploys?

Yes. Postgres, Redis, Weaviate, the plugin daemon, the code sandbox and the agent sandbox use volumes, and uploaded files go to a Railway Bucket.

How much does it cost to run Dify on Railway?

The template's own estimate is about $26 per month idle and about $64 per month for typical team use, plus a small Bucket charge. These are estimates from upstream defaults and typical footprints, not measurements, so check your own usage after deploying. The minimum plan is Hobby.

Can I use Dify commercially if I self-host it?

Dify uses the Dify Open Source License, which is Apache 2.0 with additional conditions. Running it for your own organisation is permitted. Operating it as a multi-tenant service for third parties, or removing the console logo and copyright, requires a commercial licence from LangGenius. Ask a lawyer if your use is customer-facing.