r/FastAPI • • Jun 15 '25

feedback request Project Review

Hey Pythonistas, I would love to share my event ticketing system project. It's built with FastAPI (switched from Django to see async features) and would love to hear your feedback on architecture, best practices, schema design, and everything u see.

https://github.com/degisew/event_ticketing_fastapi

Thanks.

15 Upvotes

13 comments sorted by

View all comments

Show parent comment

2

u/Typical-Yam9482 Jun 16 '25

No-SA-outside-of-repositoties is a tricky one, isn't it? :) almost religious!

Repos are normally (?) considered as more or less CRUD, i.e., atomic actions on your models. Services, in their order, are natural places and last resort where you can mix and cross (in all possible burlesque-ish way) data, returned by different repos. Sometimes you do need some sort of exotic actions to write piece of data straight to DB, based on calculations happened in this service. Or generate some complicated report, requiring several joins, groupings, etc.

You can try to fit such methods to some repos of course. But most probably it will be even uglier, or it won't be clear which entity repo this method really relates to (because it can be mix of 3-4 entities involved into commotion). So, you will just end up with the same method within 1 extra "artificially" created repo without gaining anything in principle..

But! I will be happy to be enlightened with clean solution I kept missing all that time :)

1

u/AfraidAsk4201 Jun 16 '25 edited Jun 16 '25

Yeah. I think it shouldn't be followed religiously (I have a multiple repo call inside a service atomically). But It's good place to put domain related DB operations in repo and use as needed.

1

u/javierrsantoss Jun 17 '25

I was also be taught to only implement DB access on repositories. I think is really easy to follow a codebase with that approach.

I haven't ever think that was really tricky idk

Do you mix the business logic with the DB access? i'd love to know how you approach this, ty :D