This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the TS template for information on how to integrate TypeScript and typescript-eslint in your project.
- Make sure you have Python 3.9+ and pip installed.
- Install dependencies: pip install fastapi uvicorn pydantic requests
- Start the backend server: uvicorn backend:app --reload
The backend will be available at http://127.0.0.1:8000
- POST /chat: Send a message to the Gemini API (currently echoes your message).
The frontend is a Vite + React app (already scaffolded).
- Install dependencies: npm install
- Start the frontend: npm run dev
The frontend will be available at http://localhost:5173
-
Build the React frontend: npm run build (This creates a
distfolder with the production build.) -
Start the FastAPI backend: uvicorn backend:app --reload (This will serve both the API and the frontend at the same port, e.g., http://localhost:8000)
- Access your app at http://localhost:8000
- API requests to /chat will work as before.
- All static frontend files are served from /static and the root path.
- Connect the React frontend to the backend by sending chat messages to http://127.0.0.1:8000/chat
- Update the backend to call the real Gemini API.