What I Learned from Launching an Email Newsletter as a Full-Stack Developer

As a seasoned full-stack developer, I‘m always eager to explore new technologies and content platforms to share my knowledge and connect with fellow coders online. While I had extensive experience building web apps, designing databases, and deploying to the cloud, there was one domain I had never really delved into: email.

Sure, I had built a few basic contact forms and notification emails into my projects before. But I had never created a full-fledged email newsletter from scratch. I was intrigued by the technical challenges involved and the potential to build a direct relationship with my audience. So I decided to take the plunge and launch my own email newsletter.

In this post, I‘ll share my journey as a developer diving into the world of email. I‘ll reveal the technical details of how I set up my newsletter stack, the coding obstacles I encountered, and the valuable lessons I learned along the way. Whether you‘re a curious coder or a seasoned email geek, I think you‘ll find some valuable insights in here.

Choosing an Email Service Provider

The first decision I had to make was choosing an email service provider (ESP) to power my newsletter. As a developer, I wanted an ESP that gave me full control over the code and integrations. I also wanted robust APIs, webhooks, and documentation to extend the platform as needed.

After researching the options, I narrowed it down to two main contenders:

  1. Mailchimp – The most popular ESP, with a huge user base and extensive features. However, I found the template language and automation builder to be limiting as a developer. I also wasn‘t thrilled about the recent pricing changes that made it more expensive.

  2. ConvertKit – Built by and for creators, ConvertKit offers a clean interface, powerful automation, and a simple REST API. It also has direct integrations with popular tools I already use like WordPress, Teachable, and Stripe.

I ended up choosing ConvertKit for its developer-friendly features and transparent pricing. The documentation was thorough and the API was straightforward to use. It also didn‘t hurt that ConvertKit was founded by a fellow developer, Nathan Barry, who I respect and have learned a lot from.

Setting Up My Email Template

With my ESP in place, it was time to code my email template. Having a well-designed, responsive template is crucial for a good reader experience and avoiding spam filters.

Coding HTML email templates can be notoriously frustrating. You‘re limited to table-based layouts, inline CSS, and spotty support for modern web features. Forget about using flexbox, CSS grid, or even <div> tags in most email clients.

To make things easier, I started with a pre-built email framework called MJML. MJML is an open-source markup language that abstracts away the complexity of email HTML. You write clean, semantic MJML code and then compile it into email-compliant HTML.

Here‘s a simplified example of my email template in MJML:

<mjml>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-image src="header.png"></mj-image>
        <mj-divider border-color="#F45E43"></mj-divider>
        <mj-text font-size="20px" color="#F45E43" font-family="helvetica">
          Hello World!
        </mj-text>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>

I then used the MJML API to automatically compile this into optimized HTML email code every time my newsletter is sent. This saves me from having to hand-code tables and inline CSS every time.

I also took advantage of ConvertKit‘s templating language, Liquid, to add dynamic content to my emails. For example, I can greet subscribers by their first name using {{ subscriber.first_name }} or conditionally show blocks of content based on which tags or segments they belong to.

Integrating with My Tech Stack

One of the benefits of using a developer-friendly ESP is the ability to integrate it with the rest of my tech stack. ConvertKit has a well-documented REST API and webhook system that I was able to leverage.

For example, I wanted to automatically add new email subscribers to my list whenever someone purchased my ebook or signed up for a free course on my website. To do this, I wrote a simple function to hit the ConvertKit API whenever a new user was created:

const subscribeToConvertKit = async (formId, email, firstName) => {
  const apiSecret = process.env.CONVERTKIT_API_SECRET;
  const url = `https://api.convertkit.com/v3/forms/${formId}/subscribe`;

  try {
    const response = await fetch(url, {
      method: ‘POST‘,
      headers: {
        ‘Content-Type‘: ‘application/json‘,
      },
      body: JSON.stringify({ 
        api_secret: apiSecret,
        email,
        first_name: firstName
      })
    });

    if (response.status === 200) {
      console.log(`Successfully subscribed ${email} to ConvertKit form ${formId}`);
    }
  } catch (err) {
    console.error(‘Error subscribing to ConvertKit:‘, err);
  }
};

I also used ConvertKit‘s webhooks to automatically tag subscribers based on their activity. For instance, if someone clicked a link to my Python tutorial in a newsletter, they would get tagged with "Python" for future segmentation.

To process these webhook events, I set up a small Express server with endpoints corresponding to the subscriber activities I wanted to track:

