npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dofek/velohero

v0.1.4

Published

Unofficial VeloHero API client using reverse-engineered session authentication

Downloads

371

Readme

@dofek/velohero

Unofficial TypeScript client for VeloHero's private workout-export API.

This package is not affiliated with, endorsed by, or supported by VeloHero. The endpoints and response shapes were observed from VeloHero's web application, are not a supported public API contract, and may change without notice. Use only with an account and data you are authorized to access.

Requirements

  • Node.js 22.14 or newer

Install

npm install @dofek/velohero

Quick start

import { VeloHeroClient } from "@dofek/velohero";

const username = process.env.VELOHERO_USERNAME;
const password = process.env.VELOHERO_PASSWORD;
if (!username || !password) {
  throw new Error("Set VELOHERO_USERNAME and VELOHERO_PASSWORD");
}

const { sessionCookie, userId } = await VeloHeroClient.signIn(
  username,
  password,
);
const client = new VeloHeroClient(sessionCookie);

const workouts = await client.getWorkouts("2026-01-01", "2026-01-31");
const firstWorkout = workouts[0]
  ? await client.getWorkout(workouts[0].id)
  : null;

console.log({ userId, workoutCount: workouts.length, firstWorkout });

Dates passed to getWorkouts use YYYY-MM-DD.

Authentication lifecycle

VeloHeroClient.signIn(username, password) posts form data to the observed /sso endpoint and returns:

{
  sessionCookie: string; // "VeloHero_session=<session token>"
  userId: string;
}

Pass sessionCookie to the constructor. Treat it like a password: do not log it or expose it to a browser. The private response does not provide expiry metadata, and this package has no session-refresh method. When VeloHero rejects an expired session, sign in again and construct a new client.

Both the constructor and signIn accept an optional fetch implementation as their final argument for compatible runtimes and network-level tests.

Public API

The package root exports VeloHeroClient:

  • VeloHeroClient.signIn(username, password, fetch?)
  • new VeloHeroClient(sessionCookie, fetch?)
  • client.getWorkouts(dateFrom, dateTo)
  • client.getWorkout(id)

Additional modules are available through documented deep imports:

import {
  parseDurationToSeconds,
  parseVeloHeroWorkout,
  type ParsedVeloHeroWorkout,
} from "@dofek/velohero/parsing";
import {
  mapVeloHeroSport,
  VELOHERO_SPORT_MAP,
} from "@dofek/velohero/sports";
import type {
  VeloHeroSsoResponse,
  VeloHeroWorkout,
  VeloHeroWorkoutsResponse,
} from "@dofek/velohero/types";

parseVeloHeroWorkout converts VeloHero's string-valued export record to a provider-neutral activity summary while retaining observed metrics in raw.

Rate limits and errors

Observed client behavior:

  • HTTP 429 throws ProviderRateLimitError from @dofek/provider-http/rate-limit. Its retryAfterSeconds property is parsed from Retry-After when present.
  • HTTP 502, 503, and 504 throw ProviderServiceUnavailableError from the same module.
  • Other unsuccessful sign-in and API responses throw Error containing the HTTP status and response body.
  • The client does not automatically sleep or retry. Callers decide whether and when an operation is safe to repeat.
  • Successful private responses are represented by TypeScript interfaces, not runtime-validated schemas. Be prepared for upstream shape changes.

Observed private protocol

  • Base URL: https://app.velohero.com
  • Sign-in: POST /sso using form fields user, pass, and view=json
  • Authentication: VeloHero_session cookie
  • Workout list: GET /export/workouts/json
  • Workout detail: GET /export/workouts/json/{id}

These details document observed behavior; they are not promises made by VeloHero.

Project