Phoenix + LiveView

Connected products, live updates and background work in one application.

Phoenix · LiveView · Ecto · PostgreSQL

These recipes and dependency combinations need checking in your actual project before you rely on them.

Give this guide to your agent

Paste the guide address into your agent chat, together with what you want to build.

How to use Stack Menu with your agent →

When to use Phoenix + LiveView

Choose it when

  • Server-owned state and business rules dominate a connected product.
  • Phoenix conventions and OTP process lifecycles match the service requirements.
  • A relational store can also support durable background jobs.

Consider another path when

  • The main deliverable is a platform-native mobile UI or offline-first client.
  • The application depends on a library, accelerator or vendor SDK unsupported by the intended Elixir deployment.
  • A small static site, simple script or CLI does not need a running web application.

Use cases: Connected browser products and portals; Real-time collaboration interfaces; JSON APIs for native clients; Durable application background work.

Generators: create the baseline first

Generator documentation reviewed: 2026-10-18. Evidence: documentation-reviewed; commands not executed.

Required workflow

  • Before writing a new project's application files, read its profile's starting points and use the official framework or language initializer appropriate to the component. Do not hand-recreate a generated skeleton. Where no full application generator exists, use the documented module/package initializer and assemble only the missing application pieces.
  • Choose one starting point per component. Check the installed generator's version and help, prerequisites, template, database, UI, test and runtime options. Commands are examples: replace names and paths, resolve compatible versions, and record the exact invocation and selected options. Do not blindly run every listed generator.
  • Generate in a new empty destination. For an existing repository, preserve its conventions and use relevant incremental generators. If a baseline comparison is needed, generate a separate disposable reference with matching versions/options and reconcile deliberately; never regenerate over existing work.
  • Keep applicable generated configuration, hidden files, formatter/linter settings, ignore rules, manifests, lockfiles, tests, wrappers and entry points. Extend them for the project instead of replacing them with abbreviated handwritten copies. A generator may initialize version control or offer a commit; respect the user's Git instructions.
  • Run the generated baseline's documented checks before feature changes, then relevant checks after configuration and implementation. Inspect what version control would include, including hidden files, build output, local secrets and operating-system metadata. Add needed ignore rules explicitly: no generator guarantees that .DS_Store or every local artifact is ignored.
  • Use follow-up generators only when their feature or tool is selected. Review generated changes and dependencies, apply required migrations in the intended environment, and exercise the generated behavior. Scaffolding does not establish authorization, safe retries, production readiness or every best practice.
  • If the required generator, template or IDE is unavailable, report the missing prerequisite and the documented route. Do not silently substitute a handwritten scaffold. Keep documentation review, generator execution, baseline checks and application qualification as separate evidence.

Choose a starting point

Phoenix browser application with LiveView and PostgreSQL

Use when: A new connected browser application uses this profile. Generate the skeleton before adding application code.

  1. Read the repository README, runtime pins and existing mix.exs/mix.lock first. Existing applications keep their structure; do not regenerate over them.
  2. Choose a local source workspace and a new destination. Replace my_app with the chosen snake_case application name throughout these examples.
  3. Install a compatible Erlang/OTP and Elixir pair using official installation guidance; check the chosen Phoenix release requirements. Set up PostgreSQL access for development and tests.
  4. Check installed tools. Install Hex only if missing, and install the Phoenix archive only if missing or deliberately changing its version. Check installed generator help before choosing switches.
  5. Generate the project, respond to the dependency-install prompt, then enter my_app. Review the generated README, mix.exs aliases, configuration and any agent guidance.
  6. Configure database credentials outside committed secrets. Inspect the generated mix setup alias before running it; it can fetch dependencies, create/migrate the database and build assets. Resolve failures in place and retain their output.

Working directory: chosen local workspace

Inspect the active Elixir and Erlang/OTP versions

elixir --version

Working directory: chosen local workspace

Inspect the active Mix runtime

mix --version

Working directory: chosen local workspace

Install Hex only when missing; review the installation prompt

mix local.hex --if-missing

Working directory: chosen local workspace; only if installer is missing or a deliberate update is needed

Install the Phoenix generator; select/record a compatible version according to project policy

mix archive.install hex phx_new

Working directory: chosen local workspace

Record the installed Phoenix generator version

mix phx.new --version

Working directory: chosen local workspace

Confirm installed options and defaults

mix help phx.new

Working directory: parent directory of the new my_app directory

Generate the Phoenix application, including LiveView and asset defaults

mix phx.new my_app --database postgres

Working directory: my_app project root, after inspecting the generated alias and configuring local database access

