Complete documentation for the Crucible UI composable experiment dashboard library.
- README.md - Main documentation, quick start guide
- CHANGELOG.md - Version history and migration guides
- Example App - Comprehensive integration examples
The Crucible.UI.Backend behaviour is the heart of the composable architecture.
Module: lib/crucible/ui/backend.ex
Required Callbacks: 15 total
- 8 for experiment management
- 4 for run management
- 3 for telemetry and statistics
Optional Callbacks: 1
pubsub_topic/2- Custom PubSub topic names
Documentation:
- Full behaviour specification: See Backend module docs
- Complete implementation example: See README.md
- In-memory backend example: See example/backend_example.ex
Module: lib/crucible/ui/router.ex
Macro: experiment_routes/2
Options:
:backend(required) - Module implementingCrucible.UI.Backend:on_mount- LiveView authentication hooks:root_layout- Layout tuple:telemetry_prefix- Telemetry event prefix:pubsub- PubSub module
Routes Created:
GET /- DashboardGET /experiments- Experiment listGET /experiments/:id- Experiment detailsGET /runs/:id- Run detailsGET /statistics- StatisticsGET /ensemble- Ensemble votingGET /hedging- Request hedging
Examples: See example/router_example.ex
Module: lib/crucible/ui/components.ex
Total Components: 12
header/1- Page headers with subtitle and actionsback/1- Back navigation links
stat_card/1- Metric display cardsstatus_badge/1- Status indicators (5 states)list/1- Definition liststable/1- Data tables with streaming support
button/1- Action buttonsmodal/1- Modal dialogs
icon/1- Heroicons
Plus inherited from Phoenix.Component:
link/1,input/1,error/1
Documentation:
- Component catalog: See README.md
- Module documentation: See Components module
- Usage examples: See example/custom_live_example.ex
All LiveViews are host-agnostic and located in lib/crucible/ui/live/:
-
DashboardLive - System overview with stats
- Real-time updates via PubSub
- Aggregated metrics
- Recent experiments and runs
-
ExperimentListLive - Experiment index
- Streaming support
- Create/delete operations
- Status filtering
-
ExperimentShowLive - Experiment details
- Run management
- Start/complete actions
- Real-time run updates
-
RunShowLive - Run details
- Real-time telemetry streaming
- Metrics and hyperparameters
- Event history
- StatisticsLive - Statistics visualization (placeholder)
- EnsembleLive - Ensemble voting (placeholder)
- HedgingLive - Request hedging (placeholder)
Features:
- Backend dependency injection
- PubSub real-time updates
- Support for both Ecto structs and plain maps
- Comprehensive error handling
Module: lib/crucible_ui/default_backend.ex
The default backend wraps existing CrucibleUI contexts for backward compatibility.
Purpose: Allows the CrucibleUI standalone app to work with the new composable architecture.
PubSub Topics:
experiments:listruns:listexperiment:{id}experiment:{id}:runsrun:{id}run:{id}:telemetry
The example/ directory contains:
-
backend_example.ex - In-memory backend implementation
- Uses ETS tables
- No database required
- Includes seed data
- Perfect for testing
-
router_example.ex - 7 router configuration examples
- Basic mounting
- Authentication
- Custom layouts
- Multiple backends
- Nested routes
- Custom PubSub
- Full configuration
-
custom_live_example.ex - 5 LiveView examples
- Custom dashboard
- Experiment list
- Experiment details
- Modal usage
- Combined components
See README.md for:
- Using the default backend
- Custom integration
- CNS UI integration example
From v0.1.x to v0.2.0: See CHANGELOG.md
- Router: Use
experiment_routes/2macro - Components: Import from
Crucible.UI.Components - LiveViews: Use composable LiveViews
- Backend: Implement
Crucible.UI.Backendbehaviour
- Database schema
- Context modules
- REST API
- Telemetry events
- PubSub messages
All public functions have @spec annotations:
- Backend behaviour: Full type specifications for all 15 callbacks
- DefaultBackend: Complete
@speccoverage - Components: Attribute specifications via
attr/2andslot/2
- Host-Agnostic - No app-specific dependencies
- Dependency Injection - Backend passed via session
- Type Safety - Comprehensive behaviours and typespecs
- Real-time - PubSub integration throughout
- Flexible - Accepts both Ecto structs and plain maps
Test Coverage: 93 tests, 0 failures
Quality Gates:
mix compile --warnings-as-errors # ✓ Passes
mix format --check-formatted # ✓ Passes
mix test # ✓ 93 tests, 0 failures
mix dialyzer # ✓ 4 minor warnings (acceptable)# Install dependencies
mix deps.get
# Setup database
mix ecto.setup
# Run tests
mix test
# Run server
mix phx.server
# Quality checks
mix compile --warnings-as-errors
mix format --check-formatted
mix credo --strict
mix dialyzerSee README.md for contribution guidelines.
MIT License - see LICENSE for details.
- GitHub Issues: https://github.com/North-Shore-AI/crucible_ui/issues
- Main Project: https://github.com/North-Shore-AI
- Documentation: This file and README.md