---
title: "Deploy NextChat"
description: "Private chat UI for OpenAI, Claude, Gemini and more, behind an access code"
category: "AI/ML"
url: https://railway.com/deploy/nextchat-3
---

# Deploy NextChat

Private chat UI for OpenAI, Claude, Gemini and more, behind an access code

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

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

- **Creator:** Agaz Self-Host
- **Category:** AI/ML
- **Total deploys:** 1

## Template content

### NextChat https://cdn-1.webcatalog.io/catalog/nextchat/nextchat-icon-filled-256.webp?v=1724299451952

- **Image:** yidadaa/chatgpt-next-web:v2.16.1@sha256:eaaa469ddeeb5fa58fb35f8767e9e096a2f1c8468c54b6703323624bf3071c5a
- **Health check:** /
- **Public domain:** Yes

## Documentation

# Deploy and Host NextChat on Railway

NextChat (formerly ChatGPT-Next-Web) is an open-source web chat interface for large language models. It works with OpenAI, Anthropic Claude, Google Gemini, DeepSeek, xAI and other providers, plus any OpenAI-compatible endpoint. It supports prompt templates ("masks"), Markdown, streaming replies and a responsive layout for desktop and mobile.

## About Hosting NextChat

NextChat is a single Next.js server with no database. This template runs the official `yidadaa/chatgpt-next-web` image, pinned to release v2.16.1 by digest, behind a Railway domain with a health check on `/`. Chats and settings are stored in each visitor's browser, so the server needs no volume. The server's main job is to proxy chat requests to your AI provider. To stop the public URL from becoming an open proxy for your API key, the template generates a 32-character access code (`CODE`) at deploy time. Visitors must enter it before the server will use your provider keys. Add the provider keys you want after deploying.

## Common Use Cases

* A private ChatGPT-style chat page for yourself, a family or a small team, using your own API keys
* One interface for several providers (OpenAI, Claude, Gemini, DeepSeek, xAI) or a self-hosted OpenAI-compatible model server
* Sharing access with others through an access code without handing out the provider API key

## Dependencies for NextChat Hosting

* An API key from at least one supported AI provider (for example OpenAI, Anthropic or Google), or an OpenAI-compatible endpoint
* No database or volume: chat history is kept in the browser

### Deployment Dependencies

* NextChat source and docs: https://github.com/ChatGPTNextWeb/NextChat
* Release v2.16.1: https://github.com/ChatGPTNextWeb/NextChat/releases/tag/v2.16.1
* Docker image: https://hub.docker.com/r/yidadaa/chatgpt-next-web
* Environment variables reference: https://github.com/ChatGPTNextWeb/NextChat#environment-variables

### Implementation Details

After deploying, open the service's **Variables** tab to find the generated `CODE`. In NextChat, open **Settings → Access Code** and paste it. Then add at least one provider key, such as `OPENAI_API_KEY`, `ANTHROPIC_API_KEY` or `GOOGLE_API_KEY`, and Railway redeploys the service. `CODE` can hold several codes separated by commas, one per person.

Visitors who enter their own API key in Settings can chat without the access code, but they use their own key and never yours. Set `HIDE_USER_API_KEY=1` to turn that option off. NextChat writes access codes and your server API keys to its deploy logs, so only give Railway project access to people you trust.

## Why Deploy NextChat on Railway?


Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying NextChat on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.



## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/nextchat-3
