Blueprints group related routes, handlers, and resources without creating multiple Flask applications. With an application factory, registration is explicit and each test can build an instance configured for its scenario.

from flask import Blueprint, Flask, jsonify

api = Blueprint("api", __name__, url_prefix="/api")

@api.get("/status")
def status():
    return jsonify(status="ok")

def create_app() -> Flask:
    app = Flask(__name__)
    app.register_blueprint(api)
    return app

url_prefix creates a URL namespace, while the blueprint name participates in endpoint names. Avoid importing a global application instance inside modules; use current_app where appropriate and inject services at clear boundaries.

Practical guidance

Split by domain or capability, not one file per route. Initialize extensions before blueprints that rely on them. Handling 404 and 405 may belong at application level because those errors happen before a blueprint is selected. Check endpoint names to prevent collisions.

Read the Flask API guide and compare its organization with FastAPI dependency injection.

The official Flask Blueprints documentation, accessed July 22, 2026, documents the API and its constraints.