Run the generated setup alias

mix setup
  • LiveView is included by the normal Phoenix generator. Keep HTML and assets for this browser path.
  • Dependency installation is interactive by default; installed help documents --install and --no-install. These examples do not request a Git commit.
  • Use --no-agents-md only for an explicit repository instruction policy; preserve the generated guidance in its maintained README-linked owner when that policy requires it.

Phoenix JSON API application

Use when: The deliverable is an HTTP API with a separate client and does not need generated browser UI.

  1. Use the runtime, Hex, Phoenix archive and PostgreSQL prerequisite checks from the browser starting point.
  2. Generate into a new destination; configure the database, inspect the generated setup alias and run it from the project root.
  3. Select mailer, dashboard, Ecto and other omissions separately from actual requirements. Do not remove persistence simply because the interface is JSON.

Working directory: parent directory of the new my_app directory

Generate an API skeleton without HTML views or asset build tools

mix phx.new my_app --database postgres --no-html --no-assets
  • --no-html disables the generated LiveView setup; this is an alternative to the browser starting point.
  • --no-ecto changes what resource generators can provide. Use it only when the application truly does not need Ecto; inspect --no-context handling for later generators.
  • Browser authentication scaffolding is not an API-token or external identity implementation. Choose API authentication explicitly.

Plain Mix library or supervised OTP service

Use when: The project needs Elixir without a Phoenix web application. Choose the variant from process-lifecycle requirements.

  1. Verify compatible Elixir/Erlang and Mix; choose a new source destination. Replace my_library or my_service with the selected snake_case name.
  2. For a library with no owned supervision tree, use mix new. For an application that owns long-lived processes, use mix new --sup.
  3. Run only the selected creation command. Enter its generated directory, preserve its scaffold and implement application behavior after generation.

Working directory: chosen local workspace

Inspect installed Mix generator options

mix help new

Working directory: parent directory of the new my_library directory

Generate a plain Elixir project without an application callback/supervisor

mix new my_library

Working directory: parent directory of the new my_service directory

Alternative: generate an OTP application callback and supervision tree

mix new my_service --sup
  • --sup is conditional, not a universal Elixir requirement. Do not hand-write mix.exs, formatter, test helper or supervision boilerplate when Mix supplies the appropriate base.
  • Use --umbrella only for a justified multi-application boundary; do not introduce it as a default.

Conditional follow-up generators

Phoenix authentication

Use when: Application-owned browser accounts are required, after Phoenix setup.

Working directory: my_app project root (directory containing mix.exs)

Phoenix authentication

mix phx.gen.auth Accounts User users --live
  • Run mix help phx.gen.auth first; substitute the context/schema/table deliberately. --live selects LiveView views; --no-live is the controller-view alternative.
  • Follow the generated routing/configuration instructions, fetch new dependencies with mix deps.get, inspect migrations and apply them to the intended local database with mix ecto.migrate.
  • Review delivery, scope and authorization requirements. Generated email authentication assumes email-account ownership; preserve its token-revocation and confirmation safeguards when customizing.
  • Do not run multiple auth generators blindly: scopes and browser-pipeline assignments can conflict. Use external identity integration when that is the actual requirement.

LiveView resource

Use when: A new browser CRUD resource should follow Phoenix conventions.

Working directory: my_app project root (directory containing mix.exs)

LiveView resource

mix phx.gen.live Catalog Product products name:string
  • Example names/fields are substitutions, not a domain prescription. Run mix help phx.gen.live and decide context boundaries before generating.
  • This generates the context/schema/migration and LiveView files/tests. Apply the printed router changes and inspect/migrate the local database.
  • Preserve configured scope behavior and add permission/domain checks. --no-context implies --no-schema and leaves implementation work, including failing generated tests, to complete.
  • Use this or the other resource variants below; do not generate the same resource repeatedly with each variant.

Controller HTML resource

Use when: The resource uses conventional server-rendered controllers/templates rather than LiveView.

Working directory: my_app project root (directory containing mix.exs)

Controller HTML resource

mix phx.gen.html Catalog Product products name:string
  • Alternative to phx.gen.live, requiring the HTML components omitted by --no-html. Run installed task help first.
  • Review generated context, schema, migration, controller/templates and tests; complete the printed routing instructions and migration steps.

JSON API resource

Use when: The resource is exposed as JSON.

Working directory: my_app project root (directory containing mix.exs)

JSON API resource

