Local development
Prerequisites
Being a web project, make sure to have a working version of node, as well as npm (or pnpm) installed on your system.
Packages called node
or nodejs
should be available in most
distributions. nvm ("node version manager") is an alternative great
way to be able to have mulitple versions of node installed on a system,
and quickly switch between them.
For FastAPI, the minimum required python version is 3.10. Check the locally
installed python version with python3 --version
. pyenv (python version
manager) will let you install mulitple python versions on your system, and
switch between them. It's basically for Python what nvm is for node.
Installation
To run the development server, navigate to the folder after cloning, and install the dependencies.
git clone https://github.com/giellatekno/fst-web-interface
cd fst-web-interface/client
npm install
npm run dev
Now visit the locally running development server at localhost:5173. Modifications to source files will instantly be reflected in the browser window, due to something called "hot module reloading".
To run the api in development, navigate to the folder, create a virtual environment, install requirements, and then run the web server:
cd fst-web-interface/api
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn src.main:app --reload
Now the API is accessible at port 8000, and two different OpenAPI schema explorers are available at /redoc and /docs. In my opinon, the /redoc one is nicer, but the /docs one will let you test queries to the API directly on the documentation site.
Development after initial setup
For the front-end app, npm install
is only required when first setting up the
development. Likewise, for python, the steps to install the virtual environment
(python -m venv .venv
) and installing required packages (pip install -r requirements.txt
)
are first-time-only required steps.
Resources
The javascript frontend framework in this project is Svelte. Read about it at svelte.dev.
The API framework is FastAPI. Read about it at fastapi.tiangolo.com.