Generates the frontend layer for a Caravela domain: a trio of LiveView modules (index/show/form) per entity, plus typed Svelte components and a TypeScript interfaces file.
mix caravela.gen.live MyApp.Domains.LibraryGenerated files (single-version, non-tenant example):
lib/my_app_web/live/library/book_live/{index,show,form}.ex
assets/svelte/library/{BookIndex,BookShow,BookForm}.svelte
assets/svelte/types/library.tsEvery LiveView mounts its Svelte component via <LiveSvelte.svelte>,
and delegates to the generated context module for CRUD calls —
authorization, hooks, and multi-tenant scoping flow through for free.
Requires LiveSvelte in the consumer app:
{:live_svelte, "~> 0.19"}After mix deps.get, follow the LiveSvelte docs to wire it into
assets/js/app.js.
Flags:
--dry-run— print the generated files without writing--output DIR— write underDIRinstead of the project root--force— overwrite existing files without prompting--with-domain— also emit aCaravela.Live.Domaincompanion module per entity and generateform.exfrom the Template-backed variant. Useful as an onramp to theCaravela.Live.*runtime.--frontend MODE— override the render transport for every entity in the domain.MODEislive(today's LiveView + WebSocket path) orrest(Inertia-style SSR viacaravela_svelte). Without the flag, each entity's DSL-declaredfrontend:is used, defaulting to:live.
Entities declared with frontend: :rest skip LiveView generation —
Caravela prints a caravela_rest router snippet instead. Svelte
components are emitted for both modes (the component contract is
mode-agnostic).
Regeneration preserves content below the # --- CUSTOM --- /
<!-- --- CUSTOM --- --> marker in every file.