Skip to content

Where code goes

Under modules/<module>/:

  • src/module.rs: MODULE, the manifest (name, tier, settings) spreading the generated src/wiring.rs; src/config.rs: its configuration.
  • src/<aggregate>/mod.rs: an aggregate, changed only through its methods; factory.rs beside it is its only constructor.
  • src/actions/: one file per action (writes); src/queries/: one per query (reads) and their read models.
  • src/areas/<area>/routes.rs: the module’s endpoints in an area; menu.rs its menu entries; screens/<name>.html its templates.
  • src/tasks.rs or src/tasks/: #[task] functions run once by hand, such as a data backfill.
  • src/gateways/: outgoing requests; src/extensions/: implementations of other contracts’ extension points; src/domain/: private code.
  • contract/: the only crate other modules may use: traits, events (events.rs), areas (area.rs); contract/src/gen/ is generated.
  • migrations/NNNN_name.sql, lang/<language>.toml.

app/src/wiring.rs and each module’s src/wiring.rs are generated; the app crate holds no module code.

Generated from sofie at 4aa7c05.