This project leverages PostgreSQL with the PostGIS extension for advanced geospatial capabilities.
erDiagram
USER ||--o{ PUBLISHED_EVENTS : "approves"
PENDING_EVENTS ||--o{ SYSTEM_LOGS : "logs"
INGEST_SOURCES ||--o{ PENDING_EVENTS : "feeds"
PUBLISHED_EVENTS {
uuid id PK
string title
text description
geometry coordinates "PostGIS Point"
string severity
string source_url
string image_url
string user_id FK
datetime source_created_at
datetime created_at
}
PENDING_EVENTS {
uuid id PK
string source
text raw_source
string suggested_title
text suggested_description
geometry suggested_coordinates
string status "pending|processing|processed|failed|rejected"
string source_url
string image_url
datetime source_created_at
}
INGEST_SOURCES {
uuid id PK
string type "telegram|x|rss"
string value "username"
boolean is_active
datetime last_fetched_at
}
USER {
string id PK
string email
string role "admin|moderator|analyst|user"
}
The source of truth for all live markers visible to the public.
id: UUID (Primary Key)title: Stringcoordinates:geometry(Point, 4326)(PostGIS Geometry)severity: Enum (low,medium,high,critical)userId: Reference to the user who approved the intel.sourceUrl: Persistent hyperlink to the original claim.imageUrl: Public link to visual evidence (Vercel Blob proxy).
The staging area for raw incoming data and geolocated AI payloads.
source: The origin identifier (e.g., Telegram handleosintdefender)raw_source: The original text payload.suggested_coordinates: AI-estimated geometry point.status: Lifecycle hook (pending,processing,processed,failed,rejected).sourceUrl/imageUrl: Deep-links and visual proxies pulled simultaneously upon ingestion.
Registry configuration node for scraping targets.
type: Target format (telegram,x,rss,custom).value: Target handle identifier.isActive: Maintenance kill-switch toggle for active scraping without payload loss.
email: String (Unique)role: Enum (admin,moderator,analyst,user). This controls clearance bounds across the Administrative/admin/*routes.
Used in /api/events to filter markers by the current viewport. High performance via spatial indexing.
Located in lib/map-logic.ts. Converts raw latitude/longitude floats into a PostGIS geometry format during database insertion.
Used in the API to convert geometry points back into latitude/longitude decimals so the browser can understand them.