const express = require(‘express‘);
const bodyParser = require(‘body-parser‘);

const app = express();

app.use(bodyParser.json());

app.post(‘/hooks/convertkit‘, async (req, res) => {
  console.log(‘Received ConvertKit webhook:‘, req.body);

  const { subscriber, email_address, user_id } = req.body;
  const event = req.body.event;

  if (event === ‘subscriber.click‘) {
    const linkUrl = req.body.link_url;

    if (linkUrl.includes(‘python-tutorial‘)) {
      await tagSubscriber(user_id, ‘Python‘);
    }
  }

  res.status(200).end();
});

By leveraging APIs and webhooks, I was able to seamlessly integrate my email newsletter with my existing website and business tools. This allows me to create a cohesive experience for my audience and save time on manual data syncing.

Optimizing Email Performance

As a developer, I care a lot about performance and optimization. I wanted to make sure my newsletter was blazing fast, had high deliverability, and looked great on any device.

One key aspect of email performance is image optimization. Many email clients block images by default, so it‘s important to use descriptive alt text and keep your images as small as possible.

I wrote a quick Node.js script to compress all the images in my email template directory using the sharp library:

const sharp = require(‘sharp‘);
const fs = require(‘fs‘);
const path = require(‘path‘);

const compressImages = async () => {
  const imageDir = ‘./images‘;
  const outputDir = ‘./dist‘;

  try {
    const files = await fs.promises.readdir(imageDir);

    for (const file of files) {
      const inputFile = path.join(imageDir, file);
      const outputFile = path.join(outputDir, file);

      await sharp(inputFile)
        .resize({ width: 600 })
        .toFormat(‘jpg‘)
        .jpeg({ quality: 80 })
        .toFile(outputFile);

      console.log(‘Compressed‘, file);
    }

    console.log(‘Image compression complete!‘);

  } catch (err) {
    console.error(‘Error compressing images:‘, err);
  }
};

Another important factor for email deliverability is the reputation of your sending domain. To improve this, I implemented several email authentication protocols:

  • SPF (Sender Policy Framework) – Specifies which IP addresses are allowed to send email on behalf of your domain. Helps prevent domain spoofing.

  • DKIM (DomainKeys Identified Mail) – Adds a digital signature to your emails to verify the sender‘s identity. Helps prove the email wasn‘t altered in transit.

  • DMARC (Domain-based Message Authentication, Reporting & Conformance) – Builds on SPF and DKIM to give domain owners control over unauthorized use of their domain in email. Can instruct receiving servers to reject or quarantine emails that fail authentication.

Setting up these protocols involves adding some DNS records and configuring your ESP settings, but it‘s well worth it for better deliverability and security. ConvertKit has step-by-step guides for each protocol.

I also implemented tracking pixels and UTM parameters on all the links in my email to measure engagement. By appending query parameters like ?utm_source=newsletter&utm_medium=email&utm_campaign=welcome, I can see exactly how much traffic and conversions are coming from each email send in Google Analytics.

To visualize all this email data, I built a simple dashboard using React and Chart.js. It pulls in data from the ConvertKit API and Google Analytics to show key metrics like open rate, click rate, unsubscribe rate, and revenue over time.

Growing My Email List

Of course, all the technical optimizations in the world don‘t matter much if you don‘t have any subscribers. Growing an engaged email list is paramount as an indie developer. You need a direct line of communication with your audience to promote your products, get feedback, and build lasting relationships.

I used a variety of tactics to attract new subscribers:

  • Content upgrades – I created exclusive bonus content related to my most popular blog posts and tutorials. Readers could access these resources by subscribing to my newsletter. This converts much better than a generic "sign up for updates" form.

  • Social media – I regularly promote my newsletter on Twitter, DEV, Indie Hackers, and other online communities for developers. I share previews of upcoming issues and highlight popular past editions.

  • GitHub repo – I added a prominent call-to-action to subscribe to my newsletter in the README of my open-source projects on GitHub. Developers who land on these repos are likely interested in hearing more about my work.

  • Cross-promotions – I reached out to fellow developer bloggers and newsletter authors to set up cross-promotions. We agreed to mention each other‘s newsletters in an upcoming issue and link to the sign-up page. This exposes us to new relevant audiences.

  • Podcasts and interviews – Whenever I appeared as a guest on a podcast or did an interview, I made sure to mention my newsletter and ask listeners to subscribe. These expanded reach to new developer audiences.

