Skip to content

Application Kit

Application Kit Logo

Application Kit is a shared Python library that provides the building blocks for Woosmap services. It handles authentication, metrics, rate limiting, and infrastructure configuration so you can focus on building your API.

Installation

pip install application-kit[fastapi]
pip install application-kit[django]
pip install application-kit[ninja]

Features

Authentication

Validate API keys and user tokens with caching support. Includes permission classes for fine-grained access control.

Learn more

Rate Limiting

Protect your endpoints with configurable rate limits. Supports per-project overrides stored in Redis.

Learn more

Metrics

Track request counts and usage metrics with the count_request decorator. Data is queued to Redis for processing.

Learn more

Configuration

Automatic configuration from Bender manifests. Get Redis instances, database connections, and service URLs with simple helpers.

Learn more


Supported Frameworks

Framework Module Description
FastAPI application_kit.fastapi Security dependencies and app factory
Django application_kit.django Decorators and middleware
Django Ninja application_kit.shinobi Authentication schemes and API class (legacy)

Quick Example

"""FastAPI quick start example."""

from fastapi import Depends

from application_kit.fastapi.fastapi import get_fastapi_app
from application_kit.fastapi.security import AuthenticateKey

app = get_fastapi_app("api")


@app.get("/endpoint", dependencies=[Depends(AuthenticateKey())])
async def my_endpoint() -> dict[str, str]:
    return {"status": "ok"}
"""Django quick start example."""

from django.http import HttpRequest, JsonResponse

from application_kit.django.decorators import authenticate_key, count_request


@authenticate_key()
@count_request("my_endpoint", "MY_SERVICE")
def my_view(request: HttpRequest) -> JsonResponse:
    return JsonResponse({"status": "ok"})
"""Django Ninja quick start example."""

from django.http import HttpRequest

from application_kit.django.decorators import authenticate_key
from application_kit.shinobi.api import WoosmapApi
from application_kit.shinobi.authentication import PublicKeyAuth
from application_kit.shinobi.decorators import chain, terminate

api = WoosmapApi(description="My API")


@api.get("/endpoint", auth=[PublicKeyAuth()])
@chain(authenticate_key())
@terminate()
def my_endpoint(request: HttpRequest) -> dict[str, str]:
    return {"status": "ok"}

Next Steps