
hyperposta
Next.js, IMAP, SMTP, Supabase, OpenAI
open project →watch the demo →
the problem
The problem came from the frustration of using Apple's Mail app: if you have a MacBook, you know what I'm referring to. Plus, when I started this project, the email apps I was using didn't have any real AI integration, so I decided to build my own.
what I built
I created a web email client that works with any email account and has AI built in.
how it works
One of the structural choices, for privacy and security, was that the app doesn't keep your mail anywhere: not in the browser and not in my database. Every folder is fetched live from your mail server, on the server side, when you open it, using Next.js server components. And because the email list lives in a layout, it is loaded once per folder and stays put while you click from one email to the next. The only things I store are your mail password and your OpenAI key, both encrypted (AES-256-GCM) before they reach the database.
The app talks to your mailbox over plain IMAP and SMTP rather than any provider's API, so it works with any account rather than only the two or three that ship an official SDK, like Google or Microsoft.
Underneath it does cross-provider folder discovery, batched UID fetching, and RFC822 MIME construction for sent mail. The folder discovery matters more than it sounds: SMTP only sends a message, it doesn't keep a copy, so hyperposta builds the raw message itself and saves it into your Sent folder over IMAP. And every provider names that folder differently: "Sent", "Sent Items", "[Gmail]/Sent Mail", or "[Gmail]/Posta inviata" if your Gmail is in Italian.
The mailbox is then exposed to OpenAI function-calling agents. In the chat you can ask it to search your mail, find the latest messages, open an email, count how many you got each day, or write and send an email for you. Inside an email you can chat about that email: ask for a summary, ask questions about it, or have it draft the reply. And while you write, it can correct your draft, suggest improvements or translate it into English.
what I learned
This project taught me a lot about the email protocols, how to build a web app that is secure and privacy-friendly, and the real difference between client-side and server-side apps.
the stack
app — Next.js, TypeScript, Tailwind CSS and shadcn/ui, with the Squire rich-text editor for writing emails.
email — ImapFlow for IMAP, mailparser to read the messages, Nodemailer for SMTP.
AI — OpenAI: an agent with function-calling tools for searching, reading, counting and sending email, and a mini model for the writing help. Each user plugs in their own OpenAI API key.
accounts — Supabase auth (email and password, Google, X) and a Supabase Postgres table holding only the encrypted credentials.