Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TylerW's avatar

Laravel API as basis for PWA, Swift, and Java Apps

I know this is probably outside the scope of this forum, but I love the community here and want to run my plans past the brilliant minds here in case anyone has done something similar before.

I am in the beginning stages of building an application that will consist of a PWA, iOS native application, and Android application. Being solely a Laravel developer for the past five years, I want to incorporate as much of what I already know into this process as possible.

My understanding is that the best way to go about this would be: 1. Create a Laravel API that can be consumed by all of the different sources 2. Create a PWA using Laravel + Vue that consumes the API 3. Create Swift and Java apps that consume the API

For the record, the reason I chose Vue as opposed to Livewire is because offline usability is of the utmost importance. People will be using this application frequently in locations without internet access. The reason I need to create native mobile apps is because app store foot traffic is going to play an outsized role in marketing the application due to the relatively niche market. My understanding is that the app store does not like seeing people try to pass off PWAs as native applications.

Any suggestions for how I could streamline this process further, or is this about the best way I could accomplish the end goal in question while leveraging my Laravel experience?

0 likes
2 replies
jlrdw's avatar

Seems fine if user can get what they need via json or XML. Just work out pagination, you don"t want to query too much data at a time.

martinbean's avatar
Level 80

@tylerw I’m not really sure what you‘re after in terms of “streamlining the process” but yeah, you would need an API to provide data to each of those clients (PWA, iOS app, Android app).

For authentication, I’d recommend Passport. Passport is a first party Laravel package that adds an OAuth service to your application. This will allow you to create OAuth clients for each consuming client (i.e. the PWA, the iOS app, the Android app).

For the offline functionality, I did something similar for an EPOS system. It needed offline support as well (so merchants could still take orders even without a network connection). So you can use something like UUIDs to identify records. You can generate UUIDs in the app if it is offline.

The reason for using something like UUIDs is so that you don’t get clashing primary keys. If you imagine a record with ID 9 is created and then the client goes offline, if the client tries to create a “local” record with an ID of 10 then you’re going to have problems if you another client that’s online manages to create a record and gets the ID of 10. Now when the first client comes back online it’s going to try and push its own version of ID 10 to the server and you’re going to have a conflict. In the EPOS project, the client would replay its events when it got a network connection again.

1 like

Please or to participate in this conversation.