Self-Hosted AI news aggregator using Cloudflare Workers, Vectorize, and Nostr

Lobsters Hottest Tools

Summary

A self-hosted AI news aggregator that uses Cloudflare Workers, Vectorize, D1, and Nostr to scrape sources like Hacker News, Lobsters, and Reddit, generate AI embeddings, and provide a personalized feed based on upvote history.

<p>I built this primarily to solve my own reading fatigue from jumping between HN, Lobsters, and Reddit, while keeping data completely within my own infrastructure.</p> <strong>Architecture &amp; Storage Choices:</strong> <p>The entire stack is built to live on Cloudflare’s free/low-cost tier to make self-hosting accessible.</p> <ul> <li> <strong>Backend &amp; API:</strong> Implemented using Hono on Workers.</li> <li> <strong>Database &amp; State:</strong> Cloudflare D1 for strict relational storage (sources, cron tracking, user state).</li> <li> <strong>Vector Search:</strong> Cloudflare Vectorize managing the 768-dimension embeddings generated natively via <code>@cf/baai/bge-base-en-v1.5</code>.</li> </ul> <strong>Ingestion Details:</strong> <p>For Lobsters specifically, the background cron job polls the <code>.json</code> endpoints rather than scraping raw HTML. For bootstrapping historical preferences, I provided endpoints to ingest past JSON or RSS activity exports so the Cosine Similarity calculation actually has a baseline vector profile to match against.</p> <strong>Current Constraints &amp; Trade-offs:</strong> <ol> <li> <strong>Model Choice:</strong> I opted for <code>bge-base-en-v1.5</code> because it executes completely inside Workers AI with zero external cold starts, but I’m experimenting with more performant embeddings models if they become available natively on the edge.</li> <li> <strong>Nostr Identity:</strong> Instead of inventing a custom OAuth or JWT layer, I used NIP-07 (browser extensions like Alby) for user authentication. This makes it trivial to let followers re-publish your resulting curated feed back to public relays.</li> </ol> <p>The repo includes a <code>Makefile</code> that handles full remote provisioning (<code>make db-init</code>, <code>make vectorize-init</code>, <code>make deploy</code>) so you don't have to navigate the Cloudflare UI manually.</p> <p>Would love any feedback on the vector indexing strategy at the edge, or how people are handling semantic search history pruning over time.</p> <p><a href="https://lobste.rs/s/u7ls6b/self_hosted_ai_news_aggregator_using">Comments</a></p>
Original Article
View Cached Full Text

Cached at: 07/03/26, 04:25 PM

delirehberi/news

Source: https://github.com/delirehberi/news

AI Curated News

A fully autonomous, self-hosted AI News Aggregator powered by Cloudflare Workers, Vectorize, D1, and Nostr.

This project constantly scrapes your favorite sources (Hacker News, Lobsters, and Reddit), generates AI embeddings for each article using Cloudflare Workers AI (@cf/baai/bge-base-en-v1.5), and compares them against your personal upvote history to create a hyper-curated, personalized news feed.

Features

  • AI Vector Search: Uses semantic search (Cosine Similarity) to find articles that match your unique tastes based on your past upvotes.
  • Nostr Integration: Authenticate your own likes to train the AI using NIP-07 (Nostr browser extensions), and allow your followers to easily re-publish your curated feed to global Nostr relays.
  • Multi-Source Ingestion: Automatically pulls from HackerNews, Lobsters, and Reddit via a scheduled cron job.
  • Privacy-First: Fully self-hosted on Cloudflare. You own the database, the vector index, and the AI execution.
  • Modern UI: A beautifully designed, glassmorphic frontend built with Vite, Tailwind CSS v4, and Vanilla JS. Interleaved feeds, image previews, and follower counts built-in.

Architecture

  • Frontend: Vite + Tailwind CSS (frontend/ directory).
  • Backend API: Hono on Cloudflare Workers (worker/ directory).
  • Database: Cloudflare D1 (SQL).
  • Vector Database: Cloudflare Vectorize (Metadata + 768-dimension embeddings).
  • AI Model: @cf/baai/bge-base-en-v1.5 for text embeddings.

Setup & Deployment

Prerequisites

  • Node.js (v22+)
  • A Cloudflare account (npx wrangler login)
  • Nostr Extension (like Alby or nos2x) if you want to use the NIP-07 features.

1. Initialize Project

When you first clone the repository, run the initialization script:

make init

This will automatically install dependencies, copy configuration templates (.env and wrangler.jsonc), and print a step-by-step deployment checklist to your terminal.

2. Provision Infrastructure

Create your D1 database and Vectorize index on Cloudflare:

make db-init
make vectorize-init

Update your worker/wrangler.jsonc (which was created during make init) with your new database_id and Vectorize index_name. You can also enable or disable specific sources (e.g., "ENABLE_REDDIT": "false") in the vars block.

3. Configure Secrets

The application requires Reddit OAuth credentials and a Nostr Pubkey for identity. Export them to your environment (or use a .envrc file), and automatically push them to Cloudflare:

export REDDIT_CLIENT_ID="your_client_id"
export REDDIT_CLIENT_SECRET="your_client_secret"
export REDDIT_REFRESH_TOKEN="your_refresh_token"
export GMAIL_CLIENT_ID="your_client_id"
export GMAIL_CLIENT_SECRET="your_client_secret"
export GMAIL_REFRESH_TOKEN="your_refresh_token"
export AUTHORIZED_NOSTR_PUBKEY="your_nostr_pubkey_in_hex"

make push-secrets

The make push-secrets command securely pipes your local environment variables directly into Cloudflare’s vault without requiring manual interaction.

4. Configure Frontend

Update frontend/.env (which was created during make init) with your desired API URL, custom subtitle, and theme preferences.

5. Initialize the Database

Apply the SQL schema to your remote D1 instance so your tables are created:

make db-apply-remote

6. Deploy the Full Stack

Deploy both the Hono backend API and the Vite frontend to Cloudflare in one go:

make deploy

This command runs make deploy-worker and make deploy-frontend sequentially. It automatically builds your Vite app and deploys it to Cloudflare Pages, while deploying your backend to Cloudflare Workers.

Bootstrapping Your AI Model

For the AI to know what you like, it needs history. You can use the provided endpoints to ingest your existing upvotes from Lobsters, Reddit, or raw JSON exports from HackerNews. Once bootstrap profiles are ingested, the daily cron job will handle the rest!

License

MIT License. Feel free to fork, modify, and deploy your own personalized news AI.

Similar Articles

Truck Driver Builds AI News Aggregator

Reddit r/artificial

A truck driver with no coding background built an AI news aggregator using Next.js and Supabase that summarizes and deduplicates news from multiple sources.

Personal news automation system that will change your life

Reddit r/AI_Agents

The article describes a personal news automation system built for an exporter that monitors trade news sources, scores stories using AI, and delivers personalized WhatsApp updates, leveraging Cloudflare Workers and cost-effective AI models.

Show HN: Hacker News, Without AI

Hacker News Top

Show HN post introduces unslop.news, a tool that filters AI-related content from Hacker News to present a curated list of non-AI news items.