A lightweight wrapper around Flask with built-in Cloudflare tunneling and colored logging.
Project description
Flask Mini API
A powerful, lightweight wrapper around Flask designed for rapid development. It completely eliminates boilerplate code and comes with built-in colored logging, simplified routing, security decorators, and instant Cloudflare tunneling.
Features
- 🚀 Instant Webhook/API: Minimal setup required.
- 🌍 Built-in Cloudflare Tunnel: Expose your local server to the internet instantly using
cloudflare=True. - 🎨 Beautiful Colored Logging: Replaces default ugly Werkzeug logs with clean, timed, and colored terminal outputs.
- 🛡️ Decorators out-of-the-box: Easy
@rate_limit,@cache,@require_key, and@require_json_fields. - 🗄️ Memory Store: A built-in key-value memory store for fast prototyping without setting up a database.
Installation
pip install flask-mini-api
Quick Start Example
from flask_mini_api.flask_api import app, routes, run_app, require_key, rate_limit
1. Simple API Route (Automatically returns JSON)
routes.api_route("ping", lambda: {"status": "ok", "message": "Pong!"})
2. Advanced Route with rate limiting and API Key protection
@require_key("my-secret-key-123") @rate_limit(max_requests=5, per_seconds=60) def get_secure_data(): return {"data": "This is highly classified"}
routes.api_route("secure", get_secure_data)
3. Start the server (Starts locally and opens a public Cloudflare URL!)
if name == "main": run_app(p=5000, cloudflare=True) Advanced Features Route Groups Need to prefix your routes like /api/v1/? Use route_group:
from flask_mini_api.flask_api import route_group
api_v1 = route_group("/api/v1") api_v1.api_route("users", lambda: {"users": ["Alice", "Bob"]}) In-Memory Database For fast prototyping, you don't need Redis. Use the built-in store:
from flask_mini_api.flask_api import store
store.set("server_status", "maintenance") print(store.get("server_status")) Maintenance Mode Easily lock down your API with one function (returns 503 for all endpoints except /health):
from flask_mini_api.flask_api import maintenance_mode
maintenance_mode(True) License This project is open-source and available under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_mini_api-0.1.2.tar.gz.
File metadata
- Download URL: flask_mini_api-0.1.2.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48a627931cfda4eee5f3b163d53c14f82b26b6a1754b5f8fff1b387ddcea25eb
|
|
| MD5 |
aa3507570e9a10e8c10d0771340d38f4
|
|
| BLAKE2b-256 |
788df8748071d2f65847033a6a5c3ce8d1856f2ae5ac0aa8f99b90fe75141b61
|
Provenance
The following attestation bundles were made for flask_mini_api-0.1.2.tar.gz:
Publisher:
publish.yml on grulgalus/flask_mini_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_mini_api-0.1.2.tar.gz -
Subject digest:
48a627931cfda4eee5f3b163d53c14f82b26b6a1754b5f8fff1b387ddcea25eb - Sigstore transparency entry: 2212137163
- Sigstore integration time:
-
Permalink:
grulgalus/flask_mini_api@2e4723e07c2a692a761d922044a147af5d40c428 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/grulgalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2e4723e07c2a692a761d922044a147af5d40c428 -
Trigger Event:
push
-
Statement type:
File details
Details for the file flask_mini_api-0.1.2-py3-none-any.whl.
File metadata
- Download URL: flask_mini_api-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3a61fd1c2e1133ce6c30eca4393c14234de80f89f4e43d7b053f3455e17d08b
|
|
| MD5 |
e610eebce26f389faeee6d34beaea844
|
|
| BLAKE2b-256 |
c24b6051d749bdb0c9a1d29dd811808545b8036f162e18de4d9c203f74e91318
|
Provenance
The following attestation bundles were made for flask_mini_api-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on grulgalus/flask_mini_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_mini_api-0.1.2-py3-none-any.whl -
Subject digest:
f3a61fd1c2e1133ce6c30eca4393c14234de80f89f4e43d7b053f3455e17d08b - Sigstore transparency entry: 2212137194
- Sigstore integration time:
-
Permalink:
grulgalus/flask_mini_api@2e4723e07c2a692a761d922044a147af5d40c428 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/grulgalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2e4723e07c2a692a761d922044a147af5d40c428 -
Trigger Event:
push
-
Statement type: