Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/riskymh/emailthing
A web app for receiving and sending your emails!
https://github.com/riskymh/emailthing
custom-domain email nextjs
Last synced: 4 days ago
JSON representation
A web app for receiving and sending your emails!
- Host: GitHub
- URL: https://github.com/riskymh/emailthing
- Owner: RiskyMH
- Created: 2023-11-26T06:45:17.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-14T05:19:46.000Z (13 days ago)
- Last Synced: 2024-12-17T02:04:15.998Z (10 days ago)
- Topics: custom-domain, email, nextjs
- Language: TypeScript
- Homepage: https://emailthing.app/home
- Size: 6.91 MB
- Stars: 167
- Watchers: 3
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
EmailThingA 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
```sh
bun install
```> **Note**: This project utilizes [Bun](https://bun.sh) 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:
```sh
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](https://developers.cloudflare.com/email-routing/email-workers/) to incoming emails, and [MailChannels](https://blog.cloudflare.com/sending-email-from-workers-with-mailchannels) to outgoing emails (currently experimenting with custom sending though).
To do this locally, refer to [./cloudflare-workers/README.md](./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`](./scripts/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](https://vercel.com) for hosting the application and for developing Next.js.
* [Cloudflare](https://cloudflare.com) for providing workers and email routing.
* [Turso](https://turso.tech) for providing a good pricing for database.
* [Alfonsusac](https://github.com/alfonsusac) for designing the logo and sticker.
* [Members of Next.js Discord](https://discord.gg/NextJS) for helping me with motivation and testing.
* And one of the most important, [Dawid Jankowski](https://dribbble.com/shots/15142673-E-mail-Client-Inbox-Dark-Mode) 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](https://discord.gg/GT9Q2Yz4VS) 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.