Ward Quick Start
Deploy bot detection in one command. Zero config, zero cloud, zero rules. Multi-layer defense with neural anomaly detection.
1. Run Ward
Ward is a standalone Docker container. Build it from source in three commands (the prebuilt Docker Hub image is coming soon):
git clone https://github.com/luviner/ward.git
cd ward
docker build -t luviner-ward .
docker run -d -p 9741:9741 --name ward luviner-ward
docker run -d -p 9741:9741 -e WARD_ENGINE=v4 --name ward luviner-ward
Need a license or production support? Contact us for the commercial build with priority updates and SLAs.
Ward starts in learning mode automatically. No configuration needed.
2. How it works
- Learning phase: Ward observes the first 500 requests and builds a behavioral model of normal human traffic. All requests are allowed during this phase.
- Training: After 500 requests, Ward auto-trains in the background (~2-5 seconds). Requests continue to be allowed.
- Detecting: Once trained, every request goes through multi-layer defense: rate limiting, burst detection, neural anomaly scoring, and session-level verdict aggregation.
Ward uses 5 defense layers: rate limiting, burst detection, neural anomaly scoring (18 behavioral features), session aggregation, and sticky blocking. No bot signatures, no rules to maintain.
3. Integrate with your app
Add a middleware to your web app that calls Ward's /check endpoint before processing each request:
app.use(async (req, res, next) => {
const r = await fetch('http://ward:9741/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
session_id: req.cookies.session_id || req.ip,
method: req.method,
path: req.path,
query_params: Object.keys(req.query).length,
headers: req.headers,
content_length: parseInt(req.headers['content-length'] || '0'),
})
});
const verdict = await r.json();
if (verdict.action === 'block') return res.status(403).send('Blocked');
next();
});
4. API Reference
| Endpoint | Method | Description |
/check | POST | Classify a request. Returns action, score, is_bot, reason. |
/train | POST | Upload CSV of known-good traffic to train explicitly. |
/health | GET | Health check with phase, engine, and session count. |
/stats | GET | Operational statistics, config, and last training result. |
/metrics | GET | Prometheus-compatible metrics for monitoring. |
/sessions | GET | List active sessions with per-session stats. Supports ?sort=score|rpm. |
/reset | POST | Reset model and return to learning mode. |
POST /check — Request body
{
"session_id": "visitor-123",
"method": "GET",
"path": "/products/shoes",
"headers": {
"User-Agent": "Mozilla/5.0...",
"Referer": "https://example.com",
"Cookie": "session=abc123",
"Accept-Language": "en-US,en;q=0.9"
},
"content_length": 0,
"query_params": 3,
"timestamp": 1711612800.0
}
Response
{
"action": "block",
"score": 0.8742,
"is_bot": true,
"reason": "rate_limit_exceeded",
"session_requests": 42,
"session_anomalies": 15,
"session_avg_score": 0.6234,
"session_rpm": 312.0,
"latency_ms": 0.21,
"phase": "detecting"
}
5. Configuration
Ward is configured via environment variables. All have sensible defaults:
| Variable | Default | Description |
WARD_ENGINE | focus | Neural engine (all 13 Luviner engines supported) |
WARD_N_HIDDEN | 48 | Neurons per layer (smaller = faster) |
WARD_N_LAYERS | 1 | Number of neural layers |
WARD_LEARNING_SAMPLES | 500 | Requests collected before auto-training |
WARD_TRAINING_EPOCHS | 50 | Training epochs |
WARD_RATE_LIMIT_RPM | 120 | Rate limit (requests/minute per session) |
WARD_BURST_MAX | 10 | Max requests in burst window |
WARD_BURST_WINDOW | 2.0 | Burst detection window (seconds) |
WARD_SESSION_TTL | 1800 | Session timeout in seconds (30 min) |
WARD_MAX_SESSIONS | 100000 | Max concurrent sessions |
WARD_LOG_LEVEL | INFO | Logging level (DEBUG, INFO, WARNING) |
WARD_PORT | 9741 | Server port |
6. Detection Layers
Ward uses 5 defense layers for maximum accuracy:
- Rate limiting — blocks sessions exceeding RPM threshold
- Burst detection — blocks rapid-fire request bursts
- Neural anomaly detection — 18 behavioral features analyzed by liquid neural network
- Session aggregation — rolling anomaly rate + average score for session-level verdict
- Sticky blocking — once blocked, a session stays blocked
7. Performance
| Metric | Value |
| Bot detection rate | 100% |
| False positive rate | 0% |
| F1 Score | 1.00 |
| Average latency | 0.23ms |
| P99 latency | 0.60ms |
| Behavioral features | 18 |
| Bot profiles tested | 5 (scraper, headless, credential stuffer, API abuser, slow bot) |
| Memory per session | ~1KB |
8. Monitoring
Ward exposes a Prometheus-compatible /metrics endpoint for integration with Grafana, Datadog, or any metrics platform:
curl http://localhost:9741/metrics
ward_requests_total 12345
ward_bots_detected_total 42
ward_bot_rate 0.0034
ward_active_sessions 156
ward_avg_latency_ms 0.23
9. Dashboard
Ward includes a built-in dashboard in the Luviner SaaS platform. After logging in, navigate to Ward in the navigation bar to see real-time stats, active sessions, and detection metrics.
Need help? Contact us for integration support or a custom deployment.