Generates the authentication stack for a Caravela.Schema.Domain
whose authenticatable entity declares an authenticatable block.
Emits:
lib/<app>/<context>/auth.ex— auth context (register, login, logout, sessions, API tokens, reset, confirm)lib/<app>/<context>/user_session.ex— session schemalib/<web>/plugs/auth.ex— plug pipelinelib/<web>/live/auth_hooks.ex— LiveViewon_mounthookslib/<web>/controllers/auth_controller.ex— auth endpointspriv/repo/migrations/<ts>_create_<context>_user_sessions.exs— session tokens migration
Returns a list of {path, source} tuples — the caller writes files.
Files preserve content below the # --- CUSTOM --- marker on
regeneration. The session migration is never merged (no marker) and
is timestamped like any other migration.
Summary
Functions
Render all auth files. Raises if the domain has no authenticatable entity.
Render the auth context module.
Render the auth HTTP controller.
Render the LiveView on_mount hooks module.
Render the session-tokens migration file.
Render the Plug pipeline module.
Render the session schema module.
Return a ready-to-paste router snippet showing the public auth
routes, protected live_session, and authenticated API scope.
Printed by mix caravela.gen.auth after writing files.
Functions
Render all auth files. Raises if the domain has no authenticatable entity.
Options:
:root— project root, used to resolve existing files for custom-block preservation (defaults toFile.cwd!()):timestamp— pin the migration timestamp (useful for tests)
Render the auth context module.
Render the auth HTTP controller.
Render the LiveView on_mount hooks module.
Render the session-tokens migration file.
Render the Plug pipeline module.
Render the session schema module.
Return a ready-to-paste router snippet showing the public auth
routes, protected live_session, and authenticated API scope.
Printed by mix caravela.gen.auth after writing files.