Skip to content

Development

Justin Forest edited this page Mar 25, 2024 · 6 revisions

Table of Contents:

Backend

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.

Frontend

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/    │
│                                                  │
╰──────────────────────────────────────────────────╯
Clone this wiki locally