This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Go web client for P2PQuake, a Japanese earthquake monitoring system. The application displays earthquake information, tsunami warnings, and user-reported earthquake sensing data from MongoDB collections.
- Backend: Go HTTP server with MongoDB integration
- Frontend: Server-side rendered HTML templates with TailwindCSS
- Data Sources: Two MongoDB collections -
whole(general events) andjma(Japan Meteorological Agency data) - Event Types:
- Code 551/552/556: Official earthquake/tsunami/EEW data
- Code 9611: User-reported earthquake sensing data
main.go: HTTP server setup with MongoDB connectionhandler/: HTTP request handlers for index and item pagesmodel/: Data conversion from MongoDB BSON to Go structsrenderer/: HTML template rendering enginetemplate/: HTML templates for different event typesstatic/: CSS and image assets
The earthquake model includes complex logic for:
- Scale prioritization (震度5弱以上と推定 gets lower priority than actual 震度5弱)
- Point deduplication by city/municipality
- Prefecture-based grouping
- Time formatting for Japanese locale
go run main.go./generate.sh
# or manually:
npx tailwindcss -i template/input.css -o static/main.cssdocker build -t web-client .Required for runtime:
MONGODB_URL: MongoDB connection stringDATABASE: MongoDB database nameCOLLECTION: MongoDB collection name for general eventsGTM_CONTAINER_ID: Google Tag Manager container ID (optional)
Templates use Go's html/template with custom functions:
date: Current timestamp in Japanese formatgtag: Google Tag Manager container ID
Templates are organized by event type (earthquake.html, tsunami.html, eew.html, userquake.html) with a shared layout.html.