MailBlog is a serverless application designed to streamline blog subscriptions and newsletter distribution
This Serverless application implements a simple Newsletter subscription service. It allows users to subscribe to a newsletter and receive a confirmation email. It follows the opt-in model, where users have to confirm their subscription before they can receive the newsletter.
Currently, the application is designed to handle
- /subscribe
- /verify
- /unsubscribe
This endpoint allows users to subscribe to the newsletter. It expects a JSON payload with the following structure:
Method: POST
{
"email": "[email protected]"
}
Response:
{
"message": "Subscription successful | Error message"
}
this endpoint will also send a confirmation email to the user's email address. The email will contain a link to the /verify endpoint.
This endpoint allows users to verify their subscription. It expects email
and token
as query parameters.
Method: GET
https://chapimenge.com/verify?email=email%40email.com&token=token
Response:
{
"message": "Subscription verified | Error message"
}
this endpoint will also send a welcome email to the user's email address.
This endpoint allows users to unsubscribe from the newsletter. It expects email
and token
as query parameters.
Method: GET
https://chapimenge.com/[email protected]&token=token
Response:
{
"message": "Subscription cancelled | Error message"
}
The design of the application is based on the following diagram:
The application is composed of the following components:
- API Gateway: This component exposes the endpoints to the internet. It is configured to use a custom domain name.
- Lambda: This component implements the business logic of the application. It is written in Python and uses the Serverless Application Model (SAM) to deploy the application.
- DynamoDB: This component stores the subscription information. It is configured to use on-demand capacity.
- SES: This component is used to send emails to the users. It is configured to use a custom domain name.
Note: You have to request production access to SES to be able to send emails to non-verified email addresses. You can request production access by going over the SES console.
The application is deployed using the Serverless Application Model (SAM). To deploy the application, you need to have the AWS CLI installed and configured. You can find instructions on how to install and configure the AWS CLI here.
Once you have the AWS CLI installed and configured, you can deploy the application by running the following command:
sam build && sam deploy
if you want change any parameters, you can do so by editing the samconfig.toml
file.
Coming soon...
This project is licensed under the MIT License - see the LICENSE file for details.
you can use this project as a template for your own projects. If you do, please consider giving this project a star and/or a fork. It will help me a lot.
If you wish to contribute to this project, please follow the below simple steps:
- Fork the project
- Create a new branch (
git checkout -b new-branch
) - Commit your changes (
git commit -m "add new feature"
) - Push to the branch (
git push origin new-branch
) - Open a pull request
- explain your changes in the pull request description. If you are adding a new feature, please explain how to use it.
- I will review your changes and merge them if they are good to go.
- Temkin Mengsitu - Initial work - Temkin Mengsitu