Back to Blog

How Read What Matters sends your daily digest

A behind-the-scenes look at how we fetch content from Reddit and Hacker News, build a clean email, and deliver it to your inbox every morning.

Posted by

The goal

Every morning, Read What Matters sends you one clean email with the best content from Hacker News and Reddit — no ads, no algorithm, no doom-scrolling. Here's exactly how that happens under the hood.

Step 1 — Fetching real content

We use two free, public APIs to get real-time content:

  • Hacker News — via the official Firebase REST API at hacker-news.firebaseio.com/v0/topstories.json. We fetch the top story IDs, then load each story's details in parallel.
  • Reddit — via Reddit's public JSON endpoint: reddit.com/r/technology/top.json?t=day. No API key required.
// Hacker News top 5
const ids = await fetch("https://hacker-news.firebaseio.com/v0/topstories.json");
const stories = await Promise.all(ids.slice(0,5).map(id =>
  fetch("https://hacker-news.firebaseio.com/v0/item/" + id + ".json").then(r => r.json())
));

// Reddit top 5 from r/technology
const posts = await fetch(
  "https://www.reddit.com/r/technology/top.json?limit=5&t=day",
  { headers: { "User-Agent": "ReadWhatMatters/1.0" } }
).then(r => r.json());

Step 2 — Building the email HTML

Once we have the stories, we build a styled HTML email using plain inline CSS (required for Gmail, Outlook, Apple Mail compatibility). The email has a green header, an HN section, a Reddit section, and an unsubscribe footer.

Step 3 — Sending with Resend

const { data, error } = await resend.emails.send({
  from: "Read What Matters <digest@readwhatmatters.com>",
  to: user.email,
  subject: "Your daily digest — " + date,
  html: buildEmailHtml({ hnStories, redditPosts, date }),
});

Resend handles delivery, bounce tracking, and unsubscribe headers. Emails typically arrive within 2–5 seconds. The entire API route lives in app/api/send-digest/route.js and fetches all content in parallel before composing the final email.

How Read What Matters sends your daily digest