Skip to content

xeust/svelte-fastapi-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run SvelteKit frontend + FastAPI backend on Deta Space.

Directory Structure

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
    ...

Development Server

  1. Navigate into the fastapi directory and create a virtual env with python3 -m venv .venv.
  2. Install all dependencies with pip install -r requirements.txt.
  3. Navigate into the svelte directory and run npm install
  4. From the top level directory, run space dev to start both servers through a single port.
  5. Develop away

Notes

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.

Publishing to Space

  1. Run space new.
  2. From the top level directory, run space push (first run space new if you have no Space project).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published