DNA-BASED THREAT DETECTION

GUARDFLOW
DEVELOPER DOCS

Protect your FastAPI applications with zero-latency security.
Install in under 5 minutes.

$ pip install guardflow-fastapi
<1ms
Processing Time
99.7%
Detection Rate
<0.01%
False Positives
5 min
Setup Time

QUICK START

Get GuardFlow running in your FastAPI application in 3 simple steps.

1

INSTALL SDK

bash
pip install guardflow-fastapi
2

START REDIS

bash
docker run -d -p 6379:6379 redis:alpine
3

ADD MIDDLEWARE

See code below →

COMPLETE EXAMPLE

python
from fastapi import FastAPI
from guardflow import GuardFlowMiddleware

app = FastAPI()

# Add GuardFlow protection
app.add_middleware(
    GuardFlowMiddleware,
    api_key="gf_live_your_api_key",
    studio_url="https://guardflow-v1.onrender.com",
    redis_url="redis://localhost:6379"
)

@app.get("/")
async def protected_endpoint():
    return {"message": "Protected by GuardFlow"}

INSTALLATION

SYSTEM REQUIREMENTS

Python 3.8+
FastAPI 0.95+
Redis 4.5+

INSTALL FROM PYPI

bash
pip install guardflow-fastapi

Or with development dependencies:

bash
pip install "guardflow-fastapi[dev]"

DOCKER COMPOSE SETUP

yaml
version: '3.8'
services:
  redis:
    image: redis:7-alpine
    container_name: guardflow_cache
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data

  app:
    build: .
    ports:
      - "8000:8000"
    depends_on:
      - redis
    environment:
      - GUARDFLOW_API_KEY=gf_live_your_api_key
      - GUARDFLOW_REDIS_URL=redis://redis:6379

volumes:
  redis_data:

SECURITY FEATURES

🧬

DNA FINGERPRINTING

Identifies attackers by their unique request patterns. Analyzes header sequences, presence vectors, and protocol behaviors.

DETECTION RATE: 99.7%

ZERO-LATENCY

Async "fire & forget" telemetry ensures your application performance is never impacted by security processing.

PROCESSING: <1ms
🔒

PII REDACTION

Automatically detects and redacts sensitive data before telemetry leaves your infrastructure. GDPR compliant.

PRIVACY: ZERO LEAKAGE
🍯

HONEYPOT TRAPS

Invisible endpoints that trigger instant global bans when accessed. Catches reconnaissance and automated attacks.

RESPONSE: INSTANT BAN

HOW DNA FINGERPRINTING WORKS

Traditional security looks at what attackers send. GuardFlow analyzes how they send it.

python
# Example: Two identical requests, different DNA
Request A: User-Agent → Accept → Accept-Language → Connection
Request B: Accept → User-Agent → Connection → Accept-Language

# Result: Completely different fingerprints
Fingerprint A: sha256("UA|AC|AL|CN") = "a1b2c3..."
Fingerprint B: sha256("AC|UA|CN|AL") = "x9y8z7..."

CONFIGURATION

BASIC CONFIGURATION

python
from fastapi import FastAPI
from guardflow import GuardFlowMiddleware

app = FastAPI()

app.add_middleware(
    GuardFlowMiddleware,
    # Required Settings
    api_key="gf_live_your_api_key",
    studio_url="https://guardflow-v1.onrender.com",
    redis_url="redis://localhost:6379",
    
    # Security Configuration
    block_threshold=80,           # Threat score 0-100
    enable_fingerprinting=True,   # DNA identification
    enable_honeypots=True,        # Deception traps
    
    # Privacy Configuration
    redact_pii=True,             # Smart PII redaction
    redact_headers=[
        "Authorization",
        "Cookie",
        "X-API-Key"
    ],
    
    # Performance Configuration
    async_reporting=True,         # Zero-latency telemetry
    rate_limit_window=60,        # Seconds
    rate_limit_max_requests=100, # Per window
)

ENVIRONMENT VARIABLES

bash
# .env file
GUARDFLOW_API_KEY=gf_live_your_api_key
GUARDFLOW_STUDIO_URL=https://guardflow-v1.onrender.com
GUARDFLOW_REDIS_URL=redis://localhost:6379
GUARDFLOW_BLOCK_THRESHOLD=80
GUARDFLOW_ENABLE_FINGERPRINTING=true
GUARDFLOW_ENABLE_HONEYPOTS=true
GUARDFLOW_REDACT_PII=true

ADVANCED CONFIGURATION

python
from guardflow import GuardFlowMiddleware
from guardflow.fingerprint import CustomFingerprinter

# Custom fingerprinting rules
fingerprinter = CustomFingerprinter()
fingerprinter.add_header_weight("X-Custom-Header", 0.8)
fingerprinter.add_pattern_rule(r"bot|crawler", threat_boost=0.3)

app.add_middleware(
    GuardFlowMiddleware,
    api_key="gf_live_your_api_key",
    studio_url="https://guardflow-v1.onrender.com",
    redis_url="redis://localhost:6379",
    
    # Custom fingerprinter
    fingerprinter=fingerprinter,
    
    # Redis clustering
    redis_cluster=True,
    redis_ssl=True,
    
    # Webhook integration
    webhook_url="https://your-app.com/security-webhook",
    webhook_events=["high_threat", "honeypot_trigger"],
)

DEPLOYMENT

DOCKERFILE

dockerfile
FROM python:3.11-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8000

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

KUBERNETES

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: fastapi-app
spec:
  replicas: 3
  template:
    spec:
      containers:
      - name: app
        image: your-app:latest
        ports:
        - containerPort: 8000
        env:
        - name: GUARDFLOW_API_KEY
          valueFrom:
            secretKeyRef:
              name: guardflow-secrets
              key: api-key

BEST PRACTICES

Use environment variables for API keys
Enable Redis persistence (AOF or RDB)
Start with lenient thresholds (90+)
Monitor dashboard regularly
Enable PII redaction for GDPR compliance
Use Redis clustering for high traffic
Test in staging before production

READY TO PROTECT YOUR APP?

Join thousands of developers using GuardFlow to secure their FastAPI applications.

NO CREDIT CARD • 100K REQUESTS/MONTH FREE • CANCEL ANYTIME