Skip to main content

Getting Started

irsdk-node is a Node.js library for consuming data from and dispatching commands to iRacing via JavaScript and TypeScript. It is written in TypeScript and C++ and aims to hide the complexity of consuming data from the iRacing SDK, creating an easy-to-use and safe interface to consume iRacing SDK data without worrying about the details.

Requirements

Quickstart

Install using your projects package manager.

npm install irsdk-node

Once added to your project, import the IRacingSDK class and start consuming data.

import { IRacingSDK } from "irsdk-node";

// Check the iRacing service is running.
if (await IRacingSDK.IsSimRunning()) {
const sdk = new IRacingSDK();

// Wait for data from iRacing. By default, it will wait for 16ms (60fps) for data.
if (sdk.waitForData()) {
const session = sdk.getSessionData();
const telemetry = sdk.getTelemetry();

// Do something with data.
} else {
// No data found, sim is not running or iRacing session not active.
}
}

For more in-depth info, check out Consuming SDK data and Common Patterns.

Advanced usage

Custom abstractions (@irsdk-node/native)

While irsdk-node will provided baked-in optimisations for consuming iRacing data and work with most use cases, in some cases it might be valuable to create your own wrapper that better suits your applications needs. The native module that interfaces with the iRacing SDK directly is available for exactly this use case through the @irsdk-node/native package. This is the same package that irsdk-node is built on and provides you with a way to interact with the SDK directly and build your own abstractions on top of it.

API Reference

Full type access (@irsdk-node/types)

All of the iRacing SDK types are also independently exposed to allow for building type-safe custom abstractions as well as accessing types in environments where the main libraries cannot be used, for example Electron renderer processes. The @irsdk-node/types package is available for these use cases and offers all of the core typings, enums, and structures that irsdk-node provides while remaining completely environment agnostic.

API Reference