Aaron Weiker 4ea9a884aa docs: idiomatic Elixir and Phoenix patterns with source citations
Extracted patterns, conventions, and code smells directly from the
Elixir and Phoenix source code with file path and line number citations.

Covers: GenServer, error handling, data transforms, process design,
testing, documentation, typespecs, macros, behaviours, module organization,
Phoenix-specific patterns, framework deviations, and anti-patterns.
2026-04-29 22:50:12 -07:00

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: main branch (cloned 2026-04-29)
  • Phoenix: main branch (cloned 2026-04-29)

Structure

Core Patterns (patterns/)

  • GenServer Patterns — Client/server separation, callbacks, state design
  • Error Handling — Error tuples, raise vs return, with chains
  • 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/)

Comparison (comparison/)

Code Smells (smells/)

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:

  1. The pattern name
  2. The exact file path and line range
  3. Why it matters
  4. What the anti-pattern looks like
S
Description
Idiomatic Elixir and Phoenix patterns extracted from source code with file path + line number citations
Readme MIT 359 KiB
Languages
Markdown 100%