Skip to main content

The fastest and simplest way to protect your Python app from traffic spikes

Project description

FlowShield Banner

FlowShield Logo

FlowShield

The fastest and simplest way to protect your Python app from traffic spikes

Stop crashes | Control traffic | Stay fast

GitHub stars PyPI version Latency CI

GitHub forks GitHub issues License Python


Why FlowShield?

Most rate limiters are either heavy, complex, or too slow for latency-sensitive APIs.

FlowShield is built for one job: protect your app fast.

  • Ultra-fast in-memory checks (O(1))
  • Lightweight architecture
  • One-line Flask integration
  • Fair per-IP control (optional)
  • Memory-safe cleanup (TTL)
  • Thread-safe core

10-Second Setup

pip install flowshield

If you are running from source before PyPI publication:

pip install -r requirements.txt
pip install -e .
from flask import Flask
from flowshield import protect_app

app = Flask(__name__)
protect_app(app)  # That's it

@app.route("/")
def home():
    return "Hello World"

How It Works

Request -> FlowShield -> Allow or Reject -> App
Traffic Level Behavior
Normal Allow instantly
High Return 429 with retry hint
Extreme Protect app from overload

Performance

Tool Typical Latency
Flask-Limiter ~8-10ms
SlowAPI ~5-8ms
FlowShield ~1ms

FlowShield targets a 5-10x faster path for common Flask rate-limiting use cases.


Features

  • Ultra-fast in-memory engine
  • Crash-prevention focus
  • Global mode and per-IP mode
  • Memory growth control via ip_ttl
  • Thread-safe with locking
  • Built-in stats (get_stats())
  • Flask support today

Advanced Usage

protect_app(
    app,
    limit=100,
    per_ip=True,
    ip_ttl=600,
)

Example 429 Response

{
  "status": "busy",
  "message": "Rate limit exceeded",
  "retry_after": 1,
  "limit": 100,
  "mode": "per-ip"
}

Use Cases

  • Public APIs
  • Flash sales and traffic spikes
  • Exam or results portals
  • Multi-tenant SaaS backends

Philosophy

Do not only scale servers. Control traffic intelligently at the app layer.


What FlowShield Is Not

  • Not a CDN
  • Not a load balancer
  • Not an edge DDoS network

FlowShield is a lightweight protection layer inside your Python app.


Roadmap

  • Flask support
  • Per-IP limiting
  • Thread safety
  • TTL cleanup for inactive IPs
  • FastAPI/ASGI support
  • Django integration
  • Redis mode for distributed limits

Contributing

PRs are welcome. Keep contributions:

  • Simple
  • Fast
  • Lightweight

See CONTRIBUTING.md.


Quick Validation

python -m pytest test_flowshield.py -v
python benchmark.py

License

MIT License. See LICENSE.


Assets Setup

Create this structure in the repository:

assets/
  flowshield-banner.png
  logo.png

Then replace the badge placeholders by changing mani1028 in README badge URLs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flowsh-1.0.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flowsh-1.0.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file flowsh-1.0.0.tar.gz.

File metadata

  • Download URL: flowsh-1.0.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flowsh-1.0.0.tar.gz
Algorithm Hash digest
SHA256 86ee5eacaf1229c77a900d351cbb5e88ff2de547e15d14fe5425a556b98ba056
MD5 c8f17f0b5347ede7330f0efdeb8f063c
BLAKE2b-256 e833b51cdde3250fc2e4929e4ce751a04e04de6b72ef19a5489c503805ad642b

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowsh-1.0.0.tar.gz:

Publisher: publish.yml on mani1028/Flowsheild

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flowsh-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: flowsh-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flowsh-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff4a97785ca7b238d179049241ff8636af4d562d88efce6807926d7f994ff47b
MD5 64f785b5dd67fb9aad2dde0665b38626
BLAKE2b-256 d9a5763afa73912e1869992bc095307db9c26830b53a763fa62249972f342a1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for flowsh-1.0.0-py3-none-any.whl:

Publisher: publish.yml on mani1028/Flowsheild

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page