Simple Combination of FastAPI and Svelte.
- Clone this Repo
git clone https://github.com/Gingerbreadfork/fastapi-svelte
pip install -r requirements.txt
to install python dependencies (ideally in a virtualenv or similar - don't be a savage).- Run
npm create vite@latest client -- --template svelte
inside root directory to create Svelte app insideclient
directory. - Inside
client
directory runnpm install
-
Build Svelte app if you haven't yet (and after any future changes) with
npm run build
inside client folder -
In a second terminal run a Uvicorn server (ideally with hotreloading so it refreshes after new builds of the app are generated):
uvicorn main:app --reload
You can build some pretty interesting/weird little apps using FastAPI to create a few endpoints while also serving a nice little frontend Svelte client at the same time.