haitatsu
A simple, fully-featured, single executable email server built for platforms.
A self-hosted email server written in Go that ships as a single binary, handling SMTP and IMAP with PostgreSQL for metadata and S3-compatible storage for messages, designed to embed in platform backends.
Haitatsu is a self-hosted email server written in Go that ships as a single executable. It is designed to slot into a platform or application backend rather than act as a standalone mail service for individuals. The goal is to give developers a way to add mailbox functionality to their own products without standing up a complex multi-component mail stack.
The server handles incoming mail over SMTP and makes messages available to email clients through IMAP. Outgoing mail to external addresses goes through a relay rather than being sent directly, which keeps the server's footprint focused on receiving and storing messages. Connections support TLS, including a STARTTLS submission mode, and automatic certificate provisioning via ACME is built in.
For storage, Haitatsu splits metadata from message content. PostgreSQL holds metadata such as mailbox state, flags, and folder structures, while message bodies go to S3-compatible object storage such as MinIO. This means the binary itself stays stateless and the data lives in systems that operators are likely already running.
End users do not interact with the REST API. They connect from a regular email client using IMAP and SMTP with app passwords specific to their account. Backend services connect via the REST API using a configured service token to create and manage mailboxes, read messages, or perform administrative tasks. This separation keeps user credentials simple while giving platform code full programmatic control.
Configuration is written in a file using the Pkl configuration language, which supports hot reloading so settings can be updated without restarting the server. The project includes a Docker Compose setup for local development with tasks for building the binary, starting the full stack, and resetting volumes.
Where it fits
- Add per-user mailboxes to a SaaS platform backend using a REST API without managing a complex mail stack.
- Receive and store inbound email programmatically so your backend service can read and process messages via API calls.
- Let users connect standard email clients like Thunderbird via IMAP to mailboxes hosted on your own infrastructure.