2e7a822b6b3b0a879e266ffbc9f254b1accd2b1d
Extracted patterns from Elixir core and Phoenix source code with specific file:line citations, then verified all citations against the actual source in a second pass. Structure: - patterns/ — Elixir core patterns (GenServer, errors, data, types, etc.) - phoenix/ — Phoenix-specific patterns and deviations - comparison/ — Elixir vs Phoenix side-by-side - smells/ — Anti-patterns and common mistakes - changelog/ — Daily Elixir/Phoenix PR digest (auto-updated)
Idiomatic Elixir & Phoenix Patterns
Patterns, conventions, and code smells extracted directly from the Elixir and Phoenix source code — with citations to specific files and line numbers.
This is not opinion. This is what the source actually does.
Source Versions
- Elixir:
mainbranch (cloned 2026-04-29) - Phoenix:
mainbranch (cloned 2026-04-29)
Structure
Core Patterns (patterns/)
- GenServer Patterns — Client/server separation, callbacks, state design
- Error Handling — Error tuples, raise vs return,
withchains - Data Transforms — Pipelines, Enum/Stream idioms, reduce patterns
- Process Design — Supervision trees, process lifecycle, naming
- Testing — ExUnit patterns, assertions, test organization
- Documentation — @moduledoc, @doc, @spec conventions
- Typespecs — Type definitions, opaque types, when to use what
- Macros — Macro patterns, hygiene, compile-time work
- Behaviours — Behaviour design, callbacks, optional callbacks
- Modules — Module organization, naming, structure
Phoenix Patterns (phoenix/)
- Phoenix Patterns — Endpoint, Router, Controller, Channel, PubSub
- Phoenix Deviations — Where Phoenix differs from Elixir core
Comparison (comparison/)
- Elixir vs Phoenix — Side-by-side comparison of approaches
Code Smells (smells/)
- Anti-Patterns — Things the source avoids and why
- Common Mistakes — What "bad Elixir" looks like
Philosophy
Every pattern here is backed by a source citation. If a pattern can't point to where the Elixir or Phoenix team actually does it, it doesn't belong here.
Contributing
Found a pattern worth adding? Open a PR with:
- The pattern name
- The exact file path and line range
- Why it matters
- What the anti-pattern looks like
Languages
Markdown
100%