mix phx.gen.json Catalog Product products name:string
  • Alternative to HTML/LiveView resource generation. Run installed task help; review generated controller/JSON rendering, context, schema, migration and tests.
  • Complete printed routing instructions and migrations. Add actual API authentication/authorization, validation and response-contract tests.

Domain context without web UI

Use when: The application needs a new domain resource/API boundary without generated HTTP or LiveView files.

Working directory: my_app project root (directory containing mix.exs)

Domain context without web UI

mix phx.gen.context Catalog Product products name:string
  • Run installed task help and review context boundaries. The generator adds schema, migration and context tests.
  • An existing context can be extended; inspect the merge prompt instead of blindly accepting it. Choose --no-schema only when intentionally supplying that implementation.

Ecto schema without context scaffolding

Use when: A schema and migration are needed within a deliberately maintained domain boundary.

Working directory: my_app project root (directory containing mix.exs)

Ecto schema without context scaffolding

mix phx.gen.schema Catalog.Product products name:string
  • Run installed task help; choose attribute types, references, ID strategy and table names explicitly.
  • Review changesets and migration constraints/indexes. This generator does not provide the enclosing context API or authorization.

Ecto migration

Use when: An existing persisted resource requires a schema change, without duplicating its resource generator.

Working directory: my_app project root (directory containing mix.exs)

Ecto migration

mix ecto.gen.migration add_product_status
  • Requires an Ecto repository configured under :ecto_repos, or choose it with --repo. Run installed task help before use.
  • Edit the generated timestamped migration; review reversibility, data and locking effects. Apply it to the intended local database, then test the changed behavior. Do not rewrite migrations already deployed to shared databases.

Phoenix release helpers

Use when: Release-based deployment has been selected.

Working directory: my_app project root (directory containing mix.exs)

Phoenix release helpers

mix phx.gen.release
  • Run installed task help first. Review migration/server scripts and runtime configuration before building the release.
  • Use --docker only when a container is required; inspect generated base-image/runtime versions and add any external asset package-manager steps.
  • Generation/build success does not prove deployment, migrations, backup/restore or runtime compatibility.

Preserve the generated foundation

  • Keep generated mix.exs aliases, .formatter.exs, tests/helpers, configuration, runtime supervision and project documentation as the starting base; make deliberate, reviewable changes rather than recreating the scaffold by hand.
  • Preserve the complete generated .gitignore and add project/platform entries such as .DS_Store as supplements. Do not claim every generator version already ignores macOS metadata.
  • Retain dependency lockfiles for application reproducibility according to repository policy. Keep credentials, build outputs and dependency caches out of commits.
  • Existing project conventions and maintained README-linked guidance remain authoritative; generator commands are for new projects or deliberate scoped additions, not destructive replacement.
  • Record the generator command, versions, selected switches and reasons for deviations with the project setup evidence.

Baseline and generation checks

  • Before generation, inspect installed mix help for each selected task and check the chosen runtime/generator requirements against installed versions; unversioned documentation can describe a newer release.
  • Inspect the generated files and pending repository diff, including hidden files. Check that formatter configuration, tests/helpers, ignore rules and required application supervision are present for the selected variant.
  • Run mix format --check-formatted, mix compile --warnings-as-errors and mix test from the generated project root after dependency/database setup. Repair failures in place and record actual results.
  • For Phoenix browser applications, run mix phx.server and inspect the actual local page and generated flows; for APIs, exercise the intended requests. A server process starting is not a completed interaction check.
  • Use git status --short --untracked-files=all and git check-ignore -v .DS_Store _build deps to review the selected ignore rules. In a disposable copy or separate index, inspect what staging all files would include; never alter the user index merely to test hygiene.
  • Confirm generated authentication/scopes and application operations reject unauthorized access; generated CRUD does not settle domain permissions.
  • This record is documentation-reviewed only. No application generator, setup command, database operation, test suite or release build was executed for this research.

Generation receipt

  • Component and selected starting point, or the documented absence of a full application generator
  • Generator/toolchain versions, exact commands or IDE template/settings, working directory and generated destination
  • Generated files retained, deliberate deviations with reasons, and required supplemental ignore rules
  • Baseline checks and later checks actually run, results and remaining prerequisites or untested behavior

Generator sources

