DEV Community

Cover image for I built an AI news app with Next.js, Supabase, and Gemini, here's how the pipeline works
Rahul Upadhyay
Rahul Upadhyay

Posted on

I built an AI news app with Next.js, Supabase, and Gemini, here's how the pipeline works

I was spending hours every week keeping up with AI news. So I built Kapyn (kapyn.app) — a mobile-first app that turns AI/tech news into 30-second swipeable summaries with an AI-powered "Why it matters" explainer.
Here's how it works under the hood.

The stack:

  1. Next.js 14 (app router)
  2. Supabase (database + auth)
  3. Gemini API (summarization + "Why it matters" generation)
  4. Automated RSS ingestion pipeline
  5. Vercel (hosting + cron jobs)

How the news pipeline works?

Kapyn has zero manual curation. Everything is automated.
Every 4 hours, a Vercel Cron job triggers the ingestion pipeline. It pulls RSS feeds from a curated list of sources — Google AI Blog, OpenAI Blog, TechCrunch AI, HuggingFace, The Decoder, Simon Willison's blog, The Verge AI, and Wired AI. Product Hunt featured products get fetched separately, once a day.

Each new article goes through three steps:

  1. Dedup and store. The pipeline checks the Supabase database for URL matches. If the article already exists, it's skipped. New articles get stored with their metadata — title, source, publish date, and URL.

  2. Image extraction. For card thumbnails, I extract og:image from the source URL. If that fails, it falls back to RSS media tags. If that also fails, it renders a category-colored gradient so the feed never looks broken.

  3. AI summarization. This is where it gets interesting. Each article is sent to Google's Gemini API to generate two things: a 60-80 word summary (optimized for a swipeable card you can read in 30 seconds), and a "Why it matters" explanation that puts the story in context. The prompt is tuned to avoid generic filler — no "in today's rapidly evolving AI landscape." Just the actual significance.

For reliability, I built a fallback chain: Gemini API (primary) → OpenRouter's free Gemini endpoint (backup) → truncated raw content (last resort). The app has never gone empty because of an API outage.
The cost: $0. Gemini's free tier gives 1,000 requests/day. With ~30-50 new articles per cycle across 6 daily runs, I'm well under the limit. Supabase free tier handles the database. Vercel free tier handles hosting and crons. The entire backend runs for nothing.

What I'd do differently

Prompt tuning took longer than building the pipeline. My first Gemini prompts produced summaries that all sounded the same, generic, safe, boring. It took about 15-20 iterations to get summaries that actually felt like a human editor wrote them. If I started over, I'd invest in prompt evaluation tooling from day one instead of eyeballing quality.
Also, I curated RSS sources manually at launch. That doesn't scale. I'm now experimenting with Exa AI's search API as a supplementary source to catch stories my RSS list misses, but keeping it as a layer on top rather than a replacement, since RSS is free and never goes down.

Top comments (0)