Over the weekend I built a newsletter starter kit for Node apps to easily handle all of the key elements of a beautiful newsletter.
The first step was creating a way for users to sign up. As of now, this is very basic. It’s just a form on the bottom of my site’s homepage. There is middleware that checks a small key-value store to reduce chances of spam to the endpoint. Then, the form input is validated against multiple email checks to mitigate bad sign ups. Finally, a confirmation email is sent to the address and the email is added to the users database as unverified. If the user clicks the verification link in the email they are set to verified, otherwise they will be purged in the next purging cycle.
For the sending server itself, I took a local-first approach. This project was mostly to simplify my own life more than anything. The idea is that as a newsletter owner, you’ll do the following few steps when you want to send out content:
- Write your content out in Markdown
- Compile it into HTML and check that it looks good in the browser
- Start the newsletter server (anywhere!)
- Send a single post request to the send endpoint with the desired title
- Wait about 500ms-5s and all verified users within your users database will be sent the email with all failures retried and logged
Newer changes
In April 2024 I moved my personal site to a self hosted setup and off of Next, React, and Vercel. Because of this, I’ll have to change the sign up flow slightly. In my self hosted setup, I’m not using serverless ideas anymore. Instead, I have a tiny Gin API running with all of the endpoints I need always accessible. The site and api are fast and it feels a lot less over-engineered.
I was also using the Vercel databases since it was just a click of a button and an API call to set up. Though easy to configure, I didn’t like the feel of the lock-in having everything there on the same platform.
Comments
Loading comments...