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 🙏

© 2025 – Pkg Stats / Ryan Hefner

f1-sim

v1.0.10

Published

Formula 1 racing simulation package with real data integration

Readme

🏎️ F1 Simulator Package A complete Formula 1 racing simulation package with real-world data integration, dynamic race features, and realistic race results.

📦 Installation bash Copy Edit npm install f1-simulator 🚀 Quick Start import { F1Client, Race, Track } from 'f1-simulator';

async function runSimulation() {
  try {
    const sessionKey = await F1Client.getSessionKey('Monza', 2023, 'Qualifying');
    const driversData = await F1Client.getDrivers(sessionKey);

    const track = new Track('Monza', 75, 95, 3); // name, minLapTime, maxLapTime, DRS zones

    const race = new Race({
      track,
      drivers: driversData,
      sessionKey,
      laps: 53,
      weather: 'dry' // Options: 'dry', 'wet', or 'dynamic'
    });

    await race.initialize();
    const results = race.simulate();

    console.log('\nRace Results:');
    results.forEach((driver, index) => {
      const status = driver.retired ? 'DNF' : `${driver.time.toFixed(3)}s`;
      console.log(`${index + 1}. ${driver.driver.padEnd(15)} ${status}`);
    });
  } catch (error) {
    console.error('Simulation error:', error.message);
  }
}

runSimulation();

🧰 Features ✅ Real F1 data integration

🛞 Tire degradation modeling

🚨 Safety car deployment probabilities

🌀 DRS system simulation

💥 Crash and mechanical failure mechanics

⏱️ Realistic lap time performance calculations

🌦️ Dynamic weather changes

🧠 Pit strategy planning

🛠️ Custom Simulation Custom Drivers and Teams

const redBull = new Team('Red Bull', 97);
const mercedes = new Team('Mercedes', 95);

const customDrivers = [
  new Driver('Max Verstappen', redBull, 95, 1),
  new Driver('Lewis Hamilton', mercedes, 93, 44)
];

Custom Track

const customTrack = new Track('Custom Circuit', 80, 110, 2);
Run a Custom Race

const customRace = new Race({
  track: customTrack,
  drivers: customDrivers,
  laps: 30,
  weather: 'wet'
});

customRace.initialize().then(() => {
  const results = customRace.simulate();
  console.log('\nCustom Race Results:');
  results.forEach(r => console.log(r));
});

⚙️ Advanced Configuration 🌦️ Weather Simulation

const race = new Race({
  // ... other config
  weather: 'dynamic',
  weatherChanges: [
    { lap: 10, newWeather: 'wet' },
    { lap: 20, newWeather: 'dry' }
  ]
});

🛠️ Pit Strategy

const strategies = {
  'Max Verstappen': {
    15: 'hard',
    30: 'medium'
  },
  'Lewis Hamilton': {
    10: 'soft',
    25: 'medium'
  }
};
const race = new Race({
  // ... other config
  pitStrategies: strategies
});

🚓 Safety Car Configuration

import { SafetyCarSystem } from 'f1-simulator';

SafetyCarSystem.probabilities = {
  normal: 0.03,
  wet: 0.20,
  crash: 0.35
};

🧾 Output Example

Race Results:
1. Max Verstappen    3089.452s
2. Lewis Hamilton    3092.781s
3. Charles Leclerc   3095.112s
4. Sergio Pérez      DNF
5. Carlos Sainz      3101.334s

Contributing: I am very open for people to request commits, to my project. If you have any ideas that could be implemented or bugs squashed just send a pull request and I will be on my way to check it out!

📚 API Documentation For full API reference and advanced usage, see the API Docs. https://openf1.org/?javascript#introduction