|
1 | 1 | # Low-traffic neighbourhood tool v2
|
2 | 2 |
|
3 |
| -This is a WIP next iteration of <ltn.abstreet.org> |
| 3 | +This is a new version of [ltn.abstreet.org](https://ltn.abstreet.org). It |
| 4 | +doesn't have all features from v1 yet, but it solves many problems with the |
| 5 | +original. Please try both versions and give feedback. |
| 6 | + |
| 7 | +## Developer docs |
| 8 | + |
| 9 | +### Installation |
| 10 | + |
| 11 | +You'll need: |
| 12 | +[npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), |
| 13 | +[wasm-pack](https://github.com/rustwasm/wasm-pack), and |
| 14 | +[cargo](https://www.rust-lang.org/tools/install). |
| 15 | + |
| 16 | +`cd web`, and then: |
| 17 | + |
| 18 | +- `npm i` to install dependencies |
| 19 | +- `npm run wasm` to rebuild the Rust backend |
| 20 | + - vite doesn't automatically rebuild when you edit things |
| 21 | +- `npm run dev` to run locally |
| 22 | + - Changes to the Svelte/CSS usually auto-reload in your browser |
| 23 | +- `npm run fmt` to auto-format code |
| 24 | +- `npm run check` to see TypeScript errors |
| 25 | + |
| 26 | +The `tests` directory has some diff-based tests. `cd backend; cargo test |
| 27 | +--release` will run them. |
| 28 | + |
| 29 | +### Architecture |
| 30 | + |
| 31 | +The Rust `backend` crate gets compiled to WASM, with generally type-unsafe APIs |
| 32 | +in `lib.rs`. The Svelte frontend calls these in the main thread (though moving |
| 33 | +to web workers later is a possibility). The "important" state is kept in the |
| 34 | +backend, while the frontend has more ephemeral UI state. The main state is |
| 35 | +serialized as GeoJSON and kept in the user's browser local storage. The |
| 36 | +frontend is effectively a single page app, with the `Mode` toggling between |
| 37 | +different pages. |
0 commit comments