|
| 1 | +# Official plugins |
| 2 | + |
| 3 | +HawkAPI ships a small, focused core. Everything else — auth, mail, cache, file storage, an admin UI — lives in optional packages under the `hawkapi-*` namespace. Install only what you need; every plugin follows the same `init_xxx(app, ...)` + `Depends(get_xxx)` pattern. |
| 4 | + |
| 5 | +## Observability |
| 6 | + |
| 7 | +| Package | Install | Purpose | |
| 8 | +| --- | --- | --- | |
| 9 | +| [`hawkapi-sentry`](https://pypi.org/project/hawkapi-sentry/) | `pip install hawkapi-sentry` | Sentry SDK integration — exceptions, traces, request context | |
| 10 | +| [`hawkapi-otel`](https://pypi.org/project/hawkapi-otel/) | `pip install hawkapi-otel` | OpenTelemetry — auto-instrumentation, traces, metrics, logs | |
| 11 | + |
| 12 | +## Auth & security |
| 13 | + |
| 14 | +| Package | Install | Purpose | |
| 15 | +| --- | --- | --- | |
| 16 | +| [`hawkapi-auth`](https://pypi.org/project/hawkapi-auth/) | `pip install hawkapi-auth` | JWT (access + refresh), argon2id passwords, DI guards, scopes | |
| 17 | + |
| 18 | +## Data layer |
| 19 | + |
| 20 | +| Package | Install | Purpose | |
| 21 | +| --- | --- | --- | |
| 22 | +| [`hawkapi-sqlalchemy`](https://pypi.org/project/hawkapi-sqlalchemy/) | `pip install hawkapi-sqlalchemy` | Async SQLAlchemy 2.0 — sessions in DI, multi-DB routing (primary/replica/shards), `Base`/`TimestampMixin`/`UUIDMixin`, Alembic helper, pytest fixtures | |
| 23 | +| [`hawkapi-cache`](https://pypi.org/project/hawkapi-cache/) | `pip install hawkapi-cache` | Response caching with TTL + tag-based invalidation; in-memory and Redis backends | |
| 24 | +| [`hawkapi-storage`](https://pypi.org/project/hawkapi-storage/) | `pip install hawkapi-storage` | Pluggable file storage — local, S3 (incl. MinIO/R2/Wasabi), GCS, Azure; streaming + pre-signed URLs | |
| 25 | + |
| 26 | +## Messaging & integration |
| 27 | + |
| 28 | +| Package | Install | Purpose | |
| 29 | +| --- | --- | --- | |
| 30 | +| [`hawkapi-mail`](https://pypi.org/project/hawkapi-mail/) | `pip install hawkapi-mail` | Email backends (SMTP, SES, SendGrid, Mailgun, Resend), Jinja2 templates, persistent outbox + retry, webhook handlers for bounce/complaint events | |
| 31 | +| [`hawkapi-celery`](https://pypi.org/project/hawkapi-celery/) | `pip install hawkapi-celery` | Celery integration — `@task` decorator (async-aware), beat schedule helpers, broker/worker healthchecks, request-context propagation, eager-mode fixtures | |
| 32 | +| [`hawkapi-websockets`](https://pypi.org/project/hawkapi-websockets/) | `pip install hawkapi-websockets` | Connection manager with rooms + broadcasting; optional Redis pub/sub backplane for multi-process fan-out; heartbeat monitor | |
| 33 | +| [`hawkapi-mcp`](https://pypi.org/project/hawkapi-mcp/) | `pip install hawkapi-mcp` | Model Context Protocol server — expose your routes as MCP tools to LLM agents | |
| 34 | + |
| 35 | +## Admin |
| 36 | + |
| 37 | +| Package | Install | Purpose | |
| 38 | +| --- | --- | --- | |
| 39 | +| [`hawkapi-admin`](https://pypi.org/project/hawkapi-admin/) | `pip install hawkapi-admin` | Auto-generated CRUD admin UI for hawkapi-sqlalchemy models — list, detail, create, edit, delete; type-driven widgets; search; pagination; light/dark CSS | |
| 40 | + |
| 41 | +## A taste of the patterns |
| 42 | + |
| 43 | +Every plugin follows the same shape — register at app startup, inject in handlers: |
| 44 | + |
| 45 | +```python |
| 46 | +from hawkapi import Depends, HawkAPI |
| 47 | +from hawkapi_auth import init_auth, JWTConfig, random_secret, requires_user |
| 48 | +from hawkapi_sqlalchemy import init_database, get_session |
| 49 | +from hawkapi_cache import init_cache, cached |
| 50 | +from hawkapi_storage import LocalConfig, LocalStorage, init_storage, get_storage |
| 51 | + |
| 52 | +app = HawkAPI() |
| 53 | +init_auth(app, config=JWTConfig(secret=random_secret())) |
| 54 | +init_database(app, url="postgresql+asyncpg://...") |
| 55 | +init_cache(app) |
| 56 | +init_storage(app, storage=LocalStorage(LocalConfig(root="/var/data"))) |
| 57 | + |
| 58 | + |
| 59 | +@app.get("/me") |
| 60 | +@cached(ttl=60) |
| 61 | +async def me(user_id: str = Depends(requires_user)): |
| 62 | + ... |
| 63 | +``` |
| 64 | + |
| 65 | +## Roadmap (not yet shipped) |
| 66 | + |
| 67 | +Candidate plugins that fit the same pattern but haven't been built yet. Open an issue if one would unblock you: |
| 68 | + |
| 69 | +- **hawkapi-ratelimit** — token bucket + sliding window with Redis |
| 70 | +- **hawkapi-cron** — in-process scheduler without a Celery dependency |
| 71 | +- **hawkapi-pagination** — cursor + offset helpers, `Page[T]` response model |
| 72 | +- **hawkapi-csrf** — CSRF for form-based flows (pairs with `hawkapi-admin`) |
| 73 | +- **hawkapi-i18n** — gettext + `Accept-Language` + lazy strings |
| 74 | +- **hawkapi-sse** — Server-Sent Events |
| 75 | +- **hawkapi-redis** / **hawkapi-mongo** / **hawkapi-clickhouse** / **hawkapi-kafka** / **hawkapi-search** — generic clients with DI + healthchecks |
| 76 | +- **hawkapi-webhook** — outbound webhooks with retry + HMAC signing |
| 77 | +- **hawkapi-events** — outbox pattern + domain event bus |
| 78 | +- **hawkapi-cli** — manage.py-style CLI (migrate, shell, run-jobs) |
| 79 | +- **hawkapi-payments** — Stripe + PayPal wrappers |
0 commit comments