miso's avatar
Level 2

AngularJS app - with Lumen or Laravel?

I am about to build web application consisting of three parts:

  1. Public data-oriented websites for unauthenticated users with geolocation search, ...
  2. Member area (with authentication) for managing the data
  3. Mobile app/apps with the same functionalities

The airbnb.com is a good example of the structure.

Basicaly the thing is to create a server side API which will be shared accross clients.

I definitelly want to use AngularJS for the client side, but I am not sure which of those solutions is better:

  1. Create the API with microframework Lumen and add sessions / authentication / html serving / other services to the Lumen
  2. Create the API with full stack framework Laravel and serve html to AngularJS

Thank you for your suggestions.

0 likes
6 replies
SP1966's avatar

How busy do you expect the API to be? If you're feeling a need for speed then Lumen all the way, if not then Laravel would likely be a little easier and far more flexible. Regarding the API being used for both websites and mobile apps you're likely to find JWT/JSON Web Tokens far easier to use across all platforms than a session based auth.

1 like
miso's avatar
Level 2

@SP1966, in the beginning, I do not expect the API be very busy. But lets say, in the future it would be busy as API of airbnb.com. Is it naive to assume that such heavily visited site as airbnb.com can be run on single Laravel app?

@virt, you are right, unauthenticated search queries could target separate API. It it possible to integrate Lumen into Laravel such that they share model layer (repository classes)? Or did you mean different framework instances, perhaps on different machines?

Thank you both for the authentication advices.

SP1966's avatar

@miso I highly doubt anything as large as airbnb is running a framework like Laravel, certainly not on the API end. Besides, it makes no sense whatsoever to run a full framework like Laravel to simply respond to an API, especially a busy API. The author of Laravel himself uses a micro-framework for the busier aspects of his projects which was the motivation for developing a Laravel like micro-framework in the first place.

1 like
vitr's avatar

@SP1966 right, Taylor suggests using full Laravel and Lumen all together http://www.laravelpodcast.com/episodes/11108-episode-26-illuminated-tesla-micro-services
@miso Of course, there is no sense to integrate them, as they should be totally separated instances. If you design your app well, there is no problem with extraction some parts as services)) In your case you can share auth tokens across the server instances with some kind of common storage, e.g. database.

SP1966's avatar

@vitr If you use JWT tokens you shouldn't be storing any state data server side. The token is self validating, so long as each of your servers that accept the token for validation knows the secret/salt used in signing the token they can each validate it independently.

1 like

Please or to participate in this conversation.