Set up your project

  1. Complete the selected starting point and baseline checks in the Generators section first; then continue with the integration steps appropriate to the chosen component.
  2. After completing the selected starting point, read its generated README, mix.exs, mix.lock and runtime pins. Preserve the chosen plain Mix or Phoenix architecture; the following Phoenix integrations apply only when Phoenix is present.
  3. For a Phoenix application, inspect and complete the generated setup alias after configuring development/test database access. Keep credentials outside committed secrets; follow the generator output when a selected omission means an alias or integration is unavailable.
  4. If dependency guidance synchronization is useful, add usage_rules as a development dependency, choose the relevant dependency rules in mix.exs and review mix usage_rules.sync output. Preserve maintained generated guidance; an explicit README-only policy may configure a README-linked alternate file such as docs/dependency-rules.md.
  5. If Phoenix browser accounts are required, complete the authentication follow-up recipe, review its generated instructions and configure transactional email delivery. Keep local/test delivery adapters in their intended environments; verify scopes and permission checks for application operations.
  6. If durable background jobs are required, follow the installed Oban version’s installation and migration instructions, supervise Oban and configure bounded queues. Use supported persistence and idempotent workers; test retry and duplicate-effect handling. A Task is suitable only for explicitly disposable work.
  7. Add development and test checks selected for this project. Formatter, compiler warnings and ExUnit apply to plain Mix applications; Ecto SQL Sandbox, LiveViewTest, Sobelow and other Phoenix-specific checks require their corresponding dependencies and application architecture.
  8. For Phoenix applications that need real-browser verification, install/configure PhoenixTest.Playwright or the selected browser suite with its matching JavaScript dependency and browser binaries. Configure the test endpoint and SQL sandbox as documented; server-side LiveView tests do not establish browser JavaScript or visual correctness.
  9. Run the applicable verification commands and actual application flows, fixing failures in place and retaining evidence. Skip tools whose dependency was not selected rather than claiming their checks passed; do not regenerate over existing work to hide failures.
  10. For deployment qualification, select the intended host and runtime configuration. In Phoenix applications follow the release-helper recipe; build production assets only when the selected application has assets. Build a release compatible with the target OS, architecture and native dependencies.
  11. Before claiming production readiness, rehearse startup, migrations and any applicable reconnect/job-retry behavior on the selected host. Establish secrets, TLS, backups, restore and rollback ownership; a generated release or passing local tests do not establish those outcomes.
  12. Completion: record exact runtime/dependency versions, the application lockfile, selected generation/integration steps, check results and observed flows in README-linked evidence. State any untested deployment or native-mobile paths explicitly.

Recommended tools and agent brief

Choose the tools your application needs. The brief includes your selections, their purpose and their limits; the complete guide keeps all recommendations and sources.

Web application

Phoenix + its generated HTTP/asset defaults

Coherent routing, contexts and generated application structure.

Limits: Phoenix is unnecessary for a CLI or a service without HTTP; preserve existing architecture.

Dependency documentation and agent guidance

usage_rules for selected dependency guidance

Discover dependency documentation and synchronize selected upstream usage rules for agents

Limits: Development-only tool; inspect installed-version options and review generated content. Preserve Phoenix-generated guidance by default. An explicit README-only repository may configure file: "docs/dependency-rules.md" in mix.exs and link it from README; this destination is an optional project convention, not an upstream default.

Browser UI

LiveView + HEEx components

Shared server-side business operations and interactive screens suit connected forms, portals and collaboration.

Limits: Offline-first state, high-frequency local interactions and rich canvas editors can justify a dedicated client. LiveView does not remove HTML/CSS or all JavaScript.

Shared relational persistence

Ecto + PostgreSQL

Explicit queries, changesets and database transactions fit shared application data.

Limits: Changeset validation is not a replacement for database constraints or authorization; database operations and migrations need operational ownership. Current Ecto documentation deprecates Repo.transaction/2 in favor of Repo.transact/2. Follow the installed-version API and callback/result semantics; do not mechanically rename an existing transaction without tests.

Accounts and access control

phx.gen.auth + scoped context authorization

Generated first-party authentication keeps application-owned code; contexts authorize operations.

Limits: Check permission both on mount/navigation and each operation. Test revoked access and reconnect behavior; magic-link delivery needs a configured mail provider.

Durable background work

Oban with the existing Ecto/PostgreSQL database

Persist jobs and enqueue alongside domain changes in one transaction.

Limits: Task is only for explicitly disposable work and does not satisfy crash-durable delivery. Oban engine support and guarantees must be checked against the selected version; Redis is not a shipped Oban persistence engine. Oban Pro is an optional licensed extension, not a replacement for persistence.

Behavior and persistence tests

ExUnit + Ecto SQL Sandbox + LiveViewTest

Test contexts, data invariants, denied access and server-side UI behavior.

Limits: LiveViewTest does not establish browser JavaScript, accessibility or visual correctness. Inline/manual job tests are not a production recovery simulation.

