The Problem

Email clients are closed-source, data-hungry, or too complex to self-host. Zero is an open-source Gmail alternative that puts users in control of their own email infrastructure, with AI agents for triage and a unified inbox for multiple providers.

What This Does

Zero is a full-stack email application with a React/Next.js frontend (apps/mail/) and a Node.js server (apps/server/). The frontend handles the UI — inbox, compose, settings, and an AI chat sidebar (components/create/ai-chat.tsx). The backend manages email connections, database persistence via Drizzle ORM, and the tRPC API layer (apps/server/src/trpc/).

The repo is a fork of the popular Mail-0/Zero project (10,784 stars). It uses pnpm as the package manager, Docker for local PostgreSQL, and GitHub Actions for CI/CD. The codebase is TypeScript throughout: 186 .ts files and 180 .tsx files.

How It Is Wired

The application has two entry points: the Next.js frontend (apps/mail/app/page.tsx) and the Node.js server (apps/server/src/main.ts). The frontend communicates with the backend through tRPC, with the router defined in apps/server/src/trpc/index.ts. That router imports 18 modules and delegates to route handlers in apps/server/src/routes/agent/.

The most-connected modules are apps/server/src/types.ts (31 modules import it) and apps/server/src/env.ts (27 importers). These are hub modules — high churn here ripples widely. Both participate in circular dependency chains, along with apps/server/src/lib/server-utils.ts (24 importers) and apps/server/src/trpc/trpc.ts (20 importers). The import graph shows 62 modules inside circular dependencies out of 370 analyzed — roughly 17% of the codebase.

The server owns the database effects: apps/server/src/db/index.ts initializes the connection, and apps/server/src/routes/agent/db/index.ts handles agent-related persistence. The apps/server/src/pipelines.ts file is flagged as oversized at 1,689 lines.

How To Use It

git clone https://github.com/moses-y/Zero
cd Zero
pnpm install
pnpm docker:db:up
pnpm nizzy env    # set up environment variables
pnpm nizzy sync   # sync env vars and types
pnpm db:push      # initialize the database
pnpm dev          # start the app at localhost:3000

Configuration lives in .env.example — you'll need Google OAuth credentials and PostgreSQL connection details. The .devcontainer/Dockerfile provides a containerized dev environment. Node.js v18+, pnpm v10+, and Docker v20+ are required.

Real-World Use

A team wanting full control over their email infrastructure would deploy Zero on their own hardware. Users connect Gmail, Outlook, or other IMAP providers through the settings page (apps/mail/app/(routes)/settings/connections/page.tsx). AI agents in the compose flow (components/create/ai-chat.tsx) draft and summarize messages. The unified inbox aggregates all providers into one view.

Code Health & Issues

Static analysis found 150 issues (88 high, 61 medium, 1 low) across 5 categories:

  • High — Import cycle members (31 instances): apps/server/src/env.ts, apps/server/src/lib/server-utils.ts, apps/server/src/trpc/trpc.ts all participate in circular imports. Breaking these requires extracting shared types or inverting dependencies.
  • High — Hub modules (10 instances): apps/server/src/types.ts has 31 dependents; changes there have a wide blast radius.
  • High — Oversized files (6 instances): apps/mail/components/icons/icons.tsx (1,689 lines) and apps/server/src/pipelines.ts are hard to hold in one head.
  • High — Deep nesting (12 instances): command-palette-context.tsx and email-composer.tsx hit indentation depth 8.
  • High — Duplicated code (101 files): 1,203 repeated 6-line blocks across icon components.

CI/CD findings: GitHub Actions are not pinned to commit SHAs (a tag-move supply-chain risk), CI never runs the test suite (5 test files exist, no test command in workflows), and GITHUB_TOKEN lacks least-privilege permissions. The test-to-source ratio is 0.019 — coverage is minimal. Three GIFs over 5MB bloat the repo (largest: 18.3MB).

The Bottom Line

Zero is a functional, feature-rich email client with a solid architecture at the app level, but the server core has real maintainability debt — circular imports and hub modules make changes risky. The CI pipeline needs hardening before this is production-ready. Good for teams who want a modern, self-hosted email UI and are willing to invest in refactoring the backend.