Structuring a Rust mono repo
Hello!
I am trying to setup a Rust monorepo which will house multiple of our services/workers/CLIs. Cargo workspace makes this very easy to work with ❤️..
Few things I wanted to hear experience from others was on:
- What high level structure has worked well for you? - I was thinking a
apps/andlibs/folder which will contain crates inside. libs would be shared code and apps would have each service as independent crate. - How do you organise the shared code? Since there maybe very small functions/types re-used across the codebase, multiple crates seems overkill. Perhaps a single
sharedcrate with clear separation using modules?use shared::telemetry::serve_prom_metrics(just an example) - How do you handle builds? Do you build all crates on every commit or someway to isolate builds based on changes?
Love to hear any other suggestions as well !