---
title: "Deploy Inbox Zero"
description: "AI email assistant for Gmail and Outlook with worker, cron, Postgres, Redis"
category: "AI/ML"
url: https://railway.com/deploy/inbox-zero-1
---

# Deploy Inbox Zero

AI email assistant for Gmail and Outlook with worker, cron, Postgres, Redis

**[Deploy Inbox Zero on Railway](https://railway.com/template/inbox-zero-1)**

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

- **Creator:** Agaz Self-Host
- **Category:** AI/ML

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Redis-HTTP https://devicons.railway.app/i/redis.svg

- **Source:** https://github.com/aalfath/inbox-zero-railway-template

### Cron https://cdn.jsdelivr.net/gh/elie222/inbox-zero@v2.30.0/apps/web/public/icons/icon-192x192.png

- **Source:** https://github.com/aalfath/inbox-zero-railway-template

### Worker https://cdn.jsdelivr.net/gh/elie222/inbox-zero@v2.30.0/apps/web/public/icons/icon-192x192.png

- **Source:** https://github.com/aalfath/inbox-zero-railway-template

### Inbox-Zero https://cdn.jsdelivr.net/gh/elie222/inbox-zero@v2.30.0/apps/web/public/icons/icon-192x192.png

- **Source:** https://github.com/aalfath/inbox-zero-railway-template
- **Health check:** /api/health
- **Public domain:** Yes

## Documentation

# Deploy and Host Inbox Zero on Railway

Inbox Zero is an open-source AI email assistant for Gmail and Outlook. You describe in plain English how mail should be handled, and it labels, archives, drafts replies and flags follow-ups as mail arrives. It also offers bulk unsubscribe, reply tracking, digests and an assistant chat over your inbox, using your own AI provider key.

## About Hosting Inbox Zero

This template runs upstream's full self-hosted stack, v2.30.0, as six services on Railway's private network. **Inbox Zero** is the Next.js web app and API on the public domain; on every start it applies the database migrations, retrying until Postgres is ready. **Worker** is upstream's BullMQ worker: it takes background jobs (automation, digests, summaries) from Redis and hands them to the app. **Cron** calls the app's scheduled-job endpoints: scheduled actions, automation jobs, follow-ups, digests, meeting briefs, Gmail and Outlook watch renewal and daily cleanup. **Redis-HTTP** is the Upstash-compatible REST proxy upstream uses in front of **Redis**. **Postgres** stores accounts, rules, history and encrypted OAuth tokens. Postgres and Redis each have a volume. All secrets are generated at deploy.

## Common Use Cases

* An AI assistant that triages, labels, archives and pre-drafts replies for a busy founder, sales or support inbox
* Clearing years of newsletters and promotions with bulk unsubscribe, without giving a third-party SaaS access to your mailbox
* A team deployment where email content and AI calls stay on infrastructure you control, with your own LLM provider key

## Dependencies for Inbox Zero Hosting

* PostgreSQL and Redis (both included, private network only)
* An API key for an AI provider (Anthropic, OpenAI, Google, OpenRouter, Groq and others)
* A Google Cloud OAuth client for Gmail, and/or a Microsoft Entra app for Outlook (both free to create)

### Deployment Dependencies

* Inbox Zero source and releases: https://github.com/elie222/inbox-zero
* Self-hosting guide: https://docs.getinboxzero.com/hosting/self-hosting
* Google OAuth setup: https://docs.getinboxzero.com/hosting/google-oauth
* Microsoft OAuth setup: https://docs.getinboxzero.com/hosting/microsoft-oauth
* Template repository (Dockerfiles, start scripts, changelog): https://github.com/aalfath/inbox-zero-railway-template

### Implementation Details

**At deploy** you fill in two values on the Inbox Zero service: `AUTH_ALLOWED_EMAILS` (the addresses allowed to sign up; everyone else is refused) and `LLM_API_KEY` for the provider in `DEFAULT_LLM_PROVIDER` (default `anthropic`). The key needs API billing on the provider's platform; a ChatGPT or Claude chat subscription doesn't include it. The first boot runs the database migrations and takes a few minutes.

**After deploy, connect Gmail.** Copy the Inbox Zero service's domain (`YOUR-DOMAIN`). In Google Cloud Console, enable the Gmail API, set up the OAuth consent screen (add yourself as a test user for an External app), and add the scopes `userinfo.email`, `userinfo.profile`, `gmail.modify` and `gmail.settings.basic`. Create an OAuth client ID of type Web application with:

* Authorized JavaScript origin: `https://YOUR-DOMAIN`
* Redirect URIs: `https://YOUR-DOMAIN/api/auth/callback/google` and `https://YOUR-DOMAIN/api/google/linking/callback`

Put the ID and secret in `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`. For real-time processing, create a Pub/Sub topic, grant `gmail-api-push@system.gserviceaccount.com` the Pub/Sub Publisher role on it, add a push subscription to `https://YOUR-DOMAIN/api/google/webhook?token=TOKEN` (TOKEN is the service's `GOOGLE_PUBSUB_VERIFICATION_TOKEN`), and set `GOOGLE_PUBSUB_TOPIC_NAME` to `projects/PROJECT-ID/topics/TOPIC`. Until these are set the app runs, but the sign-in page has no Google button.

**Outlook (optional).** Register an app in Microsoft Entra ID with the redirect URIs `https://YOUR-DOMAIN/api/auth/callback/microsoft` and `https://YOUR-DOMAIN/api/outlook/linking/callback`, add the delegated Graph permissions from the Microsoft OAuth guide, and set `MICROSOFT_CLIENT_ID` and `MICROSOFT_CLIENT_SECRET`.

**Then** sign in at `https://YOUR-DOMAIN` with an address from `AUTH_ALLOWED_EMAILS`.

**Custom domain.** Add it on the Inbox Zero service, set `NEXT_PUBLIC_BASE_URL` to `https://your.domain`, and update the OAuth redirect URIs and the Pub/Sub push URL.

**Never change** `EMAIL_ENCRYPT_SECRET` or `EMAIL_ENCRYPT_SALT` after the first sign-in: they encrypt the stored OAuth tokens.

**Updates.** Inbox Zero, Worker, Cron and Redis-HTTP build from the template's GitHub repository with pinned image versions. When a new release is tested there, Railway shows an update in your project and you choose when to apply it; migrations run on the next start. Read the repo's CHANGELOG first.

**Optional features** (Slack, Telegram, Resend emails, QStash, other model tiers) are extra variables on the Inbox Zero service; see upstream's environment variable reference.

## Why Deploy Inbox Zero 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 Inbox Zero 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/inbox-zero-1
