LoadStrike supports TypeScript load testing with the @loadstrike/loadstrike-sdk package running on Node.js 20+. Scenario callbacks and named steps can use async client operations while TypeScript helps check the SDK surface during development. Start with an API response test, then model the completion signal separately if the API launches asynchronous work.
TypeScript load testing with typed scenarios
Build TypeScript load and performance tests with LoadStrike on Node.js 20+. Use async API steps, explicit completion checks and self-hosted reports.
How do you write a TypeScript load test with LoadStrike?
Install and start an API load test in TypeScript
The TypeScript request-step snippet uses ESM imports, fetch and top-level await. Configure a compatible TypeScript project and execution setup; the linked ts project supplies that context. Replace the example target and placeholder runner key before running.
The request-step example offers 10 scenario invocations per second for 20 seconds. Replace the example endpoint with an authorized staging service and the placeholder with your valid runner key. Offered scenario invocations are not measured HTTP throughput or a benchmark result.
SDK installation
npm install @loadstrike/loadstrike-sdk
import { LoadStrikeRunner } from "@loadstrike/loadstrike-sdk";
Request-step example
import {
LoadStrikeResponse,
LoadStrikeRunner,
LoadStrikeScenario,
LoadStrikeSimulation,
LoadStrikeStep
} from "@loadstrike/loadstrike-sdk";
const scenario = LoadStrikeScenario
.create("read-order", async (context) => {
return LoadStrikeStep.run("GET /orders/{id}", context, async () => {
const orderId = `ord-${context.invocationNumber}`;
const response = await fetch(`https://api.example.com/orders/${orderId}`);
return response.ok
? LoadStrikeResponse.ok(String(response.status))
: LoadStrikeResponse.fail(String(response.status), "Order lookup failed");
});
})
.withLoadSimulations(LoadStrikeSimulation.inject(10, 1, 20));
await LoadStrikeRunner
.registerScenarios(scenario)
.withRunnerKey("rkl_your_local_runner_key")
.run();
Evidence to review
Use these pages and artifacts to validate the public claims on this page.
TypeScript package and releases
Check the published package version before installing or pinning a dependency.
TypeScript sample project
Inspect the project configuration, imports and source examples. Dummy runner keys must be replaced.
Installation and runtime requirements
Confirm supported runtime, optional clients and runner setup.
Who this is for
TypeScript API, platform and test teams that want typed scenario code in a normal Node.js project. Keep your service clients, payload types and authentication explicit so a reviewer can see which work starts on each invocation and what result counts as success.
Package, runtime and client setup
Install with npm install @loadstrike/loadstrike-sdk and use named imports from that package. The introductory sample uses fetch and top-level await in an ESM TypeScript project. Configure your compiler and execution toolchain accordingly; installing the SDK does not compile a TypeScript file for you. The public ts sample project includes package and compiler context.
From request timing to completion
For an API-to-Kafka or worker workflow, define the source endpoint, downstream completion endpoint, shared tracking value and correlation timeout. A fast response is one stage, not proof of final completion. gRPC integration is delegate-backed: call the generated client from your Produce or Consume delegate; native gRPC execution is unavailable.
Execution and plan requirements
- Use npm package @loadstrike/loadstrike-sdk on Node.js 20+ and provide a valid runner key. LoadStrike runs on your own infrastructure.
- Check the plan for the selected endpoints, reports and execution mode. gRPC and WebSocket endpoints require Pro or Enterprise; extra clients do not grant plan access.
- Review HTML, CSV, TXT or Markdown reports and run failures. These examples demonstrate SDK setup; they are not comparative benchmarks or throughput guarantees.
Define the workload and inspect the evidence
Start with a small request-step test against a staging system you control. To measure later completion, define the matching endpoints and tracking value before interpreting transaction latency.
TypeScript request-step quick start
Set the language tab, replace the example target and configure runner access.
Tracking selectors
Verify that the same identifier reaches source and completion.
Report interpretation
Read summary, step timings, failed rows and correlated outcomes.
Introduce the workload into your test project
- Keep k6 scripts that already validate the outcome you need. Pilot one typed LoadStrike scenario with the same workload, data and acceptance criteria, then compare reports, setup effort and ongoing maintenance rather than assuming a language preference establishes superiority.
- Choose the Node.js client and lifecycle deliberately. Await each operation whose completion belongs in the measurement, release resources after the run, and start browser journeys at lower concurrency because browser sessions consume more host capacity than HTTP calls.
Common questions
Does TypeScript load testing run in the browser?
The LoadStrike TypeScript SDK runs on Node.js 20+. To perform real browser actions, call Playwright or Selenium inside the scenario and install that client plus the required browser or driver.
Why does the quick start use top-level await?
The sample uses an ESM TypeScript project so it can await runner execution directly. Configure a compatible module and execution setup, or place the awaited code inside your project async entry point.
Related documentation
Start with the implementation details that match this page.
Installation
Install the LoadStrike package for your language and add it to the test project you already use. This page is the starting point before you write a scenario.
Quick Start
Build one basic request-step scenario around GET /orders/{id}, run it, and confirm the report before moving into correlation-specific features.
Load Simulation
Load simulations describe how traffic should arrive over time. Use them to model the shape of the workload instead of only its peak.
Playwright UI Load Guide
Use this guide when Playwright browser journeys should run inside the same LoadStrike scenario and reporting model.
Kafka Protocol Guide
Use this guide when Kafka is part of the business transaction and you need to measure the downstream path, not just publish speed.
Related comparisons
Use these comparison pages if you still need a tool-level decision.
LoadStrike vs k6
Compare LoadStrike and k6 for APIs, Kafka, browser tests and async completion, including correlation requirements, extensions and hosting tradeoffs.
LoadStrike vs Apache JMeter
Compare LoadStrike and Apache JMeter for async completion, JMS, browser execution, reports and self-hosted testing, including setup and licensing requirements.
Next steps
All SDKs and documentation
Choose another language or find the transport guide for your workload.
Transaction load testing
Decide which downstream event represents the real completion outcome.
Plans and runner access
Verify entitlements and current self-hosted pricing before rollout.
Start one TypeScript performance scenario
Install the SDK, provide a valid runner key and review one small staging run before increasing load or adding downstream correlation.