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

P81CFM's avatar

Hosting web app on a server and create API to interact with Android app (iOS future)

Hi guys,

I'm here asking you guys with lots of experience about how can I plan some future movements.

The plan is to, once I developed a web site with Laravel and mySQL, to find a good hosting service (right now the choice is Google Cloud Platform using Cloudways to make it easy all the process of configuration, but I'm open to other suggestions).

The main "issue" is the fact that I would like to create some sort of API to interact with an Android app (and in the future with an iOS app). How is it possible to make my mySQL db data available to users registered in my web site? I read something about developing API with Flask and Python I would like to have more info when it comes to Laravel.

Thanks a lot and I apologize I know the question is pretty vague

Cheers

0 likes
5 replies
Helmchen's avatar

you can either use the existing routes of the application to serve JSON content instead of HTML (Laravel already handles this very well in response to Ajax requests e.g. if the request headers contain X-Requested-With: XMLHttpRequest)

or

create app exclusive API routes and serve whatever content you need

you have to find ways to ensure the user is authorized for the requests, but it really isn't that much different to your normal web application.

take a look at https://jwt.io/

P81CFM's avatar

Thank you guys really helpful,

where do you think can be the "bottleneck" in case the website/App will be successful and used by many users?

Famous and very successful and massively used app (Instagram, Facebook, Twitter and so on) how do they manage the fruition of contents from different platform having one single place where they store the data? I would imagine that they use something "a bit" more sophisticated than a simple RESTful API.

simioluwatomi's avatar

Build first, scale later. Most of the optimizations we have planned in our heads at the beginning of a project are unnecessary as those challenges are not mission critical.

I'm not in any way saying you should not follow best practices when building your project but do not focus on scaling when it is not yet a headache for you.

For the API, I would suggest using passport for Authentication and Postman for testing. You could bundle the API and WEB parts of the application into one project and use the different routes\web and routes\api files to differentiate them.

If I were you, I would separate my Controllers based on the part of the application they would serve.

P81CFM's avatar

Thank you so much really appreciate your suggestion

Please or to participate in this conversation.