A modular TypeScript-based news aggregator that collects, enriches, and analyzes AI-related content from multiple sources using OpenAI's GPT models.
-
Multiple Data Sources
- Twitter posts monitoring
- Discord channel messages and announcements
- GitHub activity tracking
- Solana token analytics
- CoinGecko market data
-
Content Enrichment
- AI-powered topic extraction
- Automated content summarization
- Image generation capabilities
-
Storage & Analysis
- SQLite database for persistent storage
- Daily summary generation
- JSON export functionality
- Node.js ≥ 18
- TypeScript 4.x
- SQLite3
# Clone the repository
git clone https://github.com/yourusername/ai-news.git
# Install dependencies
cd ai-news
npm install
# Create .env file and add your credentials
cp example.env .env
Create a .env
file with the following variables:
OPENAI_API_KEY= # Your OpenAI API key or OpenRouter API key
OPENAI_DIRECT_KEY= # Optional: Your OpenAI API key for image generation when using OpenRouter
USE_OPENROUTER=false # Set to true to use OpenRouter
SITE_URL= # Your site URL for OpenRouter rankings
SITE_NAME= # Your site name for OpenRouter rankings
# Other existing configurations...
TWITTER_USERNAME= # Account username
TWITTER_PASSWORD= # Account password
TWITTER_EMAIL= # Account email
DISCORD_APP_ID=
DISCORD_TOKEN=
- Navigate to your GitHub repository
- Go to "Settings" > "Secrets and variables" > "Actions"
- Click "New repository secret"
- Copy the JSON with your credentials
- Save name as "ENV_SECRETS"
{
"TWITTER_USERNAME": "",
"TWITTER_PASSWORD": "",
"TWITTER_EMAIL": "",
"OPENAI_API_KEY": "",
"OPENAI_DIRECT_KEY": "",
"USE_OPENROUTER": "",
"SITE_URL": "",
"SITE_NAME": "",
"DISCORD_APP_ID": "",
"DISCORD_TOKEN": "",
"BIRDEYE_API_KEY": ""
}
Note: You'll get notifications about Twitter login from unknown location, maybe best to exclude Twitter
# Development mode
npm run dev
# Build and run production
npm run build
npm start
# Generate daily summary
npm run generator
# Generate daily summary for specific date
npm run generator --date=2025-01-01
# Grab Historical Data from sources ( default 60 days )
npm run historical
# Grab Historical Data from sources ( Specific number of days )
npm run historical --day=10
src/
├── aggregator/ # Core aggregation logic
├── plugins/
│ ├── ai/ # AI provider implementations
│ ├── enrichers/ # Content enrichment plugins
│ ├── generators/ # Summary generation tools
│ ├── sources/ # Data source implementations
│ └── storage/ # Database storage handlers
├── types.ts # TypeScript type definitions
├── index.ts # Main application entry
└── generator.ts # Summary generator entry
└── historical.ts # Grab historical data entry
- Implement the
ContentSource
interface - Add configuration in
index.ts
- Register the source with the aggregator
Example:
class NewSource implements ContentSource {
public name: string;
async fetchItems(): Promise<ContentItem[]> {
// Implementation
}
}
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
MIT License - see the LICENSE file for details
Core data structure used throughout the application:
interface ContentItem {
id?: number; // Assigned by storage
cid: string; // Content Id from source
type: string; // "tweet", "newsArticle", "discordMessage", etc.
source: string; // "twitter", "discord", "github", etc.
title?: string; // Optional title
text?: string; // Main content text
link?: string; // URL to original content
topics?: string[]; // AI-generated topics
date?: number; // Creation/publication timestamp
metadata?: Record<string, any>; // Additional source-specific data
}
Daily summaries are stored in JSON files with this structure:
[
{
"title": "Topic Category",
"messages": [
{
"text": "Summary or content text",
"sources": [
"https://source1.com/link",
"https://source2.com/link"
],
"images": [
"https://image1.com/url"
],
"videos": [
"https://video1.com/url"
]
}
]
}
]
- Monitors specified Twitter accounts
- Captures tweets, retweets, media
- Metadata includes engagement metrics
- Channel messages monitoring
- Announcement tracking
- Server activity summaries
- Repository activity tracking
- Pull requests and commits
- Issue tracking and summaries
- Token price monitoring (Solana)
- Market data from CoinGecko
- Trading metrics and volume data
The application runs hourly tasks via GitHub Actions:
- Twitter monitoring: every 30 minutes
- Discord monitoring: every 6 minutes
- Announcements: hourly
- GitHub data: every 6 hours
- Market analytics: every 12 hours
- Daily summaries: generated once per day
# Twitter Authentication
TWITTER_USERNAME= # Account username
TWITTER_PASSWORD= # Account password
TWITTER_EMAIL= # Account email
# OpenAI Configuration
OPENAI_API_KEY= # API key for GPT models
# Discord Integration
DISCORD_APP_ID= # Discord application ID
DISCORD_TOKEN= # Bot token
# Analytics
BIRDEYE_API_KEY= # Optional: For Solana token analytics
The application uses SQLite with two main tables:
CREATE TABLE items (
id INTEGER PRIMARY KEY AUTOINCREMENT,
cid TEXT,
type TEXT NOT NULL,
source TEXT NOT NULL,
title TEXT,
text TEXT,
link TEXT,
topics TEXT,
date INTEGER,
metadata TEXT
);
CREATE TABLE summary (
id INTEGER PRIMARY KEY AUTOINCREMENT,
type TEXT NOT NULL,
title TEXT,
categories TEXT,
date INTEGER
);