Claude Code hook

Fastapi Claude Template

Agent-first FastAPI template built to pair with Claude Code - opinionated architecture kept on the rails by custom skills, hooks and review agents.

33 stars 5 forksHooks Source

Install

From source
git clone https://github.com/ewtryocb/fastapi-claude-template.git

From the README

FastAPI Template
Production-ready FastAPI template with Clean Architecture, multi-transport support (HTTP / NATS consumers / Taskiq scheduler), and first-class Claude Code integration — custom skills, architecture hooks, and a review agent that teach the AI how the codebase is structured.

A batteries-included starting point for building async Python services. Ships with the boring-but-important stuff already wired: Dishka DI across three transports, SQLAlchemy 2.0 async + Alembic, Pydantic v2 contracts, JWT auth, pagination, layered testing with testcontainers, and strict layer boundaries enforced by Claude Code hooks so the architecture stays clean as the project grows.

Highlights

- Clean Architecture + Hexagonal — strict inward dependencies (application/ → database/ is the only documented exception). The full ruleset lives in CLAUDE.md.
- Three transports, one composition root — HTTP (FastAPI + Granian), message consumers (FastStream over NATS), scheduled jobs (Taskiq over NATS JetStream). All share the same Dishka container built by entrypoints/container.py.
- RequestBus + UseCase pattern — every transport translates input into a Request, calls request_bus.send(), and unwraps a Result. Zero business logic in endpoints/subscribers/tasks. Paired with an EventBus for fire-and-forget domain events, both inheriting a shared Bus[M] Protocol.
- Audience-first HTTP routing — endpoints grouped by who can call them (public/, user/, admin/, internal/). Auth is wired once at the router level; it's structurally impossible to forget on individual endpoints.
- Strict/lenient pagination split — HTTP contract enforces 10 ≤ limit ≤ 200; internal callers can request unbounded fetches via limit=None.
- Layered testing — unit (mocks only), integration (testcontainers…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
Python
License
MIT
Last updated
7 April 2026

FAQ

What is Fastapi Claude Template?

Agent-first FastAPI template built to pair with Claude Code - opinionated architecture kept on the rails by custom skills, hooks and review agents. It is a hook for Claude Code, from ewtryocb/fastapi-claude-template on GitHub.

How do I install Fastapi Claude Template?

Clone ewtryocb/fastapi-claude-template from GitHub and follow the setup steps in its README.

Is Fastapi Claude Template popular?

ewtryocb/fastapi-claude-template has 33 GitHub stars and 5 forks. It was last updated on 7 April 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.