An open-source maritime OSINT (Open Source Intelligence) platform designed to give analysts, port authorities, investigative journalists, and compliance officers the same high-caliber vessel risk intelligence that enterprise tools ($100K+/yr) provide—built entirely on free and public data sources.
PortWatch combines real-time AIS decoding, multi-source sanctions screening, automated ownership graph resolution, and geospatial behavioral risk analysis (dark events, STS transfers) into a unified, high-performance platform.
[ AIS Ingest & NMEA Decode ] (AISStream WebSocket / pyais)
│
▼
[ Identity Resolution Agent ] (Registered/Beneficial Owners, Equasis & GISIS)
│
▼
[ Sanctions Screening Agent ] (OFAC SDN, EU, UN, OFSI fuzzy name match >=85%)
│
▼
[ Behavior Analysis Agent ] (Dark events, STS transfers, AIS spoofing, loitering)
│
▼
[ Risk Scoring Agent ] (Deterministic, fully auditable 0-100 score & breakdown)
│
▼
[ Intel Report Agent ] (PDF Generation with WeasyPrint + optional LLM narrative)
- Real-time AIS Vessel Map: Live positions visualized on an interactive dark-themed Leaflet map. Custom ship-shaped SVG markers dynamically colored by vessel category and oriented according to heading.
- Dark Vessel Detection: Detects and logs when a vessel turns off its AIS transceiver (silent for 6h coastal / 24h open ocean) outside known terrestrial dead zones.
- Ship-to-Ship (STS) Transfer Alerts: Identifies potential STS transfers based on geospatial proximity (vessels within 500m, travelling <2kts, for over 30 minutes, off-port-limits).
- Ownership Graph Resolution: Renders complex 3–5 layer maritime ownership chains (Registered Owner, ISM Manager, Beneficial Owner) in a responsive D3 force-directed graph featuring interactive drag, zoom, and relationship mapping.
- Comprehensive Sanctions Screening: Fuzzy name matching (via
rapidfuzztoken sort ratio) against:- US OFAC SDN List (daily XML feed)
- EU Consolidated Sanctions List
- UN Security Council Sanctions List
- UK OFSI Sanctions List
- Deterministic Risk Scoring: A fully auditable 0–100 risk score breakdown with evidence descriptions and links, strictly adhering to regulatory compliance frameworks.
- Premium PDF Intelligence Reports: Exquisite, A4-styled, print-perfect intelligence briefs generated directly via WeasyPrint and Jinja2 with clean page breaks and an optional LLM-assisted analysis narrative.
- Language & Framework: Python 3.12, FastAPI (async/await)
- Database: PostgreSQL with TimescaleDB (time-series AIS positions) and PostGIS (geospatial queries)
- Graph Processing: NetworkX
- Name Matching: RapidFuzz (C-optimized Levenshtein & Token Sort)
- Reporting: WeasyPrint + Jinja2 (HTML-to-PDF rendering without a headless browser)
- Language & Framework: TypeScript, React 19, Vite
- Mapping: Leaflet & React-Leaflet
- Visualizations: D3.js (Force-directed graphs)
- Styling: Custom Vanilla CSS for a premium glassmorphic, dark maritime aesthetic
The quickest way to spin up the entire PortWatch ecosystem (Database, Backend, and Frontend) is using Docker Compose.
- Docker & Docker Compose
- An API key from AISStream.io (Optional, mock data mode is active by default)
Clone the repository and copy the environment template:
cp .env.example .envOpen .env and set up your configurations:
DATABASE_URL(Defaults to internal compose connection)AISSTREAM_API_KEY(Optional)MOCK_DATA_MODE=True(Keep True to seed and run with realistic test data)
Start the service container cluster:
docker-compose up --build -dThis launches:
- Database: TimescaleDB + PostGIS on port
5432 - Backend: FastAPI API server on port
8000 - Frontend: React dev server on port
5173
Once the containers are running, populate the database with 100 realistic vessels, ownership chains, historic track points, dark events, STS interactions, and sanctions matches:
docker-compose exec backend python -m seed.generate_mock_dataAccess the dashboard at http://localhost:5173.
If you prefer to run the services bare-metal:
- Navigate to the backend directory:
cd backend - Create and activate a virtual environment:
python -m venv venv # On Windows .\venv\Scripts\activate # On Unix/macOS source venv/bin/activate
- Install dependencies:
pip install -e . - Run database migrations:
alembic upgrade head
- Seed data:
python -m seed.generate_mock_data
- Start the FastAPI application:
uvicorn app.main:app --reload
- Navigate to the frontend directory:
cd frontend - Install dependencies:
npm install
- Launch the development server:
npm run dev
├── backend/ # FastAPI Application
│ ├── app/
│ │ ├── agents/ # Identity, Sanctions, Risk, & Report Agents
│ │ ├── models/ # SQLAlchemy DB Models (TimescaleDB/PostGIS)
│ │ ├── routers/ # API Handlers & WebSockets
│ │ ├── schemas/ # Pydantic Schemas
│ │ ├── services/ # AIS Stream, Name Matcher, PDF Reports
│ │ └── templates/ # HTML Templates for Reports (WeasyPrint)
│ ├── seed/ # Synthetic Data Generation Scripts
│ ├── Dockerfile
│ └── pyproject.toml
├── frontend/ # Vite & React SPA
│ ├── src/
│ │ ├── components/ # Custom Glassmorphic Cards, Search, Badges
│ │ ├── hooks/ # Live WebSocket Map Handlers
│ │ └── styles/ # Deep Dark Maritime Design Tokens
│ ├── index.html
│ └── package.json
├── docker-compose.yml # Multi-container orchestration
└── PortWatch_PRD.md # Original Product Requirements Document
PortWatch includes low-latency engineering optimizations across the telemetry ingestion, geospatial computation, and UI rendering pipelines:
- Zero-Alloc Map Sorting:
Date.parse()timestamp comparator inVesselMapavoids up to 28,000 intermediateDateobject instantiations on viewport pan/zoom events. - Decoupled Marker Event Handlers:
vesselRefpattern inVesselMarkerprevents thousands of mounted Leaflet markers from invalidating click handlers on live position updates. - O(1) Map-Based Telemetry Merge: Map-indexed vessel updates in
useVesselseliminate full O(N) array index scans on WebSocket flushes and short-circuit when data is unchanged. - On-Demand Debounced Search: Replaced continuous 1,500-item search index generation with on-demand scans during active user typing.
- Fast-Path Dark Detection: Minimum-gap filtering (< 6h) skips geospatial database round-trips for 99.9% of normal AIS telemetry.
- Single Round-Trip Coastal Spatial Checks: Short-circuits
ST_DWithinPostGIS queries without running redundantCOUNT(*)fallback checks on hits. - Single-Session Ingestion Transactions: Position telemetry and static identity updates share an atomic DB session to prevent partial rollback inconsistencies.
- Non-Blocking Analytics Seeding: New vessel metadata enrichment runs via background
asynciotasks, eliminating 50–200ms ingest loop stalls. - Single-Serialization Broadcasts: Unfiltered WebSocket payloads are JSON-serialized once and broadcast across all connected clients.
- Antipodal Geodesic Stability: Haversine distance functions clamp intermediate arguments to prevent domain errors on exact antipodal coordinates.
PortWatch is open-source software licensed under the AGPL-3.0 License.
We welcome contributions of all forms:
- Geospatial analysis heuristics (new risk indicators)
- Integrations for additional open registries
- Fuzzy name matching enhancements
- Performance updates on the TimescaleDB tracking pipeline
Check out CONTRIBUTING.md for details on code style, linting, and PR submissions.
⚓ PortWatch — Empowering global compliance, OSINT journalists, and port authorities with absolute transparency in international shipping.