-
Notifications
You must be signed in to change notification settings - Fork 2
Development
Table of Contents:
To work on the backend, download the source code, make sure you have Rust 1.76+ installed, go to the backend
folder and start. To compile and run it, use the cargo run
command or make serve
, which runs the server on port 8080. To check for errors, use make lint
and make test
.
$ make serve
cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.08s
Running `target/debug/treemap`
[2024-03-25T18:58:17Z INFO treemap] Running 1 worker(s) at 0.0.0.0:8000.
[2024-03-25T18:58:17Z INFO actix_server::builder] starting 1 workers
[2024-03-25T18:58:17Z INFO actix_server::server] Actix runtime found; starting in Actix runtime
[2024-03-25T18:58:17Z DEBUG treemap] Initializing new thread.
[2024-03-25T18:58:17Z DEBUG treemap] Initializing app state.
[2024-03-25T18:58:17Z INFO treemap::services::database::sqlite] Using SQLite database from var/database.sqlite.
To work on the frontend, you need Node v20+ installed locally. Then go to the frontend
folder and run make storybook
. That will start a Storybook server on port 6006 which is a very handy way to develop and test the UI. All API requests are mocked so no backend is needed.
To test the code, use commands make lint
and make test
. To run frontend locally, use make serve
, it will be connecting to the API at localhost:8000
, which was launched in the previous step.
$ make storybook
npm run storybook -- --no-open
> frontend@0.0.0 storybook
> storybook dev -p 6006 --no-open
@storybook/cli v8.0.4
info => Starting manager..
info => Starting preview..
info Using tsconfig paths for react-docgen
╭──────────────────────────────────────────────────╮
│ │
│ Storybook 8.0.4 for react-vite started │
│ 313 ms for manager and 704 ms for preview │
│ │
│ Local: http://localhost:6006/ │
│ On your network: http://192.168.5.3:6006/ │
│ │
╰──────────────────────────────────────────────────╯
To build the Docker image, please go to the root of the source code tree, and run make build-image
. The image will be built using two builder steps for backend and frontend, then merged into a single target image. To publish the image, use the make publish-image
command. (Version number in the make file might need to be updated.)
You obviously need Docker or Podman installed for this step.