This is a Next.js project bootstrapped with create-next-app.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
This project supports collecting news from Twitter/X using the Twitter API v2. To enable Twitter sources:
-
Get a Twitter API Bearer Token:
- Go to Twitter Developer Portal
- Create a new project/app or use an existing one
- Navigate to "Keys and tokens" and generate a Bearer Token
- Copy the Bearer Token
-
Add the Bearer Token to your environment variables:
# .env.local TWITTER_BEARER_TOKEN=your_bearer_token_here -
Configure Twitter sources in
lib/config.ts:export const TWITTER_SOURCES: Source[] = [ { id: 'openai-twitter', name: 'OpenAI', type: 'twitter', url: '@openai', // or 'openai' (both work) icon: '🤖', }, { id: 'ai-hashtag', name: 'AI Hashtag', type: 'twitter', url: '#AI -is:retweet', // Search query (excludes retweets) icon: '💬', }, ];
Twitter Source URL Formats:
- Username:
@usernameorusername- Fetches tweets from that user - Hashtag:
#hashtag- Fetches tweets with that hashtag - Search Query: Any Twitter search query (e.g.,
AI news -is:retweet lang:en)
Twitter API Rate Limits:
- Free tier: 1,500 tweets/month for search endpoints
- Paid tiers: Higher limits available
Note: Twitter API requires authentication and has rate limits. Make sure to monitor your usage to avoid hitting limits.
This project uses Redis for data storage. Here's what you need to know:
Redis is a fast, in-memory database that stores your data as key-value pairs. In this app, Redis stores:
- Processed news content - The AI summaries generated from tweets
- Model comparison data - Which AI model performed better in head-to-head comparisons
- Metadata - When content was last fetched, email sent, etc.
- Speed - Data is stored in memory, so reads/writes are instant
- Simple - No complex schemas, just store and retrieve JSON data
- Cheap - Free tiers available that are more than enough for this app
- Works with Vercel - Integrates seamlessly with serverless deployment
Upstash provides a free Redis instance that works perfectly with Vercel:
- Create an account at upstash.com
- Create a new Redis database:
- Click "Create Database"
- Choose a region close to your Vercel deployment (e.g., US-East-1)
- Select the free tier
- Copy your connection URL:
- Go to your database details
- Copy the
UPSTASH_REDIS_REST_URLor connection string - It looks like:
rediss://default:xxxx@xxx.upstash.io:6379
- Add to your environment:
# .env.local (for local development) STORAGE_REDIS_URL=rediss://default:your-password@your-db.upstash.io:6379
User clicks "Fetch News"
↓
Twitter API → Fetches tweets from @karpathy, @OpenAI, etc.
↓
OpenRouter API → AI summarizes the content
↓
Redis → Stores the processed summaries
↓
Frontend → Displays stored content from Redis
The app stores three keys in Redis:
news:contents- Array of processed articles with AI summariesnews:comparisons- Array of model comparison votesnews:metadata- Last fetch time, last email time, etc.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.