Build and Run the Production Version
The development server gives fast feedback while you build. Before calling the project finished, create the client production build and let Express serve it the same way it will in a deployed environment.
From the project root, build the client:
npm run build
The root script delegates to Vite, which creates client/dist.
Then start the Express server using the production command:
npm start
server/src/app.js checks whether client/dist exists. When it does, Express serves those static files and sends index.html for normal application routes. API paths continue to use the /api/... routes.
This distinction is important:
/api/transactions → Express API
/api/categories → Express API
/ → built React application
/summary → React application route
/categories → React application route
Open the browser at the server’s address and repeat a few critical actions. You are checking that the built client and the API still communicate correctly when Vite is no longer acting as the development host.
Test it
Run the build command and confirm client/dist is created. Start the server, open the application, navigate directly to /summary and /categories, and confirm that the pages still load.
Then add one transaction and refresh the page. The value should still be present.
Checkpoint
The Ledger now runs both in development and as a single Express-served application, and you have a final workflow you can repeat whenever you make a significant change.