JavaScript SDK
Full configuration reference for the Ratelane JavaScript SDKs.
Packages
| Package | Framework |
|---|---|
@ratelane/express | Express |
@ratelane/fastify | Fastify |
Config options
Both packages share the same config shape:
| Option | Type | Required | Description |
|---|---|---|---|
apiKey | string | ✅ | Your Ratelane API key from the dashboard |
collectorUrl | string | ✅ | https://api.ratelane.dev for production |
instanceVersion | string | ❌ | Your app version, shown in instance detail |
Express — attach()
For Express, you must call attach() after all routes are registered. This is how Ratelane discovers your routes:
app.use(ratelane);
// register all your routes here...
ratelane.attach(app); // call lastFastify — plugin registration
For Fastify, register the plugin before starting the server:
await app.register(ratelaneMiddleware, { ... });
await app.listen({ port: 3000 });Route discovery
Routes are collected automatically on startup. HEAD routes are filtered from discovery but still enforced normally.
Device info
Every telemetry poll includes:
{
sdk_version: string, // auto from package.json
runtime: 'node',
runtime_version: string, // e.g. "20.11.0"
framework: string, // e.g. "express"
instance_version: string // from your config
}