Real-browser checks

PhoenixTest.Playwright for critical browser flows

Exercise hooks, navigation, reconnects and actual browser behavior omitted by server-side tests.

Limits: Adds Node/package-manager/browser binaries and sandbox configuration; verify supported wrapper features. It is an editorial extension, not a Phoenix generator default.

Code quality

Mix formatter and compiler warnings; Credo when selected

Fast local feedback plus consistency checks; select checks appropriate to project size.

Limits: Static analysis does not prove domain correctness. Dialyxir adds analysis/PLT maintenance and is not a mandatory starter dependency.

Security checks

Hex audit + Sobelow, alongside permission tests

Hex reports retired packages and known advisories; Sobelow finds common risky code patterns.

Limits: Use the installed Hex version’s behavior. Scan findings need review; configure a non-zero Sobelow exit threshold and do not blanket-suppress findings. Neither proves the application secure.

Deployment

Mix release + runtime configuration

Package application and runtime with explicit migration/server entry points.

Limits: Build for the target OS/architecture and native libraries. Host choice, secrets, migrations, TLS, backups, restore and rollback remain separate responsibilities.

Native mobile client boundary

Platform-native clients consuming Phoenix APIs

Preserve native UI/platform ownership while sharing server-side domain operations.

Limits: Do not advertise Elixir as a complete native mobile default: LiveView Native’s inspected README uses release-candidate dependencies and platform-specific clients. Validate target support, offline behavior, accessibility and signing independently.

Project instructions

README navigation + generated Phoenix agent guidance

Keep generated stack conventions available to coding agents

Limits: Preserve maintained repository rules; --no-agents-md is an optional project choice, not the Phoenix default.

Transactional email

Swoosh + selected provider adapter

Mailer adapters and test delivery fit generated Phoenix account flows

Limits: Configure adapter/client dependencies and sender credentials; keep test/local adapters in development only. Use Oban for required queued delivery; a Task has no durable retry guarantee.

Uploads

LiveView uploads

Built-in upload configuration and consumption fit connected forms

Limits: Configure allow_upload limits and authorize attachment association; persist consumed files before temp cleanup. External storage integration and content validation remain application work.

Realtime application events

Phoenix.PubSub

Local/distributed publication updates connected views and channels

Limits: Supervise PubSub and subscribe to scoped topics; authorize each subscription/action and test reconnect. PubSub is transient broadcast, not durable replay or a message queue.

Build with the stack’s strengths

Architecture and developer workflow.

Phoenix web modules call application contexts; Ecto supplies persistence boundaries. LiveView maintains connected server-side interaction, while Channels expose a client-facing realtime protocol. Recommendation: model domain operations through contexts and supervised responsibilities rather than translating every old controller, global singleton or database serialization bottleneck literally.

Version scope: Fetched documentation: Phoenix 1.8.15, LiveView 1.2.12, PubSub 2.4.1, Plug 1.20.3, Ecto 3.14.2 / Ecto SQL 3.14.0, Oban 2.24.1, Exq 0.25.0 and OTP 29.1.1 ETS. Installed dependency compatibility is unqualified; pin the actual application before using version-specific APIs. · Reviewed 2026-10-11 · Evidence: documentation-reviewed · Source: inputs/research/migrations-server.json

Architecture boundaries

  • Recommendation: contexts own business operations, Ecto Repo owns database access and explicit transactions join related writes. A single GenServer around all queries is an application choice, not a Phoenix requirement.
  • Phoenix PubSub has a distributed-Elixir adapter and a Redis adapter. Redis can remain appropriate when deployment or interoperability requires it. Recommendation: identify the required delivery boundary before selecting the topology.
  • Oban requires an Ecto-backed supported SQL engine. Its installation documents PostgreSQL, SQLite and MySQL; selecting PostgreSQL is this catalogue's target composition, not a universal Oban prerequisite. Recommendation: preserve durable external effects through idempotency and recovery checks.

Tools and feedback

  • For a disposable target, mix phx.new PATH generates a Phoenix application with selectable database and HTML/LiveView options. In an existing project, inspect mix.lock, generated modules and maintained conventions before regenerating anything.
  • When manually installing the selected Oban version, adapt mix ecto.gen.migration add_oban_jobs_table and mix ecto.migrate from its installation guide; configure the engine, Repo and supervised Oban child. Do not copy PostgreSQL settings into a SQLite or MySQL target.
  • Use mix test for application tests and the generated Phoenix connection/channel fixtures. Recommendation: add mixed-version payload, authorization and restart scenarios; a passing formatter or compiler does not establish those contracts.
  • For a release build, adapt MIX_ENV=prod mix assets.deploy and mix release from the Phoenix deployment workflow; runtime.exs owns runtime configuration. Recommendation: verify database migrations, job supervision and cluster/PubSub connectivity separately from HTTP startup.

