Deploy big-AGI Auth Gateway + Postgres
big-AGI AI workspace behind a password gateway, with chat link sharing
Just deployed
big-agi-gateway
Just deployed
big-AGI
Just deployed
Deploy and Host big-AGI on Railway
big-AGI is an open source AI workspace for people who use several models at once. It talks to OpenAI, Anthropic, Gemini, OpenRouter, Ollama and more than a dozen other providers, and adds Beam (ask many models, merge the best answer), personas, voice, image generation, code rendering and file attachments.
About Hosting big-AGI
The official big-AGI image has no login. Upstream's optional HTTP Basic Auth only exists if you rebuild the image yourself, and the server will happily relay requests to any model host a caller names. So this template never gives big-AGI a public domain. A small Caddy gateway holds the only public domain and asks for a username and a generated password before anything reaches the app, including every API route.
Chats, settings and any API keys you type into the UI stay in your browser. The only data big-AGI keeps on the server is Chat Link Sharing, which needs a database, so the template includes Postgres and creates the schema on first boot.
What is included:
- big-AGI
ghcr.io/enricoros/big-agi:v2.1.3(private, port 3000) - big-agi-gateway
caddy:2.11-alpine(public, basic auth in front of big-AGI) - Postgres 17 with a volume (stores shared chat links only)
First Steps After Deploy
- Open the big-agi-gateway service, copy
BASIC_AUTH_PASSWORDfrom Variables. The username isadmin. - Open the gateway's public URL and sign in at the browser prompt.
- In big-AGI open Models and add a provider key. It is stored in your browser. Or set a server side key (below) so every signed in user shares it.
- To share a chat, open its Export dialog and create a share link. The link works for anyone who has the gateway login.
Common Use Cases
- One workspace for every model: compare OpenAI, Anthropic, Gemini and local models side by side
- Beam: fan a prompt out to several models and merge the answers
- Team key sharing: set provider keys on the server once, hand out only the gateway login
- Private front end for Ollama: point
OLLAMA_API_HOSTat an Ollama service in the same project
Dependencies for big-AGI Hosting
- Postgres: included. Used only for Chat Link Sharing
- Provider API keys: optional. The app boots with none, add them in the UI or as variables
- No Redis, no object storage, no GPU
Deployment Dependencies
Implementation Details
Key variables:
# big-agi-gateway
BASIC_AUTH_USERNAME=admin
BASIC_AUTH_PASSWORD=${{secret(32)}}
UPSTREAM=${{big-AGI.RAILWAY_PRIVATE_DOMAIN}}:3000
# big-AGI
PORT=3000
POSTGRES_PRISMA_URL=${{Postgres.DATABASE_PRIVATE_URL}}
POSTGRES_URL_NON_POOLING=${{Postgres.DATABASE_PRIVATE_URL}}
OPENAI_API_KEY= # optional, shared with every signed in user
ANTHROPIC_API_KEY= # optional
GEMINI_API_KEY= # optional
OPENROUTER_API_KEY= # optional
OLLAMA_API_HOST= # optional
Things to know:
- A server side provider key is usable by everyone who has the gateway login. Hand the login only to people you would hand the key to.
- Chats are not backed up by this template. They live in each browser. Use big-AGI's own export to move them.
- Do not add a public domain to the big-AGI service. That would bypass the gateway.
- The pinned 2.1.3 image includes the fixes for both published big-AGI advisories and ships Next.js 15.5.28.
Why Deploy big-AGI 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 big-AGI 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
big-agi-gateway
caddy:2.11-alpine
