Altuvi/ElectionGuard

ElectionGuard is an AI-powered web platform designed to detect misinformation and vulnerabilities in election-related articles

JavaScript

0

170 commits

updated May 7, 2026

See the code

README

capstone-project-26t1-9900-w09c-almond

Prerequisites


Deployment

1. Configure environment variables

Top-level .env (next to docker-compose.deploy.yml) — controls the database: Use the provided .env file in the root directory to fill in values.

cp .env.example .env

backend/.env — controls the application. Copy the example and fill in your values:

cp backend/.env.example backend/.env

Then edit backend/.env:

VariableDescription
FIRECRAWL_API_KEYAPI key for Firecrawl (article ingestion)
GNEWS_API_KEYAPI key for Gnews (article ingestion)
JWT_SECRET_KEYSecret key for authentication — use a long random string
INGEST_SCHEDULE_SECONDSHow often to fetch new articles in seconds (default: 3600, minimum recommended: 600)
TARGET_NUM_ARTICLESNumber of articles to fetch per run (default: 10, maximum recommended: 25)

2. Start the application

docker compose -f docker-compose.deploy.yml up -d

On first run, Docker will build the images — this may take several minutes as it downloads the NLP model weights.

3. Verify everything is running

docker compose -f docker-compose.deploy.yml ps

All services should show a status of running.

Services

ServiceURLDescription
Frontendhttp://localhost:3000Main web application
Backend APIhttp://localhost:5000REST API
Flowerhttp://localhost:5555Background task monitor

Stopping the application

docker compose -f docker-compose.deploy.yml down

This stops all containers but preserves the database and model cache. To also delete all stored data:

docker compose -f docker-compose.deploy.yml down -v

Updating to a new version

docker compose -f docker-compose.deploy.yml down
docker compose -f docker-compose.deploy.yml up -d --build

Local Development

Prerequisites

  • Python 3.12+
  • Node.js 20+
  • Docker & Docker Compose (for database and Redis)

Backend setup

1. Create backend/.env:

DB_USER=username
DB_PASSWORD=password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=articlesdb
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0
GNEWS_API_KEY=your_key_here
FIRECRAWL_API_KEY=your_key_here
JWT_SECRET_KEY=your_secret_here

2. Install dependencies:

cd backend
python -m venv env
source env/bin/activate      # Mac/Linux
env\Scripts\activate         # Windows
pip install -r requirements.txt

3. Start database and Redis:

docker compose up -d

4. Run the backend (three terminals from backend/ with venv activated):

# Terminal 1 — Flask server
python run.py

# Terminal 2 — Celery worker
celery -A celery_worker.celery_app worker --loglevel=info -Q ingestion,nlp

# Terminal 3 — Celery beat
celery -A celery_worker.celery_app beat --loglevel=info

Frontend setup

cd frontend
npm install
npm start

Manually triggering ingestion

cd backend
celery -A celery_worker.celery_app call app.tasks.ingest.ingest_data

Altuvi/ElectionGuard

ElectionGuard is an AI-powered web platform designed to detect misinformation and vulnerabilities in election-related articles

JavaScript

0

170 commits

updated May 7, 2026

See the code

README

capstone-project-26t1-9900-w09c-almond

Prerequisites


Deployment

1. Configure environment variables

Top-level .env (next to docker-compose.deploy.yml) — controls the database: Use the provided .env file in the root directory to fill in values.

cp .env.example .env

backend/.env — controls the application. Copy the example and fill in your values:

cp backend/.env.example backend/.env

Then edit backend/.env:

VariableDescription
FIRECRAWL_API_KEYAPI key for Firecrawl (article ingestion)
GNEWS_API_KEYAPI key for Gnews (article ingestion)
JWT_SECRET_KEYSecret key for authentication — use a long random string
INGEST_SCHEDULE_SECONDSHow often to fetch new articles in seconds (default: 3600, minimum recommended: 600)
TARGET_NUM_ARTICLESNumber of articles to fetch per run (default: 10, maximum recommended: 25)

2. Start the application

docker compose -f docker-compose.deploy.yml up -d

On first run, Docker will build the images — this may take several minutes as it downloads the NLP model weights.

3. Verify everything is running

docker compose -f docker-compose.deploy.yml ps

All services should show a status of running.

Services

ServiceURLDescription
Frontendhttp://localhost:3000Main web application
Backend APIhttp://localhost:5000REST API
Flowerhttp://localhost:5555Background task monitor

Stopping the application

docker compose -f docker-compose.deploy.yml down

This stops all containers but preserves the database and model cache. To also delete all stored data:

docker compose -f docker-compose.deploy.yml down -v

Updating to a new version

docker compose -f docker-compose.deploy.yml down
docker compose -f docker-compose.deploy.yml up -d --build

Local Development

Prerequisites

  • Python 3.12+
  • Node.js 20+
  • Docker & Docker Compose (for database and Redis)

Backend setup

1. Create backend/.env:

DB_USER=username
DB_PASSWORD=password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=articlesdb
CELERY_BROKER_URL=redis://localhost:6379/0
CELERY_RESULT_BACKEND=redis://localhost:6379/0
GNEWS_API_KEY=your_key_here
FIRECRAWL_API_KEY=your_key_here
JWT_SECRET_KEY=your_secret_here

2. Install dependencies:

cd backend
python -m venv env
source env/bin/activate      # Mac/Linux
env\Scripts\activate         # Windows
pip install -r requirements.txt

3. Start database and Redis:

docker compose up -d

4. Run the backend (three terminals from backend/ with venv activated):

# Terminal 1 — Flask server
python run.py

# Terminal 2 — Celery worker
celery -A celery_worker.celery_app worker --loglevel=info -Q ingestion,nlp

# Terminal 3 — Celery beat
celery -A celery_worker.celery_app beat --loglevel=info

Frontend setup

cd frontend
npm install
npm start

Manually triggering ingestion

cd backend
celery -A celery_worker.celery_app call app.tasks.ingest.ingest_data