One unique tactic I tried was creating a viral email course. I called it the "7-Day Coding Challenge" and promoted it heavily on social media. Each day, participants received an email with a small coding project to build, along with tutorials and resources. The course was completely free, but required an email sign-up.

To further incentivize social sharing, I added a referral component. After someone signed up, they received a unique link to share with friends. For every 3 referrals who completed the challenge, the original subscriber would get exclusive access to bonus content and a discount code for my ebook.

This campaign was a huge success. Over 5,000 developers signed up for the challenge, and many of them shared it with their networks. This single initiative grew my list by over 20% in one week. It also created a lot of buzz and goodwill around my brand.

Monetizing My Newsletter

While my primary goal with this newsletter is to educate and inform, I also want to generate revenue from it to sustain my efforts. I‘ve experimented with a few different monetization strategies:

  1. Sponsorships – I offer paid sponsorship slots in my newsletter where companies can promote their developer tools or services. I use a WordPress plugin called Adsterra to manage these sponsorships and dynamically insert the ads into my email template. Sponsorships account for about 30% of my newsletter revenue.

  2. Affiliate offers – Whenever I mention a product or service I use and recommend, I include an affiliate link. If a subscriber clicks that link and makes a purchase, I earn a commission. Popular affiliate programs for developers include Amazon Associates, Digital Ocean, Treehouse, and Heroku.

  3. My own products – My newsletter acts as a direct sales channel for my own digital products, like ebooks, courses, and templates. Whenever I launch something new or run a promotion, I announce it to my email list first. I‘ve found email converts 5-10x better than social media or standalone landing pages for product sales.

  4. Paid subscriptions – I‘ve been considering adding a premium paid tier to my newsletter. Paying subscribers would get access to exclusive content, community features, and early-bird discounts. However, I worry this could cannibalize my other product sales. For now, I‘m sticking with the free sponsorship model.

According to my ConvertKit reports, my newsletter is generating about $2,500 per month in total revenue. That‘s not enough to replace my salary as a full-stack developer, but it‘s a nice source of side income. And as my list continues to grow, I expect that number to increase.

Key Takeaways and Lessons Learned

Launching and growing an email newsletter as a developer has been a challenging but rewarding experience. It‘s a great way to share your knowledge, build your authority, and connect with your audience on a deeper level.

Here are some of the key lessons I‘ve learned throughout this process as a developer:

  1. Choose an ESP with good developer tools – Look for an email provider that has robust APIs, webhooks, and documentation. This will make your life much easier when it comes to integrating with your existing stack and building custom functionality.

  2. Use a framework for email HTML – Don‘t try to hand-code email templates from scratch. Use a framework like MJML or Foundation for Emails to save yourself time and headaches. Your emails will be more consistent and maintainable.

  3. Automate everything you can – From email creation to list management to performance tracking, look for opportunities to automate your workflow using scripts and integrations. This frees you up to focus on higher-level tasks like writing and strategy.

  4. Prioritize email deliverability – No one will read your carefully crafted emails if they land in the spam folder. Implement authentication protocols like SPF, DKIM, and DMARC. Avoid spammy tactics like buying lists or using all caps and excessive exclamation points!!!

  5. Focus on providing value, not just selling – Yes, email can be a powerful sales channel. But if every message is a hard sell, subscribers will tune out or unsubscribe. Aim to provide valuable content and insights at least 80% of the time. Then when you do make an offer, your list will be much more receptive.

  6. Regularly clean your email list – Don‘t be afraid to prune inactive or disengaged subscribers from your list. Having a smaller list of highly engaged readers is better for your sender reputation and performance than a bloated list of zombies. I like to remove anyone who hasn‘t opened an email in the past 90 days.

  7. Invest in your subject line copy – The subject line is the single most important factor in getting your emails opened and read. Spend almost as much time writing and testing your subject lines as the email body itself. Use curiosity, urgency, and relevance to stand out in a crowded inbox.

  8. Always be testing and iterating – As a developer, I‘m constantly running experiments and measuring results to improve my craft. The same applies to email. A/B test different subject lines, content formats, send times, etc. and see what works best for your unique audience. There‘s no one-size-fits-all formula for success.

I hope this deep dive into my experience launching an email newsletter as a full-stack developer has been insightful. If you have any questions or tips of your own to share, feel free to reach out. You can subscribe to my newsletter here to follow along with my journey and learn more coding tips.

Happy sending!

Similar Posts