Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/harryzcy/mailbox

Versatile email infrastructure on AWS serverless
https://github.com/harryzcy/mailbox

api aws aws-apigateway aws-dynamodb aws-lambda aws-s3 aws-ses aws-sqs go mailbox mailbox-service self-hosted serverless

Last synced: 3 months ago
JSON representation

Versatile email infrastructure on AWS serverless

Awesome Lists containing this project

README

        

# Mailbox

[![Tests](https://github.com/harryzcy/mailbox/actions/workflows/test.yml/badge.svg)](https://github.com/harryzcy/mailbox/actions)
[![codecov](https://codecov.io/gh/harryzcy/mailbox/branch/main/graph/badge.svg)](https://codecov.io/gh/harryzcy/mailbox)
[![Go Report Card](https://goreportcard.com/badge/github.com/harryzcy/mailbox)](https://goreportcard.com/report/github.com/harryzcy/mailbox)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com)
[![License: MIT](https://img.shields.io/github/license/harryzcy/mailbox)](https://opensource.org/licenses/MIT)

Docs: [English](README.md) • [简体中文](README_zh.md)

Versatile email infrastructure that operates on AWS.

## Clients

### Web

See [mailbox-browser](https://github.com/harryzcy/mailbox-browser)

| Dark mode | Light mode |
|:---------:|:-----------:|
| ![Screenshot Dark Mode](https://github.com/harryzcy/mailbox-browser/assets/37034805/b77a6c40-c6c1-4dd8-98de-2add697b26f9) | ![Screenshot Light Mode](https://github.com/harryzcy/mailbox-browser/assets/37034805/ce9ab42c-923a-4b03-8ee4-bcdc9d4b72ed) |

### CLI

```bash
go install github.com/harryzcy/mailbox-cli
```

For details, refer to [mailbox-cli](https://github.com/harryzcy/mailbox-cli)

## Deploy

1. Clone the repository.

```shell
git clone https://github.com/harryzcy/mailbox
```

1. Install [serverless](https://github.com/serverless/serverless).

```shell
npm install -g serverless@v3
```

1. Create an IAM user.

Create an IAM user with AdministratorAccess and export the access key as environment variables.

```shell
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
```

In production, setup the IAM user following [this guide from serverless](https://www.serverless.com/framework/docs/providers/aws/guide/credentials).

1. Setup AWS services.

Manually create S3 buckets, and setup SES and SQS (optional) from AWS console.

1. Copy over example configurations and fill in correct fields.

```shell
cp serverless.yml.example serverless.yml
```

Under `provider.environment` section, modify `REGION`, `S3_BUCKET`, `SQS_QUEUE` (optional, only if SQS should be enabled).

1. Deploy the app.

```shell
make deploy
```

1. Configure email receiving.

From AWS console -> Configuration -> Email receiving -> Create rule set -> Create rule, add two actions:

1. Deliver to Amazon S3 bucket, then enter your bucket name.
2. Invoke AWS Lambda function, and select `mailbox-dev-emailReceive` or `mailbox-prod-emailReceive`.

1. Deploy [mailbox-browser](https://github.com/harryzcy/mailbox-browser) or use [mailbox-cli](https://github.com/harryzcy/mailbox-cli).

## API

See [doc/API.md](doc/api.md)

## Architecture

It runs on AWS services, including SES, Lambda, API Gateway, DynamoDB, and SQS.

![Architecture](./doc/architecture.svg)

## Contributing

### Development environment

- Go >= 1.21

Note that only the two most recent minor versions of Go are officially supported.