1010 B
1010 B
FastAPI + React Example
Basic example with a FastAPI backend and a React frontend (Vite).
Publish to CitadelHosts.com
All podman commands can be replaced with docker
podman login registry.citadelhosts.com
podman build -t registry.citadelhosts.com/react-frontend:latest frontend
podman build -t registry.citadelhosts.com/fastapi-backend:latest backend
podman image push registry.citadelhosts.com/react-frontend:latest
podman image push registry.citadelhosts.com/fastapi-backend:latest
Backend
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
export DATABASE_URL="postgresql+psycopg2://user:password@localhost:5432/dbname"
uvicorn app:app --reload --port 5000
FastAPI will run on http://localhost:5000.
Database health check is available at http://localhost:5000/api/db/health.
Frontend
cd frontend
npm install
npm run dev
Vite will run on http://localhost:5173 and proxy /api to the FastAPI server.