argos-sdk
v1.1.6
Published
argos Security SDK for TypeScript/JavaScript
Maintainers
Readme
🛡️ Argos Security SDK for TypeScript
Argos is a production-grade TypeScript/JavaScript SDK for real-time threat detection and fraud prevention. It monitors every request, scores risk using advanced ML models, and enables you to block malicious traffic automatically.
✨ Key Features
- 🚀 High Leverage: Zero-config initialization with auto-environment detection from your API key.
- ⚡ Background Processing: High-performance event batching and flushing to minimize impact on request latency.
- 🛡️ Multi-Framework Support: First-class middleware for Express, Fastify, Koa, and Next.js.
- 🔄 Resilience Built-in: Circuit breakers, exponential backoff, and robust error handling.
- 🧩 Deep Locality: Local blocklist caching ensures sub-millisecond response times for known threats.
📦 Installation
# Install the core SDK
npm install argos-sdk
# Optional: Framework-specific types/peer dependencies
npm install express # or fastify, koa, next🚀 Quick Start
1. Basic Client Setup
The SDK auto-detects your environmentId from the API key.
import { ArgosClient } from 'argos-sdk';
const client = new ArgosClient({
apiKey: process.env.ARGOS_API_KEY!,
});2. Using Middleware (Recommended)
Drop Argos into your application for instant protection.
Express Example
import express from 'express';
import { ArgosClient, createExpressMiddleware } from 'argos-sdk';
const app = express();
const client = new ArgosClient({ apiKey: 'your-api-key' });
app.use(createExpressMiddleware(client, {
mode: 'sync', // 'sync' blocks malicious requests, 'async' monitors
checkBlocklist: true, // Check local cache BEFORE processing
}));
app.get('/', (req, res) => res.json({ message: 'Secure!' }));
app.listen(3000);⚙️ Configuration Options
| Option | Default | Description |
|--------|---------|-------------|
| apiKey | Required | Your Argos API key |
| baseURL | https://api.argossecops.com | API endpoint |
| timeout | 30000 | Request timeout in ms |
| maxRetries | 3 | Maximum retry attempts |
| autoBlockOnBlock | false | Auto-block IP when ML returns BLOCK verdict |
| autoBlockTTL | 3600000 | Duration (ms) for auto-blocked IPs |
| environmentId | Auto-detected | Your environment ID |
🧩 Framework Support
| Framework | Middleware Function |
|-----------|---------------------|
| Express | createExpressMiddleware(client, config) |
| Fastify | createFastifyMiddleware(client, config) |
| Koa | createKoaMiddleware(client, config) |
| Next.js | createNextMiddleware(client, config) |
🤝 Contributing
We welcome contributions! Please see our CONTRIBUTORS.md for our coding philosophy and standards.
To run the test suite:
npm install
npm test
npm run lint📄 License
MIT License - see LICENSE for details.
Copyright © 2026 Argos Security. All rights reserved.
