I'm attempting to structure my axum api into feature crates (sort of like magento modules). The plan is, each workspace crate owns its own route, db migrations, services and dtos, and the core app crate glues it together. The core crate would register each feature crate and provide ways to implement migrations, routes.
pub struct FeatureMigration {
pub module: &'static str,
pub name: &'static str,
pub description: &'static str,
pub up_sql: &'static str,
}
Ideally. Currently i cannot figure out if the reason i'm finding this difficult, its either my lack of experience in rust, or this architecture doesnt go so well with rust in general.
I've made an axum api before (specdb query), but wanted to make something larger, that would quickly become unmaintainable without some structure - and i quite like how Magento is structured into modules.
Questions are:
- Are there any axum templates with this sort of architecture?
- Has anyone here used an architecture like this? why or why not?