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
>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