A simple todo app demonstrating how to build a full-stack application with:
This code accompanies the blog post: Svelte SPA and FastAPI Integration Tutorial
svelte-spa-fastapi-tutorial/
├── backend/ # FastAPI Python backend
│ ├── main.py # FastAPI app with CRUD endpoints
│ ├── models.py # Pydantic models for Todo
│ └── requirements.txt
│
└── frontend/ # SvelteKit SPA
├── src/
│ ├── routes/ # Pages
│ └── lib/ # API client & components
├── orval.config.cjs # Orval configuration for API client generation
└── package.json
cd backend
pip install -r requirements.txt
uvicorn main:app --reload
http://localhost:8000http://localhost:8000/docscd frontend
npm install
With the backend running, generate the TypeScript API client:
npm run generate
This creates typed API functions from the backend's OpenAPI spec.
npm run dev
Frontend runs at http://localhost:5173
npm run generate in frontend to update API clientRead the full tutorial: Svelte SPA and FastAPI Integration Tutorial