Framework (Framework v0.5.0)

View Source

Production-ready Elixir framework for event-driven applications.

Provides canonical flow: Accept → Plan → Commit → Emit → Replay → Effects with verified routes, typed contracts, guaranteed ordering, and internationalization.

Core Features

  • Transaction DSL: Pure plan functions with READ · GUARD · COMPUTE · WRITE nodes
  • Verified Routes: Type-safe navigation with compile-time verification
  • Effects System: Idempotent email/webhook dispatch with locale support
  • Event Sequencing: Guaranteed ordering via sequence-based delivery
  • Schema Registry: JSON Schema validation with digest verification
  • Internationalization: Multi-locale support with pure translation helpers

Example Operation

defmodule MyApp.Operations.InviteUser do
  use Framework.Transaction

  def plan(input, ctx) do
    user = get(:users, input.user_id)

    result = compute fn ->
      %{
        greeting: t(ctx, "user.greeting", name: user.name),
        locale: ctx.locale
      }
    end

    email(:welcome, to: user.email, template: "welcome")

    commit(result)
  end
end

Configuration

# config/runtime.exs
config :framework,
  repo: MyApp.Repo,
  pubsub: MyApp.PubSub

config :framework, Framework.I18n,
  default_locale: "en-US",
  supported_locales: ["en-US", "es-ES", "fr-FR"],
  gettext_backend: MyApp.Gettext

See Framework.Transaction, Framework.I18n, and Framework.Kernel for details.