Declare your domain. Sail with the generated code.
A schema-driven, composable full-stack framework for Phoenix projects.
Describe a domain (entities, fields, relations, hooks, permissions) as
an Elixir DSL; Caravela generates Ecto schemas, migrations, Phoenix
contexts, JSON controllers, Absinthe schemas, and a Svelte frontend
layer that works under both LiveView's WebSocket transport and an
Inertia-style HTTP transport - per entity, via frontend: :live or
frontend: :rest.
defmodule MyApp.Domains.Library do
use Caravela.Domain, multi_tenant: true
version "v1"
entity :books, frontend: :rest do
field :title, :string, required: true, min_length: 3
field :published, :boolean, default: false
end
entity :authors do
field :name, :string, required: true
end
policy :books do
allow :create, fn actor -> actor.role in [:admin, :editor] end
end
end
mix caravela.gen MyApp.Domains.Library
mix caravela.gen.live MyApp.Domains.Library
{:caravela, "~> 0.13"},
{:caravela_svelte, "~> 0.1"} # required for mix caravela.gen.live output
Full guides live under docs/ and ship with the Hex package.
Caravela.Live.*)authenticatable)Run mix docs to build the full API reference locally (HexDocs-style).
MPL-2.0 - see LICENSE and NOTICE.
Use Caravela freely, including in closed-source apps. Modifications to Caravela source files must stay under MPL-2.0 with attribution.
Caravela is built in the open and free to use. Donation channels will be linked here once set up. PRs, bug reports, and kind words all help keep the sails full.