library(shiny)
library(bslib)
library(modBrowse)
ui <- bslib::page_fluid(
modBrowseUI("browse")
)
server <- function(input, output, session) {
r <- reactiveValues(
artist = "746b8207-72f5-4ab6-8d19-a91d03daec3d"
)
observe({
r$appdata <- artutils::get_appdata(r$artist, r$artwork)
})
modBrowseServer("browse", r)
}
shinyApp(ui, server)Introduction
modBrowse is a Shiny UI module for the Artalytics platform that provides interactive collection browsing with artwork cards, filtering, sorting, and statistics display. It enables platform users to explore an artist’s portfolio organized by collections.
What modBrowse Delivers to Users
For platform end users (collectors, galleries, art enthusiasts), modBrowse provides:
- Collection Navigation: Browse artworks organized into thematic collections
- Visual Discovery: Thumbnail grid of artwork cards with quick identification of NFT status, new pieces, and variants
- Flexible Filtering: Find specific artworks by NFT backing, prints available, sale status, or variant availability
- Sorting Options: Order by creation date, brush strokes, or drawing time
- Collection Statistics: Understand collection scope through aggregated metrics (total pieces, hours invested, stroke counts)
Module, Not App
modBrowse is a module package, not a standalone application. It requires:
- Parent app infrastructure from
appPlatform - Reactive data context with artist/artwork UUIDs
- Dependencies like {artutils} and {artcore} for data access
For standalone testing during development, use run_app() with a known artist UUID.
Ecosystem Position
appPlatform (main Shiny app)
|
modBrowse, modGallery, modFrames, ... (Shiny modules)
|
artutils (data access layer)
|
artcore (infrastructure: DB, CDN)
modBrowse sits alongside other module packages (modGallery, modFrames) as a self-contained UI component. It communicates with the parent app through reactive values, never directly with other modules.
Quick Start
Installation
# Requires GITHUB_PAT for private repo access
pak::pkg_install("artalytics/modBrowse")Basic Integration
Add modBrowse to your Shiny app:
Standalone Testing
For development and testing without full platform setup:
# Launch standalone browse app
modBrowse::run_app(artist = "746b8207-72f5-4ab6-8d19-a91d03daec3d")Environment Variables
modBrowse inherits environment variables from its dependencies. Set these before running the module.
Database (via {artcore}):
-
ART_PGHOST- PostgreSQL host -
ART_PGPORT- PostgreSQL port (default: 5432) -
ART_PGUSER- Database user -
ART_PGPASS- Database password
CDN (via {artcore}):
-
ART_BUCKETS_KEY_ID- DigitalOcean Spaces key ID -
ART_BUCKETS_KEY_SECRET- Spaces secret key
See {artcore} documentation for complete environment configuration.
Reactive Data Structure
The r parameter passed to modBrowseServer() must contain:
r <- reactiveValues(
artist = "746bxxxx-...", # Artist UUID (set by parent app)
artwork = "99xxxxxx-...", # Artwork UUID (updated by module on card click)
appdata = list( # From artutils::get_appdata()
artist = list(
info = list(...), # Artist profile data
stats = list(...), # Artist-level statistics
collections = c( # Named vector: name -> UUID
"Landscapes" = "uuid1",
"Portraits" = "uuid2"
),
artDT = data.table( # All artworks with metadata
art_uuid = character(),
art_title = character(),
collection_uuid = character(),
collection_name = character(),
is_nft = logical(),
n_variants = integer(),
brush_strokes = numeric(),
drawing_hours = numeric(),
created_utc = POSIXct(),
...
)
)
)
)The appdata structure is automatically populated by artutils::get_appdata(). The module reads from this structure and updates r$artwork when a user clicks an artwork card.
Key Components
Main Module Functions
-
modBrowseUI(id)- Creates the browse interface (collection selector, filters, cards) -
modBrowseServer(id, r)- Handles filtering, sorting, and card click events
Statistics Display
-
enhancedStatsUI()/enhancedStatsServer()- Premium value boxes for metrics -
collectionInfoUI()/collectionInfoServer()- Alternative summary layout
Helpers
-
artDisplayCard()- Individual artwork card with badges -
createCollectionLabelBadge()- Truncated collection name with tooltip
Theming
-
modBrowse_theme()- Bootstrap 5 theme for standalone testing
Next Steps
- Developer Guide - Full integration workflow and customization
- Module Architecture - Internal design and extension points
- Function Reference - Complete API documentation
For questions and issues, visit the GitHub repository.
