phoenix

Phoenix

Productive web framework for Elixir with real-time capabilities

Elixir
framework
Default
Used by 67 projects

Details

Language / Topic
elixirElixir
Category
framework
Compatible Frameworks
phoenix

Rules

balanced
- Use Phoenix contexts (bounded modules) to organize business logic — controllers should delegate to context functions, not contain logic.
- Use `Phoenix.LiveView` for real-time UIs — define `mount/3`, `handle_event/3`, and `render/1` callbacks for reactive pages.
- Use Ecto changesets in context functions for validation — never validate directly in controllers or LiveView handlers.
- Use `Phoenix.PubSub` for real-time event broadcasting — subscribe in LiveView `mount/3` and handle in `handle_info/2`.
- Structure code as: `lib/app_web/` for web layer, `lib/app/` for business logic (contexts).
- Use Ecto changesets for all data validation. Validate in the context, not the controller.
- Use `Phoenix.Component` with function components and slots for reusable UI.
- Use PubSub for real-time broadcasting between LiveView processes.