$ show tfwright/live_admin
LiveAdmin is an admin UI library for Phoenix applications built on Phoenix LiveView and Ecto. It provides a customizable administrative interface for managing application data with features like resource-based views (index, show, create, edit), custom actions and tasks, multi-tenancy support via Ecto prefixes, persistent user sessions, notifications via Phoenix.PubSub, and internationalization via Gettext. The architecture follows a modular design with clear separation of concerns between routing, resource management, components, and session handling. Key entry points include the LiveAdmin.Router.live_admin/3 macro for defining admin routes and LiveAdmin.Resource.__using__/1 for defining admin resources. The system relies on external dependencies including Phoenix, Phoenix LiveView, Ecto, Gettext, and Nimble Options for configuration validation.
The LLM identified 3 files worth highlighting for reuse:
Defines a behaviour for session storage that abstracts the session persistence mechanism. This component demonstrates excellent use of Elixir behaviours to create a pluggable architecture where different session storage implementations (like the built-in Agent or a custom Redis store) can be swapped without changing dependent code. It's completely isolated with no implementation details, making it trivial to extract and reuse in any Elixir project needing session management abstraction.
Provides a clean abstraction layer over Phoenix.PubSub specifically for LiveAdmin events. It encapsulates the publishing and subscription logic for two event types: :job (for progress tracking) and :announce (for UI notifications). The component demonstrates non-obvious skill by creating a focused, well-documented interface that hides the complexity of topic scoping while maintaining flexibility. It could be extracted to another project with minimal changes (primarily renaming the module) and would provide immediate value for any application needing structured pubsub event handling.
Contains helper functions for generating inline form error messages with proper Phoenix LiveView integration. The error_tag/2 function creates span elements with appropriate error styling and attaches the necessary phx_feedback_for attribute for LiveView's form handling. This component shows expertise in solving a common problem (form error display) in a way that integrates seamlessly with Phoenix's lifecycle. It's highly reusable as it only depends on standard Phoenix form helpers and could be dropped into any Phoenix project to improve form UX with minimal effort.