---
title: "Deploy NextChat"
description: "Pinned NextChat with generated access code, optional OpenAI-compatible API."
category: "AI/ML"
url: https://railway.com/deploy/nextchat-1
---

# Deploy NextChat

Pinned NextChat with generated access code, optional OpenAI-compatible API.

**[Deploy NextChat on Railway](https://railway.com/template/nextchat-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/nextchat-1/manifest.json

- **Creator:** leodev
- **Category:** AI/ML

## Template content

### nextchat

- **Image:** yidadaa/chatgpt-next-web:v2.16.1
- **Public domain:** Yes

## Documentation

# Deploy and Host NextChat on Railway

Pinned [NextChat](https://github.com/ChatGPTNextWeb/NextChat) (ChatGPT-Next-Web) on Railway: official Docker image, generated access code, optional OpenAI-compatible backend.

This listing deploys `yidadaa/chatgpt-next-web:v2.16.1` (manifest `sha256:eaaa469ddeeb5fa58fb35f8767e9e096a2f1c8468c54b6703323624bf3071c5a`) — the current image published by ChatGPTNextWeb/NextChat. It does **not** Nix-build the redirected `Yidadaa/ChatGPT-Next-Web` GitHub URL.

## About Hosting NextChat

NextChat is a self-hosted ChatGPT-style UI. It proxies requests to OpenAI or any OpenAI-compatible backend and stores chat history in the browser, so no database or volume is required. Hosting your own instance lets you generate a shared `CODE` access password, optionally embed `OPENAI_API_KEY`, and point `BASE_URL` at LiteLLM, LocalAI, vLLM, OpenRouter, or a custom proxy.

One-click deploy:

1. Click **Deploy on Railway**.
2. Railway generates `CODE`. Copy it from the service variables after deploy.
3. Optionally paste `OPENAI_API_KEY`, or leave it empty and enter a key in the UI.
4. Optionally set `BASE_URL` for an OpenAI-compatible API.
5. Open the public HTTPS domain and enter `CODE` when prompted.

## Common Use Cases

- **Shared team UI** — one generated access code, optional server-side API key so teammates do not each manage credentials.
- **OpenAI-compatible frontend** — set `BASE_URL` at a self-hosted or third-party `/v1` endpoint (LiteLLM, LocalAI, vLLM, OpenRouter).
- **Locked-down public domain** — unlike clones that ship no `CODE`, this template generates an access password so the HTTPS URL is not an open proxy.

## Dependencies for NextChat Hosting

- None required to boot the UI. An API key for at least one provider is needed to chat (OpenAI via `OPENAI_API_KEY`, another vendor in Settings, or `BASE_URL` plus that backend's key).
- No volume. Chats live in the browser (export/import or WebDAV if you want backups).
- Port `3000` with a Railway public HTTP domain.

### Deployment Dependencies

- Image: `yidadaa/chatgpt-next-web:v2.16.1` ([ChatGPTNextWeb/NextChat](https://github.com/ChatGPTNextWeb/NextChat), Docker Hub `yidadaa/chatgpt-next-web`)
- [Upstream environment variables](https://github.com/ChatGPTNextWeb/NextChat#environment-variables)

| Variable | Required | Default | Notes |
| --- | --- | --- | --- |
| `CODE` | generated | `${{secret()}}` | Access password. Comma-separate multiple codes. |
| `OPENAI_API_KEY` | optional | empty | Server-side OpenAI key. Leave empty to paste a key in Settings. |
| `BASE_URL` | optional | empty (`https://api.openai.com`) | OpenAI-compatible API base URL. |
| `HOSTNAME` | set | `0.0.0.0` | Bind address inside the container. |
| `PORT` | set | `3000` | HTTP listen port. |

Optional provider keys you can add later: `GOOGLE_API_KEY`, `ANTHROPIC_API_KEY`, `AZURE_URL` + `AZURE_API_KEY`, `DEEPSEEK_API_KEY`.

**Login:** open the Railway HTTP domain. NextChat asks for **Access Code** — that is the generated `CODE` variable.

**Healthcheck:** the image has no dedicated `/health` path. Railway `GET /` healthchecks fail on Next.js host checks (`healthcheck.railway.app`). Verify with `curl` of the public domain: `GET /` returns HTTP 200 and ``.

## Why Deploy NextChat on Railway?

The search-winning NextChat card still Nix-builds `Yidadaa/ChatGPT-Next-Web` (GitHub redirect), ships no access code, and has no healthcheck (health ~50). This template pins the current ChatGPTNextWeb/NextChat Docker tag (not `:latest`, not a Nixpacks GitHub clone), generates `CODE`, leaves `OPENAI_API_KEY` empty/optional, documents `BASE_URL`, and restarts on failure.

Railway hosts the container, public HTTPS domain, and generated secret so you do not have to run Docker yourself.


## 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/nextchat-1
