fitzroy
v1.4.2
Published
TypeScript port of the fitzRoy R package — programmatic access to AFL data including match results, player stats, fixtures, ladders, and more
Maintainers
Readme
fitzroy
TypeScript library and CLI for AFL data — match results, player stats, fixtures, ladders, lineups, squads, and teams.
A port of the fitzRoy R package.
Data Sources
- AFL API — official AFL/AFLW match results, player stats, fixtures, lineups, ladders, and teams
- FootyWire — scraped match results
- AFL Tables — historical season results (1897-present)
Install
npm install fitzroyLibrary Usage
import { fetchMatchResults, fetchPlayerStats, fetchLadder } from "fitzroy";
// Match results for a season
const matches = await fetchMatchResults({ source: "afl-api", season: 2025, competition: "AFLM" });
// Player stats for a specific round
const stats = await fetchPlayerStats({ source: "afl-api", season: 2025, round: 1 });
// Ladder standings
const ladder = await fetchLadder({ source: "afl-api", season: 2025 });All functions return Result<T, Error> — check result.success before accessing result.data.
CLI
# Install globally
npm install -g fitzroy
# Match results
fitzroy matches --season 2025 --round 1
# Player stats
fitzroy stats --season 2025 --round 1
# Ladder
fitzroy ladder --season 2025
# Fixture
fitzroy fixture --season 2025
# Output formats
fitzroy matches --season 2025 --json # JSON (default when piped)
fitzroy matches --season 2025 --csv # CSV with headers
fitzroy matches --season 2025 --full # All columns in table viewRun fitzroy --help for all commands and options.
Contributing
- Clone the repo
- Install dependencies:
bun install - Run quality checks:
npm run typecheck && npm run check && npm run test
License
MIT
