How flowcore-io/fishfacts-ai-backend works
Fishfacts AI Backend is a Bun/Hono service for ingesting fisheries and regulatory data, publishing events, and serving geospatial and domain read models. The documented main flow is an API request or scheduled job producing Flowcore events; pathway transformer handlers then project events into read models, including J-melding geo fragments. Other major branches cover AIS activity, regulations, and supporting datasets and reports. Some subsystem links are grounded only in README statements or source-index references; unsampled implementation details are not inferred.
Main entry points: pathways.ts Pathway Runtime · app.ts HTTP Application · runner.ts Job Runner · routes.ts Regulation API
Components 26
API and Jobs
- HTTP Application
src/app.ts - Job Runner
src/jobs/runner.ts - Job State
src/jobs/state-store.ts
Events and Projections
- Pathway Runtime
src/pathways.ts - Event Contracts
src/events/contracts.ts - Event Repository
src/events/repository.ts - J-melding Assembly
src/jobs/jmelding-chunk-assembler.ts - Geo Projector
src/jmelding/geo-projector.ts - Geo Read Model
src/jmelding/geo-repository.ts
Regulations
- Regulation API
src/regulations/routes.ts - Command Runtime
src/regulations/command-runtime.ts - Coastal State
src/regulations/coastal-state.ts - Published Read Model
src/regulations/published-repository.ts
AIS Analytics
- AIS API
src/ais/routes.ts - Activity Queries
src/ais/activity-source.ts - Activity Cache
src/ais/activity-cache.ts - ClickHouse Repository
src/ais/clickhouse-repository.ts
Other Data Products
- Financial Reports
src/financials/repository.ts - GEBCO Ingestion
src/gebco/ingester.ts - POI Repository
src/poi/repository.ts - Reports API
src/reports/routes.ts - Corpus Index
src/logasavn/sweep.ts
Other components
- API Client
- Usable Service
- PostgreSQL
- Flowcore
Connections 26
- API Client → HTTP Application: sends requests
src/app.ts - HTTP Application → Pathway Runtime: writes events
src/app.ts - HTTP Application → Geo Read Model: queries geo
src/app.ts - API Client → Job Runner: runs jobs
README.md - Job Runner → Job State: tracks runs
src/jobs/runner.ts - Job Runner → J-melding Assembly: dispatches job
- J-melding Assembly → Flowcore: emits announcements
README.md - Flowcore → Pathway Runtime: delivers events
README.md - Pathway Runtime → Geo Projector: dispatches projection
src/pathways.ts - Geo Projector → Geo Read Model: upserts geo rows
README.md - Geo Read Model → PostgreSQL: reads and writes
src/jmelding/geo-repository.ts - Pathway Runtime → Event Repository: projects generic events
src/pathways.ts - Event Repository → PostgreSQL: stores events
src/events/repository.ts - HTTP Application → Regulation API: mounts API
src/app.ts - Regulation API → Command Runtime: executes commands
src/regulations/routes.ts - Published Read Model → PostgreSQL: reads published data
src/regulations/published-repository.ts - Regulation API → Published Read Model: uses published reads
src/regulations/published-routes.ts - AIS API → ClickHouse Repository: queries analytics
src/ais/routes.ts - AIS API → Activity Queries: queries activity
- Activity Queries → Activity Cache: uses cached results
src/ais/activity-routes.ts - Activity Cache → PostgreSQL: stores cache
src/ais/activity-cache.ts - Financial Reports → PostgreSQL: uses database
src/financials/repository.ts - GEBCO Ingestion → Pathway Runtime: publishes ingestion
src/jobs/gebco-ingest.ts - POI Repository → Usable Service: reads fragments
src/poi/repository.ts - Reports API → Usable Service: creates reports
src/reports/routes.ts - Corpus Index → Usable Service: publishes index
README.md