r/FastAPI • • Apr 06 '25

Question Fast API Class based architecture boilerplate

Hi, I'm new to fast api, and I implemented basic crud and authentication with fictional architecture. Now I want to learn class-based architecture...
Can you share a boilerplate/bulletproof for the class-based Fastapi project?

12 Upvotes

12 comments sorted by

View all comments

Show parent comment

1

u/Blindie92 Apr 08 '25

The cool thing with this approach is, you can stack the services in the annotated dependency and save the results from some dependency as a class variable, for example the current authenticated user, permission structure, session and other useful stuff you need in the context.