phoenix-liveview-auth

Installation
SKILL.md

Phoenix LiveView Authentication

Use this skill before writing ANY on_mount hook or LiveView auth code.

Requires phoenix-scopes for Scope struct setup. See phoenix-authorization-patterns for access control after authentication, and phoenix-liveview-essentials before writing any LiveView module.

Canonical FP bar: docs/fcis-engineering-rules.mdFunctional Core, Imperative Shell: pure domain modules; side effects at edges. Authorization decisions should be pure checks on scope/user data; persist only at the edge.

RULES — Follow these with no exceptions

1. Use on_mount callbacks — never check auth in mount/3 directly 2. :halt must redirect with a flash message — never silently drop the connection 3. Define on_mount hooks once, reference via live_session in router — never duplicate auth logic across LiveView modules 4. Resolve import conflicts with import Phoenix.Controller, except: [redirect: 2, put_flash: 3] — so LiveView's redirect/2 and put_flash/3 take precedence 5. Use bracket access assigns[:current_scope] in templates that can render unauthenticated — never @current_scope directly (raises KeyError) 6. Add @impl true to every LiveView callback — including a mount/3 that reads socket.assigns.current_scope.user

Installs
9
GitHub Stars
1
First Seen
Jun 20, 2026
phoenix-liveview-auth — igmarin/elixir-phoenix-skills