Suitability and prerequisites
Choose this layout for a Vite-style static frontend calling an HTTP API. If the frontend needs request-time server rendering, use a web server for that process. Review compatibility. You need Node 24, Python 3.13 with uv for the example, a GitHub repository, a SpringWinter account and a verified AWS connection. A container build also needs Docker. Keep the npm and uv lockfiles. The tagged source is a starter, not a production-authenticated service.Architecture
The browser calls a public API. CORS controls browser access by origin; it does not replace API authentication. The sample allows GET requests from configured origins only.Run the example locally
http://localhost:5173. GET /health returns {"status":"ok"}. GET http://localhost:8000/api/message returns {"message":"Hello from FastAPI"}. The tests use application test clients and no database. Verify the greeting in the browser as well as through HTTP.
Build the backend image from the frontend directory:
.venv/bin/uvicorn main:app --host 0.0.0.0 --port 8000. See FastAPI’s Docker guidance.
Configure dashboard resources
Copy the template into its own repository for the simplest path. If you keep the public monorepo layout, prefix these paths withreact-fastapi/.
The Dockerfile path is relative to the repository root. The context is a separate setting. Deploy the API, use its returned URL for the frontend build, then set CORS to the actual frontend origin. Use managed URLs first. Update the allowlist when a custom frontend hostname is ready.
Do not enable wildcard CORS as a troubleshooting shortcut.
VITE_API_URL is public configuration; no credentials belong in it. Changing it requires a new frontend build. Runtime backend variables are separate.
Deploy with an agent or REST client
Use the Codex, Claude Code or Cursor skill and ask for both resources in one approved plan. Confirm Region, costs and public exposure before provisioning. For API automation, read Static websites and Web servers from the current contract. Do not send a container port to a static website.Verification and troubleshooting
Observe each exact workflow. Open the frontend HTTPS URL and confirm the greeting, refresh a nested route if your app has one, and check the API separately. A passing/health endpoint does not test browser CORS or VITE_API_URL.