This is my email list HTML form project. It takes an email address and a name as input into an HTML form, and it inserts them into a DynamoDB table using a lambda function. The code is written in NodeJS, and like all my other cloud-related projects so far, hosted on AWS. The email list project works completely, and feel free to play with it, but note that I will never send any emails to any address (or nonsense) in this list. This is just an educational project.

This project has gone through quite a few different variations in architecture. It started as a NodeJS back-end server and an NGINX front-end all running on a single EC2 instance. After that, I migrated the project to Elastic Beanstalk, where it was a little bit easier to manage. The web server front-end eventually got converted into a serverless, S3 static website. That was very cool stuff. If only the back-end was serverless too, my hosting fees would become practically nothing. Enter Lambda.

The next, and current, iteration of this project’s architecture is completely serverless. The front end, again, is an S3 static website. It uses a simple HTML form with two inputs, email and name. Using JavaScript and the Fetch API, your web browser then sends a POST method to API Gateway, which then forwards along to a Lambda function. The back-end code was converted into a single Lambda function with a POST method. This made my hosting fees negligible and my project awesome (or at least I thought it was pretty cool).

Below is a diagram of the current serverless architecture.

Serverless architecture

While I am an admittedly an amateur coder, I made my best attempt to implement server- and client-side validation to the form inputs and proper error handling at all steps of the process. I learned a ton from this project, here’s a few examples: NodeJS(my first NodeJS project), CORS (…jeez), error handling, input validation, how to write API functions, and more.