Git Product home page Git Product logo

monorepo's Introduction

Overview

This is the newsletter application I use for my youtube channel to send out updates to my subscriber.

User Features

  • 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

Code Features

  • 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

How to Run

  1. docker compose build
  2. docker compose up
  3. open http://localhost:3000

How to Develop

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.

  1. docker-compose up
  2. docker exec -it shell /bin/bash

Running E2E Tests

  1. docker exec -it shell /bin/bash
  2. yarn workspace @wdc-newsletter/e2e cypress

How to Send Emails

  1. . ./load-env.sh .env.prod
  2. npx ts-node ./scripts/src/sendEmailsCli.ts "My New T3 Stack Course is Live" "./data/emails/t3-course.mjml"

Importing Emails to Prod

  1. update .env to have prod info
  2. create a src/scripts/emails.json with array of email address
  3. run npx ts-node src/scripts/import.ts

Deployment

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.

SES

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 SES Production Access

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.

IAM User and Policy

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.

ACM

Create and validate a certficate for the following:

  • newsletter.monorepo-toy-project.com
  • newsletter-api.monorepo-toy-project.com

Domain

  • Setup CNAME for api
  • Setup CNAME for ui

Deploying the 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

Creating Gateway Domain

  • yarn workspace @wdc-newsletter/api create-domain

Deploying the API

  • setup and source .env by running . ./load-env.sh
  • yarn deploy:api

Issues

monorepo's People

Contributors

webdevcody avatar moonyc avatar mikecebul avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.