Mail-0 / Zero
- воскресенье, 4 мая 2025 г. в 00:00:03
Experience email the way you want with 0 – the first open source email app that puts your privacy and safety first (coming soon). Join the discord: https://discord.gg/0email
An Open-Source Gmail Alternative for the Future of Email
Zero is an open-source AI email solution that gives users the power to self-host their own email app while also integrating external services like Gmail and other email providers. Our goal is to modernize and improve emails through AI agents to truly modernize emails.
Most email services today are either closed-source, data-hungry, or too complex to self-host. 0.email is different:
Zero is built with modern and reliable technologies:
Required Versions:
Before running the application, you'll need to set up services and configure environment variables. For more details on environment variables, see the Environment Variables section.
You can set up Zero in two ways:
Clone and Install
# Clone the repository
git clone https://github.com/Mail-0/Zero.git
cd Zero
# Install dependencies
bun install
# Start database locally
bun docker:up
Set Up Environment
.env.example
to .env
in project root
cp .env.example .env
bun docker:up
bun db:push
Start the App
bun dev
Open in Browser
Visit http://localhost:3000
This option uses VS Code's Dev Containers feature to provide a fully configured development environment with all dependencies pre-installed. It's great for ensuring everyone on the team has the same setup.
Prerequisites
Open in Dev Container
git clone https://github.com/Mail-0/Zero.git
Access the App
Troubleshooting
bash rm -rf node_modules rm bun.lockb bun install
Better Auth Setup
Open the .env
file and change the BETTER_AUTH_SECRET to a random string. (Use openssl rand -hex 32
to generate a 32 character string)
BETTER_AUTH_SECRET=your_secret_key
Google OAuth Setup (Required for Gmail integration)
Go to Google Cloud Console
Create a new project
Add the following APIs in your Google Cloud Project: People API, Gmail API
Enable the Google OAuth2 API
Create OAuth 2.0 credentials (Web application type)
Add authorized redirect URIs:
http://localhost:3000/api/auth/callback/google
https://your-production-url/api/auth/callback/google
Add to .env
:
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
Add yourself as a test user:
Audience
Warning
The authorized redirect URIs in Google Cloud Console must match exactly what you configure in the .env
, including the protocol (http/https), domain, and path - these are provided above.
Copy .env.example
located in the project folder to .env
in the same folder and configure the following variables:
# Auth
BETTER_AUTH_SECRET= # Required: Secret key for authentication
# Google OAuth (Required for Gmail integration)
GOOGLE_CLIENT_ID= # Required for Gmail integration
GOOGLE_CLIENT_SECRET= # Required for Gmail integration
# Database
DATABASE_URL= # Required: PostgreSQL connection string for backend connection
# Redis
REDIS_URL= # Redis URL for caching (http://localhost:8079 for local dev)
REDIS_TOKEN= # Redis token (upstash-local-token for local dev)
For local development a connection string example is provided in the .env.example
file located in the same folder as the database.
Zero uses PostgreSQL for storing data. Here's how to set it up:
Start the Database
Run this command to start a local PostgreSQL instance:
bun docker:up
This creates a database with:
zerodotemail
postgres
postgres
5432
Set Up Database Connection
Make sure your database connection string is in .env
file.
For local development use:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/zerodotemail"
Database Commands
Set up database tables:
bun db:push
Create migration files (after schema changes):
bun db:generate
Apply migrations:
bun db:migrate
View database content:
bun db:studio
If you run
bun dev
in your terminal, the studio command should be automatically running with the app.
Please refer to the contributing guide.
If you'd like to help with translating Zero to other languages, check out our translation guide.
Curious who makes Zero? Here are our contributors and maintainers