Skip to main content

Tutorials

Every tutorial below is a real script in the repo's examples/ directory. The page shows what you will build, which upstream sources the script hits, the full script, and its output. The output is not typed in: the docs build runs each script offline against committed fixtures (captured responses under test/fixtures/) and injects what it printed, so the tables you see are the tables the code produces, and a parser change that alters them fails CI until the page is regenerated.

To run one yourself:

git clone https://github.com/sportsdataverse/sportsdataverse-js && cd sportsdataverse-js
npm ci && npm run build
cd examples && npm install
node 01_nba_scoreboard_to_table.mjs # offline, same output as the page
SDV_LIVE=1 node 01_nba_scoreboard_to_table.mjs # the real hosts

New here? Start with the Quickstart guide (install, first raw and parsed calls); every tutorial below assumes it.

#TutorialScriptSources used
1The cross-league surface13_discover_and_utilities.mjsESPN teams (site.api.espn.com), the package's own index
2From scoreboard to a table01_nba_scoreboard_to_table.mjsESPN NBA scoreboard (site.api.espn.com)
3NBA play-by-play shots02_nba_pbp_shots.mjsESPN NBA summary (site.api.espn.com)
4WNBA standings03_wnba_standings.mjsESPN WNBA standings (site.api.espn.com)
5NFL schedule and standings04_nfl_schedule_and_standings.mjsESPN NFL scoreboard + standings (site.api.espn.com)
6College football rankings and drives05_cfb_rankings_and_pbp.mjsESPN CDN rankings + playbyplay (cdn.espn.com)
7College basketball: T-Rank and box scores06_college_basketball_torvik_and_espn.mjsBartTorvik (barttorvik.com), ESPN MBB summary (site.api.espn.com)
8MLB: Statcast and the Stats API07_mlb_statcast_and_stats_api.mjsBaseball Savant (baseballsavant.mlb.com), MLB Stats API (statsapi.mlb.com)
9NHL: api-web and EDGE08_nhl_api_web_and_edge.mjsNHL api-web + EDGE (api-web.nhle.com)
10PWHL Corsi from HockeyTech09_hockeytech_pwhl_corsi.mjsHockeyTech / LeagueStat (lscluster.hockeytech.com)
11Soccer across leagues10_soccer_cross_league.mjsESPN soccer standings (site.api.espn.com), ESPN CDN scoreboard (cdn.espn.com)
12The Odds API and market math11_providers_odds_math.mjsThe Odds API (api.the-odds-api.com)
13Release-dataset loaders12_release_loaders.mjsGitHub Releases (github.com/sportsdataverse/sportsdataverse-data)
14Shot chart with sdvplot + sporty90_sdvplot_shot_chart.mjsESPN NBA summary (site.api.espn.com); @sportsdataverse/sporty, @sportsdataverse/sdvplot
15Standings bars in team colours91_sdvplot_standings_colors.mjsESPN WNBA standings (site.api.espn.com); @sportsdataverse/sdvplot
16Roster table with headshots92_sdvplot_roster_table.mjsESPN NBA roster (site.api.espn.com); @sportsdataverse/sdvplot

Tutorials 14–16 use sdvplot-js, which is not published to npm yet; see the shot chart page for how to build and link it.