Why Use Flask-Nova: Modern APIs on Top of Vanilla Flask
If you love Flask but wish it had type hints, automatic OpenAPI docs, dependency injection, and better DX — Flask-Nova is for you.
The Problem with Vanilla Flask
Let’s say you want to build a simple JSON API with Flask. You’d probably write something like:
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/greet", methods=["POST"])
def greet():
data = request.get_json()
name = data.get("name")
return jsonify({"message": f"Hello, {name}!"})
It works. But now imagine:
- You want to validate the request data.
- You want OpenAPI docs for your frontend team.
- You want typed parameters from the URL or query.
- You want better error handling and testing.
- You want some structure, without rewriting everything.
Soon, your simple app becomes a tangle of decorators, manual checks, and custom logic. If you want something like FastAPI, you’d have to rewrite using ASGI and leave behind Flask.
Enter Flask-Nova
Flask-Nova is a modern framework built on top of Flask. It brings typed routing, OpenAPI generation, dependency injection, and other developer-friendly features — all while keeping your app compatible with the Flask and WSGI world.
What you get:
- Typed route parameters
- Automatic Swagger / OpenAPI docs
- Dependency injection via
Depend()
- Clean logging and built-in exception handling
- Works with
dataclass
,pydantic
, or plain classes - No ASGI, no Starlette — just Flask
Why Not Just Use FastAPI?
FastAPI is great. But Flask-Nova isn’t trying to replace it.
Instead, Flask-Nova is for developers who:
- Still prefer Flask or are maintaining Flask apps
- Want FastAPI-like features without switching stacks
- Need something lightweight, sync-friendly, and easy to deploy
It’s like giving your Flask app a supercharged dev experience — without a full rewrite.
A Taste of Flask-Nova
Here’s that same /greet
endpoint using Flask-Nova:
from flask_nova import FlaskNova
from pydantic import BaseModel
app = FlaskNova(__name__)
class GreetRequest(BaseModel):
name: str
@app.post("/greet")
def greet(data: GreetRequest):
"""Greet someone
---
Returns a personalized greeting message.
"""
return {"message": f"Hello, {data.name}!"}
No manual parsing, no decorators overload — just clean, typed code.
Built-in Tools That Matter
Dependency Injection
from flask_nova import Depend
def get_user():
return {"id": 1, "name": "Alice"}
@app.get("/me")
def me(user=Depend(get_user)):
return {"user": user}
OpenAPI from Docstrings
"""Get current time
---
description: Returns the current UTC time.
responses:
200:
description: Current time in ISO format.
"""
When Should You Use Flask-Nova?
- You like Flask and don’t want to switch to FastAPI
- You want a modern dev experience with OpenAPI + type safety
- You need WSGI compatibility for deployment
- You’re building APIs, microservices, or internal tools
Try Flask-Nova Now
GitHub:
https://github.com/treasuremani/flask-nova
Pypi:
https://pypi.org/project/flask-nova/
Quickstart Docs: Coming soon!
Python: 3.9+
Flask-Nova isn’t trying to replace FastAPI — it’s a way to write modern, maintainable APIs using the simplicity and power of Flask.
If that sounds like your kind of project, check it out, drop a ⭐ on GitHub, and let’s build something awesome!
Comments
Post a Comment