A full-stack app where a Flask backend serves a Vite-built React frontend — one process, one port.
# Install dependencies
pip install -r requirements.txt
cd frontend && npm install && npm run build && cd ..
# Run
python app.pyOpen http://localhost:5000.
├── app.py # Flask backend (serves React + API)
├── requirements.txt # Python dependencies
└── frontend/
├── package.json # React/Vite dependencies
├── vite.config.js # Dev proxy config
├── index.html
└── src/
├── main.jsx
├── App.jsx
├── App.css
└── index.css
| Endpoint | Description |
|---|---|
GET /api/hello |
Returns a JSON greeting |
For hot-reload during frontend development:
# Terminal 1 — Flask API
python app.py
# Terminal 2 — Vite dev server (proxies /api to Flask)
cd frontend && npm run devRebuild before running in production mode:
cd frontend && npm run build