Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Building python backend sever and js frontend

I use a web application that runs Python fast API in the backend and electron+vite+vue in the frontend.
How can we build and run both the front end and the backend in the same shell?
I found one way to run a script to build a Python backend in package.json. Is this good practice? If not what are the alternatives?

Thanks

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

There is a package called concurrently that allows you to run multiple commands at same time.

first install concurrently

npm i concurrently 

here is a example you can create in package.json file

"scripts": {
  "start": "concurrently \"cd backend && uvicorn main:app --reload\" \"cd frontend && npm run dev\""
}
  • A better alternative would be to use a tool like Docker to containerize both the frontend and backend applications. This way, they can run independently of each other in their own isolated environments. You can then use Docker Compose to manage the containers and start them with a single command
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading