A modern web application providing neutral, AI-curated news about Donald Trump and his cabinet.
- 🤖 AI-powered news neutralization
- 💳 Stripe subscription system
- 🔐 Secure authentication
- 📱 Responsive design
- 📊 Real-time updates
The application uses a sophisticated AI pipeline to ensure neutral, fact-based news coverage:
-
News Fetching
- Regularly polls NewsAPI for Trump-related articles
- Filters for English language content
- Deduplicates based on URL
-
AI Processing
- Uses OpenAI's GPT model for neutralization
- Separate prompts for headlines and descriptions
- Maintains factual accuracy while removing bias
- Formats descriptions with bullet points for clarity
-
Error Handling
- Graceful fallback to original content if AI fails
- Detailed error logging
- Status tracking for each article
-
Storage
- Stores both original and neutralized versions
- Tracks neutralization status
- Maintains error logs for debugging
The news_headlines table includes:
original_title: Raw headline from sourceneutral_title: AI-neutralized headlineoriginal_description: Raw article descriptionneutral_description: AI-neutralized descriptionneutralization_status: Processing status (pending/completed/failed)error_log: Detailed error information if processing fails
- Node.js 18+
- npm or yarn
- Supabase account
- Stripe account
- NewsAPI account
- OpenAI API access
-
Clone the repository:
git clone <repository-url> cd trump-tracker
-
Install dependencies:
npm install
-
Set up environment variables:
- Copy
.env.exampleto.env.local - Fill in all required values (see Environment Variables section)
- Copy
-
Start the development server:
npm run dev
Create a .env.local file with the following variables:
# Supabase
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
# Stripe
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
STRIPE_PRICE_ID=your_subscription_price_id
VITE_STRIPE_PUBLIC_KEY=your_stripe_publishable_key
# News API
NEWS_API_KEY=your_news_api_key
# OpenAI
OPENAI_API_KEY=your_openai_api_key
# API Security
API_KEY=your_secure_api_key-
For development:
- Use
.env.localfor local environment variables - Use Stripe test mode keys
- Set
NODE_ENV=development
- Use
-
For production:
- Set environment variables in your hosting platform
- Use Stripe live mode keys
- Set
NODE_ENV=production
- Use Stripe test mode
- Test card: 4242 4242 4242 4242
- Any future date for expiry
- Any 3 digits for CVC
-
Build the application:
npm run build
-
Deploy to your hosting platform:
- Upload the
distdirectory - Set all environment variables
- Configure build command:
npm run build - Configure start command:
npm run preview
- Upload the
-
Set up Stripe webhooks:
- Create a webhook endpoint in Stripe dashboard
- Point it to:
https://your-domain.com/api/stripe-webhook - Add the webhook secret to your environment variables
-
Configure the news fetch schedule:
- Set up a cron job to hit the fetch endpoint daily
- Recommended time: 00:00 UTC
- Endpoint:
https://your-domain.com/api/fetch-news - Include API key in headers:
Authorization: Bearer your_api_key
- View Supabase logs in the Supabase dashboard
- Monitor Stripe events in the Stripe dashboard
- Check edge function logs in Supabase Edge Functions logs
-
Start the development server:
npm run dev
-
Test the news fetch:
curl -X POST https://your-domain.com/api/fetch-news \ -H "Authorization: Bearer your_api_key" -
Monitor the logs:
- Check browser console for frontend errors
- Check Supabase dashboard for backend logs
- Check Stripe dashboard for webhook events
MIT License - see LICENSE file for details