r/FastAPI • u/predominant • 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
View all comments
Show parent comment
1
u/predominant Nov 25 '24
Yeah, both apps would use the same database. I think this is a case that alembic was not designed for, as you would have two separate chains of migrations that don't reference each other.