Is it Better to Have a Single Large Laravel Application or Multiple Separate Applications for Different Backend Solutions?

I am in the process of developing several backend applications utilizing Laravel that have similar features and database designs. Although these systems cater to different clients or purposes, they share functionalities such as authentication, common database tables, and underlying business rules. I find myself evaluating two different strategies:

Strategy 1: A Single Comprehensive Laravel Application

  • A unified Laravel application encompasses all the required functionalities.
  • Implement multi-tenancy to manage data segregation for various clients or projects (for instance, using separate databases per tenant or tenant identifiers in your tables).
  • A consolidated codebase simplifies the management of shared functionalities and updates.

Strategy 2: Distinct Individual Laravel Applications

  • Each project operates with its own Laravel application.
  • Shared schemas and logic can be organized in a common package or folder (for example, leveraging a Composer package or loadMigrationsFrom for managing migrations).
  • The projects remain completely independent, allowing for individual growth, yet any updates to shared functionality or database structure must be consistently applied across all applications.

if the apps share a lot of code, a single laravel app might be easier. less duplicate code to update. however, if future growth is different for each one, starting separate might save headaches down the line. balance simplicity for now with potential complexity later. just my 2 cents!

If scalability and maintainability are priorities, consider utilizing a microservices architecture where each service is a dedicated Laravel application. This approach offers flexibility; each service can be updated, deployed, and scaled independently. Sharing code between applications can be made more efficient through well-documented APIs. Using Laravel’s Lumen framework for microservices that don’t require full-featured Laravel can also be beneficial in terms of performance suitable for specific tasks, optimizing resource use and reducing system load.