This is the newsletter application I use for my youtube channel to send out updates to my subscriber.
- a dedicated page where people can enter their email to subscribe to your newsletter
- a success page which shows a custom message after subscribing
- a dynamodb table which stores all subscriptions
- a cli command for sending out mjml emails to your subscribers
- users can unsubscribe via a rest api and link appended to all emails
- fully deployable using IaC via terraform and serverless framework
- api is a monolambda
- all in typescript
- yarn monorepo approach
- e2e testing using cypress
- integration and unit testing using jest
- everything can be ran locally via docker-compose
- ci/cd setup using github actions for testing and deployment
- docker compose build
- docker compose up
- open http://localhost:3000
My goal is to get all of this project 100% running in docker for local development. This means you'd need to docker exec into the shell container to do any one off commands or scripts. It's a bit more overhead, but I think it's worth it for consistency across developers and machines.
docker-compose up
docker exec -it shell /bin/bash
docker exec -it shell /bin/bash
yarn workspace @wdc-newsletter/e2e cypress
. ./load-env.sh .env.prod
npx ts-node ./scripts/src/sendEmailsCli.ts "My New T3 Stack Course is Live" "./data/emails/t3-course.mjml"
- update .env to have prod info
- create a
src/scripts/emails.json
with array of email address - run
npx ts-node src/scripts/import.ts
Create a Dynamodb table with the pk and sk named "pk" and "sk". Remember the name, you'll need it when setting up the user and policies.
Setup SES for your domain and verify the identity. Keep track of this identity name since you'll need to update it in the policy.json
Request production SES to get out of sandbox mode. You'll need to convince AWS you have a legit business reason to be sending emails.
Create an IAM user for programmatic access and setup your keys inside your .env file.
Modify the policy.json
file and attach it to your user.
Create and validate a certficate for the following:
- newsletter.webdevcody.com
- newsletter-api.webdevcody.com
- Setup CNAME for api
- Setup CNAME for ui
- setup and source .env by running
. ./load-env.sh
- yarn deploy:ui
- make sure to add the certificate and alternate domain name to cloudfront distrubtion
- yarn workspace @wdc-newsletter/api create-domain
- setup and source .env by running
. ./load-env.sh
- yarn deploy:api