this method will take in a command, and the current state and determine if it wants to emit one or many events or an error tuple such as {:error, "reason"} to indicate that this is an invalid command OR it can return nil which indicates that it's a noop (a command that didn't do anything)
apply(current_state, event_that_just_happened) -> new state
this will take any events saved by execute and use them to update this current aggregate's state.
commands/
(command_name).ex
These are named in an imperative style as archive_widget.ex or whitelist_organization.ex. You can name these CRUD operations but it's better to name them as specific to what their doing as possible. For instance you can create a widget but did you really create the user. You didn't. you're not their mother.
These are structs, usually with no changeset. They are validated by the aggregate. It choses if it wants to execute the command.
(context_name).ex
This has all the docs and defdelegate's to other files
es/
router.ex
this routes commands to different aggregates.
events/ (widget_created.ex)
These are named in past tense, like an event in history (because they are). Such as wdiget_archived.ex or org_whitelisted.ex.