Translations to avoid

  • Avoid replacing a durable queue with spawned tasks or an in-memory notification list while calling the change equivalent. Recommendation: explicitly accept the changed crash and retry behavior or retain a persistent queue.
  • Avoid treating Exq's Resque/Sidekiq-compatible transport format as proof that Ruby Active Job wrappers, classes and serializers execute in Elixir. The exact consumer and payload contract still needs qualification.
  • Avoid assuming Plug cookies decode Rails cookies: Plug exposes its own serializer, salts and cryptographic options. Avoid relying only on HTTP plugs for LiveView authorization; mount and events require checks.
  • Avoid using ETS as a shared session or global lock store. Tables are local to their node and normally disappear with their owner unless an heir takes ownership. Recommendation: reserve ETS for explicitly reconstructible local state.

For an existing application

Keep the contracts while you change the stack.

These are documented options and proposed checks. Inspect the actual source application before adopting a transition.

Data and schema

Inspect the source

Inventory schema, constraints, record identifiers and callbacks previously triggered by writes. Ecto schemas and changesets must preserve the intended domain semantics, not simply the old table shapes.

During coexistence

Recommendation: keep the source application as the authoritative writer while Phoenix contexts read fixtures; move a tenant or domain operation with one named writer. Use additive schema changes and a single migration runner during shared-table operation.

Target design

Contexts calling Ecto Repo with explicit validation and transaction boundaries. Ecto.Multi composes related Repo operations in one database transaction; cross-store side effects require a separate delivery design.

Rollback

Recommendation: return the domain writer to the source while preserving additive schema and reconciling accepted new writes; delay destructive contractions until the rollback window closes.

Benefits and prerequisites

Recommendation: a context boundary can expose one reusable domain operation to LiveView, controllers and workers.
Requires: Resource authorization, constraints and side effects moved with that operation.
Tradeoffs: Shared-schema coexistence limits schema changes; external effects do not become part of a database transaction.

Checks before transfer

  • Write a fixture through each allowed writer and read it from both runtimes; compare IDs, enum/null values, timestamps and constraint failures.
  • Fail the second operation in an Ecto.Multi and verify the first database operation is absent; prove old readers still accept successful new writes.
Jobs and schedules: Retain Ruby workers behind an interface

Inspect the source

Rails workers currently own Ruby job execution, including Active Job/GlobalID serializers and backend retry/scheduling behavior. Record the actual Redis-backed backend and every backlog state rather than inferring it from the word Rails.

During coexistence

Recommendation, retain/wrap path: keep Ruby workers and their broker; expose a narrow producer endpoint or durable outbox relay for Phoenix. Ruby remains the only consumer and scheduler for retained categories, and the interface names payload version, business idempotency key and enqueue acknowledgement.

Target design

Phoenix web/domain code with retained Ruby worker ownership is a valid permanent composition when queue interoperability or Ruby libraries remain necessary.

Rollback

Recommendation: restore the old web producer while retaining the same workers; reconcile accepted interface/outbox entries before disabling the relay.

Benefits and prerequisites

Recommendation: the web layer can transfer before job execution without transforming the old backlog.
Requires: Defined producer interface, monitored delivery and retained worker deployment.
Tradeoffs: Two runtimes and the broker remain operated; domain write plus broker enqueue is not a shared SQL transaction.

Checks before transfer

  • Submit a captured serializer/GlobalID case through the interface and confirm the intended Ruby class executes with its normal failure policy.
  • Interrupt delivery after domain commit; recover it without duplicating a business effect. Verify only the Ruby scheduler owns the retained category.
Jobs and schedules: Keep Redis and qualify Exq consumers

Inspect the source

A retained Redis broker may carry Sidekiq/Resque-shaped jobs; framework wrappers, class names, serializer tags and version-sensitive timestamps are still part of the execution contract.

During coexistence

Recommendation, broker-retaining replacement path: qualify Exq for selected job types on isolated queues. Keep unsupported Ruby types on Ruby consumers; map only deliberately supported payload versions, and give each category one consumer family and schedule owner.

Target design

Selected Elixir workers using Exq's documented Redis-backed Resque/Sidekiq-compatible format. This is a candidate for qualification, not a claim that arbitrary Active Job payloads are interoperable.

Rollback

