Run SvelteKit frontend + FastAPI backend on Deta Space.
The root of the project contains the Spacefile and two subdirectories, each running one Micro.
The svelte directory contains the SvelteKit frontend. The fastapi directory contains the FastAPI backend.
Spacefile
/svelte
/src
/static
package.json
...
/fastapi
main.py
requirements.txt
...
python3 -m venv .venv.pip install -r requirements.txt.svelte directory and run npm installspace dev to start both servers through a single port.Your fastapi server will now be served on the /api route, which is set in the Spacefile. Try visiting the development server's /api route to see it in action. The / route will serve the SvelteKit frontend.
space new.space push (first run space new if you have no Space project).