mix caravela.gen.auth (Caravela v0.9.0)

Copy Markdown View Source

Generates the authentication stack from a Caravela domain whose authenticatable entity declares an authenticatable block.

mix caravela.gen.auth MyApp.Domains.Identity

Emits:

  • the auth context module (register, login, logout, sessions, API tokens, reset, confirm)
  • the session schema module
  • the Plug pipeline (fetch_current_user, require_auth, require_role, require_scope)
  • the LiveView on_mount hooks module
  • the auth controller (register / login / logout)
  • a migration creating the session tokens table

Flags:

  • --dry-run — print the generated files without writing anything
  • --output DIR — write under DIR instead of the project root
  • --force — overwrite existing files without prompting