FlowShield
The fastest and simplest way to protect your Python app from traffic spikes
Stop crashes | Control traffic | Stay fast
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.
Metadata
Release files for flowsh 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flowsh-1.0.0.tar.gz | 6.5 kB | With provenance | Details for flowsh-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flowsh-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for flowsh-1.0.0-py3-none-any.whl |
Total release size: 13.6 kB
Release files / flowsh-1.0.0.tar.gz
| Download URL | flowsh-1.0.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86ee5eacaf1229c77a900d351cbb5e88ff2de547e15d14fe5425a556b98ba056
|
|
BLAKE2b-256 checksum How to use checksums |
e833b51cdde3250fc2e4929e4ce751a04e04de6b72ef19a5489c503805ad642b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.
Transparency logRelease files / flowsh-1.0.0-py3-none-any.whl
| Download URL | flowsh-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff4a97785ca7b238d179049241ff8636af4d562d88efce6807926d7f994ff47b
|
|
BLAKE2b-256 checksum How to use checksums |
d9a5763afa73912e1869992bc095307db9c26830b53a763fa62249972f342a1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.
Transparency logSecurity for flowsh 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for flowsh-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.