Skip to content

The-Fiery-Fire/EmailThing

 
 

Repository files navigation

EmailThing Logo
EmailThing

A web app for receiving and sending your emails!

Getting Started

This repository contains the code for front-end app that displays and sends emails.

Installing the dependencies

bun install

Note: This project utilizes Bun as its package manager.

Configuring the env vars

If you are developing locally you need to create an .env file. Refer to the table below for all the environment variables in the project.

Name Description Required?
DATABASE_URL The connection string/path to connect to the Sqlite DB (can be just `file:./db.sqlite) ✔️
DATABASE_TOKEN The token for DB (if using Turso)
NEXT_PUBLIC_APP_URL The URL where the app is hosted
NEXT_PUBLIC_NOTIFICATIONS_PUBLIC_KEY The public key for sending notifications ✔️
WEB_NOTIFICATIONS_PRIVATE_KEY The private key for sending notifications ✔️
EMAIL_AUTH_TOKEN The secret key for sending through cloudflare worker (more on this below) ✔️
EMAIL_DKIM_PRIVATE_KEY The DKIM private key
S3_KEY_ID The Access Key ID for S3 ✔️
S3_SECRET_ACCESS_KEY The Secret Access Key for S3 ✔️
S3_URL The Client URL for S3 ✔️

Running the development environment

To launch the Next.js website and deploy the database schema, utilize the following commands:

bun db:push
bun dev --turbo

How it works

EmailThing primarily handles the front-end aspect of the email management application. For sending and receiving emails, it makes use of Cloudflare Email Workers to incoming emails, and MailChannels to outgoing emails (currently experimenting with custom sending though).

To do this locally, refer to ./cloudflare-workers/README.md for more information.

Why did you make this?

I made this because I wanted to have a way to deal with my emails from a custom domain. The options from Gmail were too expensive, and I couldn't find a good alternative, so I made my own. I tried to make it in a way that gives you the most control over your emails (ie owning the worker receiving emails).

How to set up the database and app?

There was a lot of hard-coding that I have done in this. However, after setting up the database, you can run the create-admin.ts script to make an admin user. This will allow you to create other users (through /api/invite) and manage the app.

Currently, there isn't a way to add default domains, so you will also need to manual add those using the default_domain table. I also have hard coded the url to send emails through, so you will need to change that in the appropriate files.

Credits

Many individuals and organizations have contributed to the creation of this project. Special thanks to:

  • Vercel for hosting the application and for developing Next.js.
  • Cloudflare for providing workers and email routing.
  • Turso for providing a good pricing for database.
  • Alfonsusac for designing the logo and sticker.
  • Members of Next.js Discord for helping me with motivation and testing.
  • And one of the most important, Dawid Jankowski for providing the design to base the app on.
  • and many more that I can't possibly mention...

Need Help?

If you encounter any issues or have questions, please join our Discord server for assistance. I'm more than willing to help. Please seek support through Discord rather than opening an issue, as it facilitates better communication and understanding of your problem.

About

A web app for receiving and sending your emails!

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.9%
  • JavaScript 2.7%
  • CSS 0.4%