I'm looking for some advice on how to build a SaaS application from scratch, particularly focusing on both web and mobile front-ends. I have experience with Laravel and React, but I'm new to mobile app development. I want to minimize the need to rewrite code for the mobile app while avoiding performance issues. I'm considering a monolithic architecture with a single repository that utilizes React Native or Expo alongside my Laravel API. Would this be a good strategy? I'm also curious about using Tanstack libraries for both platforms—can I create a setup where I write them just once? Any insights would be greatly appreciated since my experience is mostly with smaller projects and I want to make sure I'm set up for success!
4 Answers
With a monolithic architecture, be aware that the traffic limits can be lower compared to microservices. You might find that your app can only handle about 500 to 2000 concurrent users. For a mobile and web app setup, it's best to create a Laravel REST API that both platforms can use. Your web front-end would serve as a single-page app, and while I’m not super familiar with mobile development, this is typically how you’d set it up.
From my professional experience, using React and React Native is a solid choice. However, keep in mind that you won't be able to reuse all your code—the UI components will differ since React Native doesn’t use HTML elements (think View instead of div). That said, if you organize your code well, you could potentially reuse up to 80% of your business logic, APIs, and other shared aspects, but that can vary depending on your app's structure.
I manage a monorepo that includes a Fastify backend and both a Next.js app and an Expo app. This setup allows for great code reusability, so I can definitely recommend going that route. It can make your life easier when developing separate but related applications like yours.
A well-designed monolith can actually handle just as many requests as microservices. It all comes down to how you structure everything. Using a load balancer for horizontal scaling can work wonders. The choice between monolithic or microservices should really be based on your specific use case.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically