This project gives you a fully local starter stack:
n8nautomationFastAPIwebsite/APIMySQLdatabase
Included workflow files:
n8n-warnews-local.json(local ingest test workflow)n8n-warnews-15feeds.json(phase 2: resilient 15-feed workflow with validation/enrichment)n8n-ai-agent-starter.json(chat agent starter, optional)
- Copy
.env.exampleto.env. - Update secrets in
.env. - Start services:
docker compose up --build
- Website/API:
http://localhost:8000 - n8n:
http://localhost:5678
- Open n8n.
- Go to Workflows -> Import from File.
- Select
n8n-warnews-local.json. - Run with Manual Trigger.
The workflow sends a test article to FastAPI using POST /ingest.
- Visit
http://localhost:8000/articles. - Open the new article detail page.
- Ingest endpoint:
POST /ingest - Header required:
x-api-key: <INGEST_API_KEY> - Health check:
GET /health - Admin review UI:
GET /admin/review?admin_key=<ADMIN_API_KEY> - Admin actions:
POST /admin/review/{article_id}/publish?admin_key=<ADMIN_API_KEY>POST /admin/review/{article_id}/reject?admin_key=<ADMIN_API_KEY>
- n8n ingests incoming news to
POST /ingest. - Each item is placed in
pendingeditorial review with an auto confidence score. - Public pages show only
publishedarticles. - Open admin queue and publish/reject per item.
- n8n pipeline now validates content quality before ingest.
- Each item includes:
regionevent_key(for event clustering)confidence_hint
- API computes:
- source-agreement adjusted confidence
- confidence band (
high/medium/low) - source match count for same event
- Optional auto-publish for strong items:
- set
AUTO_PUBLISH_HIGH_CONFIDENCE=truein.env
- set
- Each ingested article now stores claim blocks with:
- claim text
- citation URL
- per-claim confidence
- verdict (
confirmed/provisional/disputed)
- Article detail page now shows citation blocks and confidence per claim.
- Extraction mode:
- OpenRouter recommended: set
OPENROUTER_API_KEYand model - fallback:
OPENAI_API_KEY - if no key is set: heuristic fallback extraction
- OpenRouter recommended: set
- Optional env:
OPENAI_EXTRACTION_MODEL=qwen/qwen3-coder:freeLLM_API_BASE=https://openrouter.ai/api/v1OPENROUTER_API_KEY=...OPENROUTER_SITE_URL=http://localhost:8000OPENROUTER_APP_NAME=war-news-agent
- Detects likely contradictions between claims in the same
event_key. - Flags conflicts when:
- opposite polarity language is found (e.g., "confirmed" vs "denied")
- key numeric mismatch appears in similar claim topics
- Stores conflict alerts in
claim_conflicts. - Admin conflict dashboard:
GET /admin/conflicts?admin_key=<ADMIN_API_KEY>
- Conflict actions available in dashboard:
resolvedfalse_positiveneeds_investigation
- New endpoint:
POST /admin/conflicts/{conflict_id}/status?admin_key=<ADMIN_API_KEY>
- Feedback logic:
- when
needs_investigationis selected, linked article confidence is reduced - low-confidence published items are moved back to
pendingautomatically
- when
- New reliability model per source (
source_reliability) learns from conflict outcomes. - Source reliability score updates on:
- ingest volume
- open conflicts
- resolved conflicts
- false positives
- needs investigation
- New admin analytics page:
GET /admin/analytics?admin_key=<ADMIN_API_KEY>- shows conflict trend snapshot
- region distribution
- lowest reliability sources first
- Reliability repair endpoint:
POST /admin/analytics/rebuild-reliability?admin_key=<ADMIN_API_KEY>- recalculates all source reliability counters/scores from current database state
This repo now includes Vercel config:
api/index.py(serverless entrypoint)vercel.json(route all requests to FastAPI app)
- Host MySQL externally (Vercel has no local MySQL service).
- Keep n8n hosted separately (n8n Cloud / VPS / Railway) and point it to your Vercel URL.
Set these in Vercel project settings:
DATABASE_URL(remote MySQL URL usingmysql+pymysql://...)INGEST_API_KEYADMIN_API_KEYAUTO_PUBLISH_HIGH_CONFIDENCE(trueorfalse)OPENROUTER_API_KEY(if using model extraction)OPENAI_EXTRACTION_MODEL(default:qwen/qwen3-coder:free)LLM_API_BASE(https://openrouter.ai/api/v1)OPENROUTER_SITE_URL(your Vercel domain)OPENROUTER_APP_NAME(any app name)
From project root:
npm i -g vercel(if needed)vercel loginvercel- For production:
vercel --prod
- Test health:
/health - Update n8n
POST /ingestURL to your Vercel domain - Keep admin routes protected with
admin_key
Add ADMIN_API_KEY in your .env, then restart:
docker compose up -d --build
After this local test works, replace the Build Payload node in n8n with:
- RSS/News source nodes
- AI summarization node
- same
POST /ingestnode


