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

mateog98's avatar

How can i run my api and front end in the same port?

Hi, im using Laravel 9 to develop my api and react js for my front end. Of course they are in different folders and they run in different ports with their specific commands. Is there any way to make them run in the same port and with only one command in the console?

0 likes
2 replies
lowe22's avatar

You wont be able to serve them on the same port if you want webpack-dev-server or similar. They will have to have different ports. You could build your assets into a production bundle if you're not working on them for a while then server the site on the single port, perhaps?

Alternatively there are cli tools that manage running process simultaneously. Packages like concurrently which is an npm module, off the top of my head.

Assuming youre running php artisan serve and npm run dev or something? Not sure if concurrently handles php process as well as node processes. But I'm sure there will be something out there that runs commands concurrently like this

Please or to participate in this conversation.