Getting Started
Get up and running with Atrion in under a minute. No configuration required—the engine auto-tunes to your traffic patterns.
Installation
npm install atrionAtrion ships with pre-built WASM binaries. No Rust toolchain required. The engine automatically uses WASM when available, falling back to TypeScript otherwise.
Basic Usage
import { Atrion } from 'atrion'
// Initialize the engineconst atrion = new Atrion()await atrion.connect()
// In your request handler:app.post('/api/checkout', async (req, res) => { // Collect telemetry from your monitoring const telemetry = { latencyMs: getP99Latency(), errorRate: getErrorRate(), saturation: getCPUSaturation(), }
// Make routing decision const decision = atrion.route('api/checkout', telemetry)
if (!decision.allow) { return res.status(503).json({ error: decision.reason, retryAfter: decision.retryAfterMs }) }
// Process the request normally await processCheckout(req, res)})Understanding the Response
The route() method
returns a decision object with the following properties:
| Property | Type | Description |
|---|---|---|
| allow | boolean | Whether the request should proceed |
| resistance | number | Current resistance in Ohms (Ω) |
| mode | string | BOOTSTRAP | OPERATIONAL | CIRCUIT_BREAKER |
| reason | string? | If rejected, explains why |