Public site: troutlytics.com
Backend repository: troutlytics-backend
Troutlytics Frontend is a Next.js app that turns Washington State trout stocking records into an interactive product for anglers, hatchery teams, and fisheries stakeholders.
This README is written for contributors and maintainers.
- WDFW trout plant records are public, but raw reports are hard to filter and compare quickly.
- It is difficult to understand statewide stocking patterns (time, species, hatchery, location) from spreadsheets alone.
- Centralized, filterable UI for recent and historical stocking activity.
- Interactive analytics (time series, composition, distribution, rankings).
- Geospatial map experience with clustered markers and route links.
- Hatchery-level profiles that aggregate long-range production patterns.
/Home/marketing landing page/dashboardDate-range analytics workspace/mapInteractive statewide stocking map/hatcheriesHatchery explorer with all-time insights/aboutMission and context/contactMaintainer contact
- Total stocked over time
- Cumulative stocking progress
- Top species trendlines
- Species composition pie
- Top waters bar chart
- Release-size histogram
- Average fish weight trend
- Sortable release table
- Leaflet + marker clustering + fullscreen support
- Popups grouped by coordinate with release details
- “Get Directions” outbound links per water body
- Search/filter hatchery names
- All-time aggregate totals by hatchery
- Species and top-water breakdowns
- First/most recent stocking dates + recent events table
- Framework: Next.js (Pages Router), React 19, TypeScript
- Styling: Tailwind CSS 4 + custom global theme styles
- Data layer: SWR + context providers
- Charts: Chart.js via
react-chartjs-2 - Map: Leaflet +
leaflet.markercluster+leaflet-fullscreen
ApiDataProviderowns the active date range state.DateRangePickerupdates that range.useApiDatafetches filtered API resources via SWR.- Dashboard and map components consume shared context data.
- Hatchery page uses
HatcheryDataProviderfor all-time aggregation logic.
The frontend reads from the Troutlytics backend API.
Current endpoints used:
/stocked_lakes_data(date-range filtered)/hatchery_totals(date-range filtered)/total_stocked_by_date_data(date-range filtered)/stocked_lakes_data_all_time/hatchery_names/date_data_updated/derby_lakes_data(fetched but not currently surfaced in UI)
Environment-controlled API base:
NEXT_PUBLIC_ENVIRONMENT=dev->http://localhost:8080- any other value ->
https://xtczssso08.execute-api.us-west-2.amazonaws.com
- Node.js (18+ recommended)
- npm
- Running Troutlytics backend service (local or remote)
-
Install dependencies.
npm install
-
Configure environment in
.env.local.NEXT_PUBLIC_ENVIRONMENT="dev" -
Start the frontend.
npm run dev
-
Open
http://localhost:3000
NEXT_PUBLIC_ENVIRONMENTdevuses local backend (http://localhost:8080)- anything else uses production API Gateway endpoint
NEXT_PUBLIC_HATCHERY_DATA_START(optional)- Used by hatchery analytics context
- Defaults to
2010-01-01if not provided
npm run devStart local dev server (Turbopack)npm run buildBuild production bundlenpm run startStart production servernpm run lintRun Next.js lint checksnpm testRun Jest tests
-
Jest + Testing Library are configured for component tests.
-
Chart rendering is mocked in tests to avoid JSDOM canvas limitations.
-
Current suite can be run with:
npm test
- Frontend host: AWS Amplify (serving
troutlytics.com) - Backend API: AWS API Gateway endpoint consumed by this frontend
- Domain routing:
troutlytics.compoints at Amplify-hosted frontend
-
This repo does not include infrastructure-as-code for Amplify configuration.
-
Amplify environment variables must include
NEXT_PUBLIC_ENVIRONMENTset to a non-devvalue (commonlyprod). -
If new required env vars are added in code, add them to Amplify before shipping.
-
Validate production build locally before release:
npm run build npm run start
- Run
npm run lint - Run
npm test - Run
npm run build - Confirm API reads production endpoint when
NEXT_PUBLIC_ENVIRONMENTis notdev - Merge/deploy through the Amplify-connected branch workflow
- Washington Department of Fish and Wildlife trout plant reports:
https://wdfw.wa.gov/fishing/reports/stocking/trout-plants