Skip to main content

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


Download files

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

Source Distribution

flask_mini_api-0.1.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

flask_mini_api-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file flask_mini_api-0.1.0.tar.gz.

File metadata

  • Download URL: flask_mini_api-0.1.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for flask_mini_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ad0060c9909044ae54a96b1a946f4840180ede7576814af59559ca50aa0b5f8b
MD5 89a8a3d1faf54aa9fb405776954a82f8
BLAKE2b-256 d96232079a5e2e89cdc74188becbb84e6e077bf9335676fb6f61fd10947d7d94

See more details on using hashes here.

File details

Details for the file flask_mini_api-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: flask_mini_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for flask_mini_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0511a75214e49f42a15cd290cfa6d9577e72a332b41b1da4fd80f51a497c0a1
MD5 2cb9cf546cfb93c3743ad4ef9f789455
BLAKE2b-256 5738ab2ebf2e0070412121c8c27fee8cf65db22cf64a1126ce9d8af2c50fb74e

See more details on using hashes here.

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