Deploy Inbox Zero

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

Deploy Inbox Zero

/var/lib/postgresql/data

Just deployed

/data

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

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.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
117
View Template
Weaviate
Vector database with hybrid search and an API key-protected API

GitHub Locker
1
View Template
Möbius Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

bento
1