Clarity (Clarity v0.4.0)
View Source⚠️ Alpha Notice: Clarity is currently in an alpha state. APIs and features may change rapidly, and things may break. Feedback and contributions are very welcome!
Clarity is an interactive introspection and visualization tool for Elixir projects.
It automatically discovers and visualizes applications, domains, resources,
modules, and their relationships, giving you a navigable graph interface
enriched with diagrams, tooltips, and documentation.

Features
- 📊 Graph navigation – explore your application structure visually.
- 🗂 Extensible introspection – support for Ash domains/resources, Phoenix endpoints, Ecto repos, and more.
- 🖼 Mermaid & Graphviz diagrams – ER diagrams, class diagrams, and policy diagrams where available.
- 📝 Markdown rendering – show documentation from moduledocs and resource definitions.
- 🔎 Interactive tooltips – quick overviews of vertices and edges.
- ⚡ LiveView-powered – fully dynamic, real-time updates in the browser.
- 🔌 Custom extensions – add your own introspectors to visualize domain-specific concepts.
Third-Party Libraries
Third-party libraries can add custom content to Clarity, extending its
visualization capabilities. To install any of these libraries, simply add them
to your mix.exs dependencies.
- ash_diagram – Provides mermaid diagrams for Ash
Installation
Igniter
mix igniter.install clarity
Manual
The package can be installed by adding clarity to your list of dependencies
in mix.exs:
def deps do
[
{:clarity, "~> 0.1.0"}
]
endRouter:
import Clarity.Router
clarity("/clarity")License
Copyright 2025 Alembic Pty Ltd
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Summary
Functions
Get current clarity state.
Start introspection process.
Subscribe to clarity events. Returns an unsubscribe function.
Types
@type event() :: :work_started | :work_completed | {:work_progress, queue_info()} | :__restart_pulling__
:work_started- Emitted when work starts:work_completed- Emitted when all work is completed{:work_progress, queue_info()}- Emitted periodically with current queue info
Topics starting with :__ are internal.
@type queue_info() :: %{ future_queue: non_neg_integer(), requeue_queue: non_neg_integer(), in_progress: non_neg_integer(), total_vertices: non_neg_integer() }
@type status() :: :working | :done
@type subscription_topic() ::
:work_started | :work_completed | :work_progress | :__restart_pulling__
:work_started- Emitted when work starts:work_completed- Emitted when all work is completed:work_progress- Emitted periodically with current queue info
Topics starting with :__ are internal.
@type t() :: %Clarity{ graph: Clarity.Graph.t(), queue_info: queue_info(), status: status() }
@type unsubscribe() :: (-> :ok)
Functions
@spec get(GenServer.server(), :partial | :complete) :: t()
Get current clarity state.
For :partial mode, returns the current state immediately.
For :complete mode, waits for all work to complete before returning the final state.
@spec introspect( GenServer.server(), :full | {:incremental, Application.app(), modules_diff()} | [module()] ) :: :ok
Start introspection process.
Options
:full- Full introspection, clears graph and re-introspects everything{:incremental, app, modules_diff}- Incremental introspection based on module changes for specific app[module()]- Introspect specific modules (legacy support)
@spec subscribe( GenServer.server(), subscription_topic() | [subscription_topic()], reference() | nil ) :: unsubscribe()
Subscribe to clarity events. Returns an unsubscribe function.
Examples
# Subscribe to specific events only
unsubscribe = Clarity.subscribe([:work_started, :work_completed])
# Unsubscribe later
unsubscribe.()