Is Laravel a good choice for Backend for Frontend (BFF)?

Hey folks,

I’m working on a project with two Laravel APIs and a central auth system using Laravel, Passport, Spatie Permission, and Socialite. I’m moving from Remix v2 to React Router v7, but I’m hitting some snags.

The frontend stuff is getting messy. Simple things in Laravel are becoming a headache in React Router. Like setting cookies on redirects or dealing with unstable middleware. It feels like my BFF is turning into a monster.

For actions, I’m stuck between TanstackQuery mutations (with manual revalidation) or creating a complex action naming system. Even with RR7’s useFetcher, I need extra hooks for callbacks.

I’m wondering if Laravel + Inertia could be a better BFF. It could handle API data fetching, caching, sessions, and token refresh. Has anyone tried this setup? What do you think?

I’d keep my APIs separate, though. No mixing Inertia and views in there.

Any thoughts or experiences to share?

Laravel + Inertia for BFF is a solid choice, especially given your current setup. It can streamline API data fetching, caching, and auth management, addressing the issues you’re facing with React Router. The unified backend logic can simplify maintenance and reduce complexity.

However, consider the learning curve for your team and potential performance implications. It might be worth setting up a small test project to evaluate how it handles your specific use cases. This approach could significantly reduce the frontend complexity you’re experiencing while leveraging Laravel’s strengths.

Remember, keeping your APIs separate is a good strategy for long-term flexibility. If you decide to go this route, focus on clear documentation and modular design to ease the transition and future maintenance.

i’ve used laravel+inertia for bff, and it’s solid. it handles api, caching, and auth smooth. compared to react router, it keeps things tidy. just watch out for the learning curve if ur team new. keeping apis separate is smart. give it a try!

hey, laravel+inertia sounds like a solid bff choice! it could streamline ur data handling and auth stuff. but have u considered the learning curve for ur team? maybe try a small test project first to see how it feels? also, what about performance? any worries there?