App template for full-stack datavisyn apps. The repository is split into frontend (src
, package.json
, ...) and backend (app_template
, Makefile
, requirements.txt
, ...). Make sure you have Node 16 and the latest yarn version installed (and run corepack enable
).
To get started, clone this repository:
git clone -b develop https://github.com/datavisyn/app_template.git # or any other branch you want to develop in
cd app_template
Finally, replace all occurances of app_template
with your new application name (i.e. also the folder app_template
). Then delete the .git
folder and initialize with a new repository.
The frontend is a React application built and managed via visyn_scripts. All relevant scripts can be found in the package.json.
yarn 3 is used as package manager, such that you can simply install the frontend via yarn install
.
The application has many package.json scripts available, with one of them being yarn start
. This will start the dev-server.
All sourcefiles are linted via ESLint and Prettier, which can be checked and auto-fixed via yarn run lint[:fix]
.
Jest is used for unit-tests via yarn run test
, and Cypress is used for e2e and component tests via yarn run cy:run
. Alternatively, the Cypress UI can be started via yarn run cy:open
.
For generating a production build of the application (i.e. for deployment to Github Pages), simply run yarn run bundle:prod
and the bundle will be in the bundles/
folder.
Note: The CI will automatically run the lint, build and test jobs, such that it makes sense to run them before committing. yarn run all
runs all the relevant tasks.
The backend is a FastAPI server managed via visyn_core. All relevant scripts can be found in the Makefile.
It is recommended to create a virtual environment to avoid cluttering the global installation directory.
python -m venv .venv # create a new virtual environment
source .venv/bin/activate # active it
make develop # install all dependencies
To start the development server, simply run python app_template
which will execute a uvicorn runner.
All sourcefiles are formatted and linted, which can be checked and auto-fixed via make format
and make lint
.
pytest is used for unit-tests via make test
. See app_template/tests
for details.
Note: The CI will automatically run the lint, build and test jobs, such that it makes sense to run them before committing. make all
runs all the relevant tasks.