An open API service indexing awesome lists of open source software.

https://github.com/dave-shawley/fastapi-patterns-lab

Lab for exploring FastAPI and ASGI patterns in code and theory
https://github.com/dave-shawley/fastapi-patterns-lab

fastapi

Last synced: 15 days ago
JSON representation

Lab for exploring FastAPI and ASGI patterns in code and theory

Awesome Lists containing this project

README

          

# FastAPI Patterns Lab

This repository is a working lab for exploring FastAPI and ASGI
patterns in real code.

It started as an investigation into webhook processing, but the goal is
broader than "a webhook app." The repository is meant to collect
patterns that are easier to understand when they are:

- implemented in runnable code
- explained in article-style documents
- exercised in a small example application

Some of those patterns may eventually settle into a reusable library.
That is why the repository has two layers: a reusable kernel in
`fastapi_patterns`, and an example application that consumes it.

## What This Repository Is

This is not a polished product or a turnkey framework. It isn't even
published to PyPI.

It is a place to:

- explore FastAPI design patterns
- document why those patterns exist
- keep example code and explanatory writing close together
- separate reusable ideas from app-specific examples

The repository is intentionally allowed to evolve as new patterns become
worth documenting.

## Repository Layout

- `src/fastapi_patterns/`
The reusable kernel. This is the package built into the wheel today.
- `src/fastapi_webhook/`
A small example application that demonstrates the patterns in
practice. It stays in the repository as runnable reference code and a
demo target for local development.
- `docs/`
Article-style notes about individual patterns. These are intended to
become GitHub Pages content over time.

## Package Boundary

The package boundary is intentional.

`fastapi_patterns` is where reusable code belongs. If something in this
repository feels like a generally useful technique rather than an
application detail, it should probably migrate there.

`fastapi_webhook` is the example application layer. It is useful for:

- showing how the patterns fit together in a real app
- providing concrete routes and payload models
- giving the repository a fast local demo path

At the moment, the built wheel only includes `fastapi_patterns` and
there is only one example application.

## Running The Example App

This project currently targets Python `3.14`. I use the
[just](https://just.systems/) utility to manage development tasks. If
you haven't used it before, you can install pre-built binaries from the
[just releases page](https://github.com/casey/just/releases). See the
[just docs](https://just.systems/docs/installation) for more details. The `justfile` is similar to a Makefile.
It contains commands that are useful for development. For example,
`just serve` creates or synchronizes a virtual environment and runs the
webhook example application.

```bash
just serve
```

## Development

Useful commands:

```bash
just format
just lint
```

`just serve` remains in the repository on purpose even though the
example app is not part of the published wheel. The repo should stay
easy to run while the patterns are still being explored.

## Direction

The likely long-term shape is:

- a repository of documented FastAPI patterns
- a published `fastapi_patterns` package containing the reusable parts
- example applications that prove the patterns out before they are
treated as library surface area

Until that settles, this repository should be read as a lab notebook
with working code, not as a finished framework.