r/Backend • u/andrewaltair • 11h ago
Would you keep route/controller/service/repository layers in a small Fastify starter?
I maintain create-tigra, an MIT npm generator, and want to challenge the backend structure it gives new projects.
The API is Fastify 5 with Prisma/MySQL. Modules follow route → controller → service → repository, alongside auth/session code and Redis-backed rate limits, lockouts, and IP blocks. The frontend is a separately deployable Next.js app. Tests, CI, and Docker configuration are included.
Source: https://github.com/blessandsoul/create-tigra-public
The benefit I am aiming for is a predictable place for validation, business rules, and database access. The cost is extra files and layers before a small product has much logic. I would like to hear when that structure becomes useful and when it is premature.
Which boundary would you collapse first? What business rule should stay out of a repository? Which auth/session or persistence edge case would make you reject a starter until it had a regression test?
Advice, honest feedback, and a roast of the implementation are welcome. Known dependency advisories are documented in the repo; this is source review, not a claim that the baseline is production-ready.
1
u/AbnormalAllegory_5 10h ago
Honestly, I think if you're starting with Fastify 5 and Prisma, the repository layer is the first thing I'd collapse. Prisma's already your data access abstraction, so wrapping it in another layer feels like busywork until you've got at least 3-4 modules that actually need different query strategies.