QuakeDetector is a real-time, location-based earthquake monitoring and alerting platform. It ingests continuous global seismic events from the USGS, processes real-time proximity alerts and swarms, and routes low-latency, personalized notifications through an interactive Telegram bot and a live operational dashboard.
Follow these steps to set up and run QuakeDetector locally.
Ensure you have the following installed on your machine:
- Node.js (v18 or higher)
- npm (v9 or higher)
- PostgreSQL (with the PostGIS extension enabled)
Create a .env file in the root directory. You can use the following template:
DATABASE_URL="postgresql://username:password@localhost:5432/quake_detector?schema=public"
TELEGRAM_BOT_TOKEN="your_telegram_bot_token"
DASHBOARD_URL="http://localhost:5173"
PORT=3001
NODE_ENV=developmentPrepare the PostgreSQL database and synchronize the Prisma schema:
# Push the Prisma schema directly to the database
npx prisma db pushStart the entire workspace concurrently:
# Run all services (Ingestion, API, and Dashboard)
npm run devAlternatively, you can run individual services independently:
# Run the API & Alerts server
npm run api
# Run the Ingestion service
npm run ingest
# Run the Dashboard web app
npm run webOnce the services are active, the Telegram bot immediately begins listening for messages.
- Message the bot using your Telegram account (search for your bot's username).
- Auto-Registration: Simply say "Hi" or send
/startto instantly register your Telegram Chat ID in the database. - Use the following commands to test location tracking and alerting:
- Add Location: Type any city name directly (e.g.,
TokyoorLos Angeles) to geocode and monitor that location. Alternatively, use/addlocation <city>. /locations— View your monitored locations and their current live Risk Scores./removelocation <id>— Stop monitoring a location./status— View live platform telemetry (latest polls, DB event count, system health)./digest— Request an on-demand 24-hour daily summary showing magnitude breakdowns and active seismic regions.
- Add Location: Type any city name directly (e.g.,
apps/ingestion: USGS poller and historical data reconciler.apps/api: Express API server, SSE streaming, risk calculator, and Telegram bot.apps/web: Operational dashboard built with React.