Recommendation: stop new consumption and return only backward-readable queued work to Ruby; preserve both consumers for payloads accepted during the transition.

Benefits and prerequisites

Recommendation: selected job execution can move to Elixir while preserving the broker boundary.
Requires: Fixture-tested serialization, queue isolation, retry mapping and scheduler ownership.
Tradeoffs: Redis remains; compatibility and unsupported Ruby argument types require explicit maintenance.

Checks before transfer

  • Replay ordinary arguments, an Active Job wrapper, serializer edge cases and scheduled/retry payloads; reject unsupported cases without consuming them silently.
  • Crash after a business effect before acknowledgement and verify replay safety; confirm old and new consumers never race for an unqualified category.
Jobs and schedules: Run Oban SQL workers alongside legacy queues

Inspect the source

Legacy Redis jobs and a proposed SQL queue have distinct payload/storage formats and retry/schedule state. A backend change does not copy the backlog or the recurring schedule.

During coexistence

Recommendation, SQL replacement path: run Oban alongside the legacy broker and route selected categories exclusively to one system. Keep old ready, retry, delayed, failed and running work accounted for. Transfer each schedule once; use a recoverable relay/outbox while domain data and queue insertion span stores.

Target design

Oban workers on the chosen supported SQL engine. With the same Repo/transaction, Oban.insert in Ecto.Multi can join domain changes; a separate database cannot gain that atomicity merely from both databases being SQL.

Rollback

Recommendation: pause new producers/consumption, keep accepted Oban payloads executable, and reconcile effects before moving routing back. Do not blindly copy all rows into the old broker.

Benefits and prerequisites

Atomic domain-write-and-job-insert is available within a shared transaction.
Requires: One supported database transaction/Repo for both writes and business idempotency for execution.
Tradeoffs: Queue load shares the database; SQL atomic insertion does not guarantee exactly-once external effects.

Recommendation: broker retirement can reduce the operated service inventory.
Requires: All Redis uses transferred, all backlog states reconciled and recovery/rollback checks passed.
Tradeoffs: Redis plus SQL coexistence temporarily adds operational work; no service reduction occurs while Redis remains needed.

Checks before transfer

  • Rollback the combined transaction and confirm neither domain change nor executable Oban job remains.
  • Pause a selected Oban queue, reconcile running work and inspect retained backlog; resume without duplicated effects.
  • Restart during a job and validate the selected engine's configured recovery policy, including a failure after an external side effect.
Identity and authorization

Inspect the source

Record old cookie encoding, serializer, keys/salts, expiration and session revocation; shared account IDs alone do not establish cookie compatibility. Plug COOKIE defaults its serializer to external_term_format and exposes rotating cryptographic options.

During coexistence

Recommendation: retain the existing identity authority through a qualified session exchange or compatibility decoder. Map authorization rules into Phoenix contexts and LiveView mount/events; keep account and revocation ownership explicit.

Target design

Phoenix identity with the selected session store and LiveView authorization in mount/on_mount and actions. Recommendation: choose planned reauthentication when cookie compatibility is not worth maintaining.

Rollback

Recommendation: retain the old decoder/exchange until routing can return; never reverse revocation merely to restore traffic.

Benefits and prerequisites

Recommendation: users can preserve access while a connected feature moves.
Requires: Qualified decoder/exchange, shared revocation and event-level authorization.
Tradeoffs: Long-lived sockets need explicit disconnect/recheck behavior when access changes; sharing secrets alone is insufficient.

Checks before transfer

  • Login through the old runtime, access the target feature, revoke the account/session and confirm HTTP plus existing/reconnected LiveView access follows the required policy.
  • Send a forged delete event for another tenant despite a hidden UI control; confirm the server rejects it.
Realtime transport

Inspect the source

Action Cable, Phoenix Channels and LiveView are different protocols. Capture subscription identity, event envelope, authorization, ordering and missed-message recovery. Channels documents at-most-once client delivery without server persistence.

During coexistence

Recommendation: retain old client endpoints and bridge versioned domain events into each renderer. A room/tenant cohort owns its subscriptions and reconnects. Choose Redis PubSub or a qualified distributed-Elixir cluster deliberately; sharing Redis does not translate the wire protocol.

Target design

LiveView for connected server-owned screens or Channels for explicit realtime clients, with durable domain state and an application catch-up mechanism when missed events matter.

Rollback

Recommendation: preserve the old endpoint/event envelope and cohort routing through reconnects; rebuild UI from persisted state instead of duplicating broadcasts.

Benefits and prerequisites

