estack-liveview
LiveView patterns
Inspect installed Phoenix/LiveView versions, generated components, auth hooks, and styling before editing. Preserve daisyUI, custom Tailwind components, or another established design system. Do not migrate dependencies merely to follow an example.
Authentication and layouts
Use the appropriate existing live_session and on_mount hook. Create another session when distinct authentication requirements or root layouts justify the boundary. Check both HTTP and connected mounts; never start duplicate external side effects from mount.
Use @current_scope.user where the app has Phoenix scope-based auth. Preserve @current_user in older/custom auth until a scoped migration is requested. Pass the corresponding scope/user contract to contexts consistently.
Authorize page access, navigation, and mutating events. Recheck permissions/state at the domain boundary; hidden buttons and earlier mount checks do not authorize a later write.
Use the layout structure already generated for this Phoenix version. In Phoenix 1.8-style apps, render through Layouts.app and avoid duplicating the layout's flash group.
Forms
Assign a Phoenix.HTML.Form with to_form, then reuse the project's form/input components. This is an illustrative HEEx fragment: