Deploy ChatGPT UI
Multi-user ChatGPT web client with Django admin and Postgres
backend-wsgi-server
Just deployed
Just deployed
backend-web-server
Just deployed
Just deployed
/var/lib/postgresql/data
Deploy and Host ChatGPT UI on Railway
ChatGPT UI is an open-source, multi-user ChatGPT-style web client. Users sign in, keep their conversation history in a database, save prompts, upload documents for embedding, and optionally use web search, while an administrator manages users, models, API keys and feature switches from a Django admin panel.
About Hosting ChatGPT UI
This template runs the official upstream Docker images as four services:
- client: the Nuxt web frontend (wongsaang/chatgpt-ui-client), public domain on port 80. It proxies /api to the backend over private networking.
- backend-web-server: the upstream nginx image (wongsaang/chatgpt-ui-web-server), public domain on port 80. It serves the Django admin at /admin and its static files, and proxies everything else to the WSGI server.
- backend-wsgi-server: the Django + Gunicorn API (wongsaang/chatgpt-ui-wsgi-server), private only.
- Postgres: stores users, conversations, settings and the OpenAI API key, on a persistent volume.
Generated secrets: the Django SECRET_KEY (DJANGO_SECRET_KEY, used to sign login tokens) and the first administrator password (DJANGO_SUPERUSER_PASSWORD).
Authentication: every chat API call requires a signed-in user. Public self-registration is OFF by default (OPEN_REGISTRATION=False), so only the administrator and users the administrator creates can sign in.
After deploy:
- Open the backend-wsgi-server service, Variables tab, and copy DJANGO_SUPERUSER_PASSWORD. The username is admin (DJANGO_SUPERUSER_USERNAME).
- Open the backend-web-server public domain at https://YOUR-RAILWAY-DOMAIN/admin and sign in as admin.
- In the admin go to Chat, Settings, and set the value of openai_api_key to your OpenAI API key (create it if it is missing). Without a key the app runs but cannot answer chats.
- Create accounts for your users under Users in the admin, or set OPEN_REGISTRATION to True on backend-wsgi-server if you want open sign-up.
- Open the client public domain and sign in. That is the chat app your users use.
Common Use Cases
- A private ChatGPT interface for a team, family or classroom that shares one OpenAI API key
- Keeping conversation history in your own database instead of a third-party chat service
- Giving users access to GPT models without handing out the API key itself
- Testing prompts and saving reusable prompt templates
Dependencies for ChatGPT UI Hosting
- Frontend source: https://github.com/WongSaang/chatgpt-ui (MIT)
- Backend source: https://github.com/WongSaang/chatgpt-ui-server
- Images: wongsaang/chatgpt-ui-client:v2.5.9, wongsaang/chatgpt-ui-web-server:v2.5.2, wongsaang/chatgpt-ui-wsgi-server:v2.5.2
- An OpenAI API key (entered later in the admin panel, not needed to deploy)
Deployment Dependencies
- Documentation: https://wongsaang.github.io/chatgpt-ui/
- Configuration reference: https://wongsaang.github.io/chatgpt-ui/guide/configuration.html
- OpenAI API keys: https://platform.openai.com/api-keys
Implementation Details
- Upstream hard-codes a public Django SECRET_KEY in its settings. Because login tokens are signed with that key, anyone could forge an admin login against a stock install. The backend-wsgi-server start command replaces it with the generated DJANGO_SECRET_KEY before Django starts, then runs migrations, creates the admin user, applies OPEN_REGISTRATION and starts Gunicorn.
- Upstream enables open registration on first start. Here OPEN_REGISTRATION is applied on every start, so change the variable (not the admin setting) to switch registration on or off. Clear the variable entirely if you prefer to manage it only from the admin panel.
- Upstream ships admin / password as the default superuser. This template generates the password instead.
- Gunicorn binds to the IPv6 wildcard so the nginx service can reach it over Railway private networking. The nginx service waits until the backend hostname resolves before starting, so the services can start in any order.
- APP_DOMAIN lists both public domains so the Django admin accepts CSRF-protected logins from them.
- The nginx and WSGI split is kept as upstream ships it: the WSGI image has no static file server, so the admin panel needs the nginx image. The client talks to nginx privately and only the client and admin domains are public.
- Email verification is off (ACCOUNT_EMAIL_VERIFICATION=none). To use it, set the EMAIL_HOST, EMAIL_PORT, EMAIL_HOST_USER, EMAIL_HOST_PASSWORD and EMAIL_FROM variables on backend-wsgi-server.
- The upstream project has not published a new release since 2023. Image tags are pinned.
Why Deploy ChatGPT UI 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 ChatGPT UI 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.
Template Content
backend-wsgi-server
wongsaang/chatgpt-ui-wsgi-server:v2.5.2backend-web-server
wongsaang/chatgpt-ui-web-server:v2.5.2