Recommendation: connected UI and domain operations can share Phoenix contexts.
Requires: Authorized subscriptions, working multi-node fanout and persisted state/cursors for recovery requirements.
Tradeoffs: Live protocol/client changes and cluster operations remain; PubSub does not supply a durable user-message history.

Checks before transfer

  • Place old/new subscribers on separate nodes; commit through either permitted path and verify every authorized recipient converges once.
  • Disconnect before an event, restart a node, reconnect with the chosen cursor/state mechanism and verify missed domain changes recover; test revocation while connected.
Caching and shared state

Inspect the source

Classify every Redis use as cache, session, limiter, lock, job or PubSub. ETS tables are node-local and their ownership lifetime matters; they do not provide Redis's cross-node boundary.

During coexistence

Recommendation: move only reconstructible cache entries into supervised local ownership, with explicit TTL/invalidation and bounded memory. Keep shared identity, coordination, queues and broadcast infrastructure until their own transitions qualify.

Target design

ETS for deliberately local reconstructed values, or a retained shared cache where consistency across nodes is required. Recommendation: state stale-read tolerance and rebuilding behavior in the application contract.

Rollback

Recommendation: switch those reads back to the qualified shared store or authoritative data; retain Redis until every remaining capability is reconciled.

Benefits and prerequisites

Recommendation: a local cache can remove a remote dependency from selected reads.
Requires: Acceptable node-local semantics, bounded memory and verified invalidation/rebuild behavior.
Tradeoffs: Each node maintains separate contents; owner/node failure loses local state. Performance benefit requires measurement.

Checks before transfer

  • Warm two nodes, update the authoritative record and verify their documented staleness/invalidation policy.
  • Terminate the table owner or restart the node; verify the application rebuilds and no durable job/session/lock state was stored there.
Delivery and recovery

Inspect the source

Record endpoint, worker, scheduler, Repo, assets and cluster/PubSub ownership. Phoenix runtime configuration, release build and schema migrations have distinct deployment steps.

During coexistence

Recommendation: maintain both releases with stable cohort routing and a single schedule/writer owner per responsibility. Monitor queue age, retry effects, node connectivity and authorization failures against application-specific promotion thresholds.

Target design

A Phoenix release with runtime.exs configuration, built assets, named migration runner and supervised workers. Recommendation: make cluster formation, backups and restore ordering explicit instead of assuming VM startup establishes them.

Rollback

Recommendation: retain the previous release and compatible database reads; return cohort routing and role ownership separately, reconciling new jobs and external effects.

Benefits and prerequisites

Recommendation: explicit supervised roles and release inputs make restart behavior reviewable.
Requires: Configured children, deployment inventory and exercised recovery procedures.
Tradeoffs: Durable recovery still depends on the chosen databases/queues; supervision alone cannot recreate lost external state.

Checks before transfer

  • Start the actual release with a disposable restored database and confirm assets, authenticated routes, a queued job and cross-node broadcast work.
  • Stop a worker/node, observe detection and recovery, and verify no second schedule owner activates during rollback.

Read the migration workflow →

Run checks

Run these in the configured application. They are instructions, not recorded passes.

mix hex.audit
mix format --check-formatted
mix compile --warnings-as-errors
mix test
mix credo --strict  # only after installing/configuring Credo
mix sobelow --strict --exit low  # only after installing/configuring Sobelow; review findings
mix dialyzer  # optional, after Dialyxir/PLT configuration
mix phx.server  # interactive smoke check, not an automated assertion
MIX_ENV=prod mix assets.deploy  # release qualification, after production prerequisites
MIX_ENV=prod mix release  # after release configuration; not deployment proof

Working practices

  • Keep business operations in contexts shared by controllers, LiveViews and workers. Contexts are not automatically processes.
  • Enforce authorization on every protected operation, including direct context calls and after access is revoked.
  • Use ordinary functions first. Add processes for state ownership or lifecycle; add durable storage for work that must survive a restart.
  • Give retried external effects stable idempotency keys. Exercise reconnects, failed jobs and cross-account access.

Questions to resolve

  • Does the product fit connected server-owned UI, or need a separate offline/native client?
  • Which account/tenant permissions and email recovery requirements apply?
  • Which work needs durable retries and duplicate-effect protection?
  • Which host, object storage, observability and backup/restore requirements apply?

Sources

Original source review: 2026-10-10. Core guidance rechecked: 2026-10-13. Check scope.

Extended Elixir reference

The full Markdown and JSON include the attributed Elixir Menu optional libraries, runtime and other application paths. Read the maintained Elixir Menu reference →