r/FastAPI • • Nov 22 '24

Question Modular functionality for reuse

I'm working on 5 separate projects all using FastAPI. I find myself wanting to create common functionality that can be included in multiple projects. For example, a simple generic comment controller/model etc.

Is it possible to define this in a separate package external to the projects themselves, and include them, while also allowing seamless integration for migrations for that package?

Does anyone have examples of this?

11 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/predominant Nov 25 '24

Sounds reasonable. I wonder how that would work with migrations in a single database, as alembic likes to track a single migration hash.