AI Newsletter Platform

A production-ready, AI-powered newsletter system that automatically curates, summarizes, and delivers topic-based newsletters to subscribers.

PythonFastAPIOpenAI GPTSendGridPostgreSQLSQLAlchemyAPSchedulerNews APIDocker

Key Features

Automated news collection from RSS feeds and News API

AI-powered curation and summarization via OpenAI GPT

Hybrid ranking system combining heuristics and content quality metrics

Professional HTML email delivery via SendGrid

Scheduled daily and weekly newsletter generation with APScheduler

One-click unsubscribe links per topic

RESTful API for full subscription management

CLI tools for testing, seeding, and manual newsletter triggers

Docker support for production deployment

Configurable LLM model, temperature, and max tokens

Architecture

┌─────────────────────────────────────────────────────────────┐
│                  Newsletter Platform                        │
├─────────────────────────────────────────────────────────────┤
│  ┌──────────────┐      ┌─────────────────┐                 │
│  │   FastAPI     │◄────►│   PostgreSQL    │                 │
│  │   Backend     │      │    Database     │                 │
│  └──────┬───────┘      └─────────────────┘                 │
│         │                                                   │
│         ├──► News Ingestion ──► RSS Feeds + News API        │
│         ├──► Ranking Service ──► Heuristics + LLM           │
│         ├──► LLM Service ──────► OpenAI API                 │
│         ├──► Email Service ────► SendGrid                   │
│         └──► APScheduler ──────► Daily/Weekly Jobs           │
└─────────────────────────────────────────────────────────────┘

API Endpoints

MethodEndpointDescription
GET/api/topicsList available topics
POST/api/subscribeSubscribe to topics
GET/api/subscriptions/:emailView subscriptions
GET/api/unsubscribeUnsubscribe via token

How It Works

1

News Ingestion

RSS feeds and News API are polled for fresh articles across configured topics (Sports, World News, US Stocks).

2

AI Ranking & Curation

A hybrid ranking system scores articles using heuristics (recency, source authority) and LLM-based content quality assessment.

3

LLM Summarization

Top-ranked articles are summarized by OpenAI GPT with custom prompts that generate subject lines, introductions, and 'why it matters' sections.

4

Email Delivery

Professional HTML newsletters are composed and delivered via SendGrid to all subscribers of that topic, respecting their daily/weekly frequency preference.