# projectblacklight/blacklight architecture

> Architecture diagram of the GitHub repository projectblacklight/blacklight, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/projectblacklight/blacklight
- Repository: https://github.com/projectblacklight/blacklight

## Overview

- [Web Browser] ←→ [Rails Asset Pipeline]
- ↕
- [Controllers] ←→ [ViewComponents]
- ↕
- [Search Service] ←→ [Search Builder]
- ↕
- [Solr Repository] ←→ [Apache Solr]
- ↕
- [Database]

##### Subsystems

a. Component Architecture
- [Base Components]
- Document Components
- Facet Components
- Search Components
- System Components

b. Configuration System
- [Configuration]
- Field Configuration
- Facet Configuration
- Search Configuration
- View Configuration

- Browser → Controller → SearchService → SearchBuilder → Solr → Response
- Browser → Controller → SolrDocument → Repository → Solr

##### Important Implementation Details

- ViewComponent-based UI elements
- Solr integration points
- Configuration injection points
- Extension/plugin points

##### Additional Notes

- Version compatibility (Ruby 3.1+, Rails 6.1+)
- Modern browser requirement
- Asset compilation pipeline
- I18n integration points

- Clear hierarchical relationships
- Nested grouping for subsystems
- Text annotations for important details

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Web Layer"
        Browser["Web Browser"]
        AssetPipeline["Rails Asset Pipeline"]:::asset
        Controllers["Controllers"]:::controller
        ViewComponents["ViewComponents"]:::component
        Views["Views (ERB)"]:::view
    end

    subgraph "Application Core"
        Models["Models"]:::model
        Presenters["Presenters"]:::presenter
        Services["Services"]:::service
        Builders["Builders"]:::builder
    end

    subgraph "Search Infrastructure"
        SolrRepo["Solr Repository"]:::repo
        SearchBuilder["SearchBuilder"]:::builder
        SearchService["SearchService"]:::service
        Config["Configuration"]:::config
    end

    subgraph "External Systems"
        Solr["Apache Solr"]:::external
        DB["Database"]:::external
    end

    subgraph "Component Architecture"
        BaseComponents["Base Components"]:::component
        DocComponents["Document Components"]:::component
        FacetComponents["Facet Components"]:::component
        SearchComponents["Search Components"]:::component
        SysComponents["System Components"]:::component
    end

    subgraph "Configuration System"
        FieldConfig["Field Configuration"]:::config
        FacetConfig["Facet Configuration"]:::config
        SearchConfig["Search Configuration"]:::config
        ViewConfig["View Configuration"]:::config
    end

    %% Relationships
    Browser <--> AssetPipeline
    Browser <--> Controllers
    Controllers <--> ViewComponents
    Controllers <--> Views
    Controllers <--> SearchService
    SearchService <--> SearchBuilder
    SearchBuilder <--> SolrRepo
    SolrRepo <--> Solr
    Models <--> DB
    Services <--> Models
    Builders <--> Services

    %% Component Relationships
    BaseComponents --> DocComponents
    BaseComponents --> FacetComponents
    BaseComponents --> SearchComponents
    BaseComponents --> SysComponents

    %% Configuration Relationships
    Config --> FieldConfig
    Config --> FacetConfig
    Config --> SearchConfig
    Config --> ViewConfig

    %% Styling
    classDef controller fill:#a8d1f0
    classDef component fill:#d4e6f1
    classDef view fill:#aed6f1
    classDef model fill:#a9dfbf
    classDef service fill:#82e0aa
    classDef builder fill:#82e0aa
    classDef repo fill:#f8c471
    classDef config fill:#f7dc6f
    classDef external fill:#d5d8dc
    classDef asset fill:#d2b4de
    classDef presenter fill:#a9dfbf

    %% Click Events
    click Controllers "https://github.com/projectblacklight/blacklight/blob/main/app/controllers/catalog_controller.rb"
    click ViewComponents "https://github.com/projectblacklight/blacklight/tree/main/app/components/blacklight"
    click Views "https://github.com/projectblacklight/blacklight/tree/main/app/views/catalog"
    click AssetPipeline "https://github.com/projectblacklight/blacklight/tree/main/app/assets/stylesheets/blacklight"
    click Models "https://github.com/projectblacklight/blacklight/blob/main/app/models/solr_document.rb"
    click Presenters "https://github.com/projectblacklight/blacklight/tree/main/app/presenters/blacklight"
    click Services "https://github.com/projectblacklight/blacklight/blob/main/app/services/blacklight/search_service.rb"
    click Builders "https://github.com/projectblacklight/blacklight/blob/main/app/builders/blacklight/action_builder.rb"
    click SolrRepo "https://github.com/projectblacklight/blacklight/blob/main/lib/blacklight/solr/repository.rb"
    click SearchBuilder "https://github.com/projectblacklight/blacklight/blob/main/app/models/search_builder.rb"
    click SearchService "https://github.com/projectblacklight/blacklight/blob/main/app/services/blacklight/search_service.rb"
    click Config "https://github.com/projectblacklight/blacklight/blob/main/lib/blacklight/configuration.rb"
    click DocComponents "https://github.com/projectblacklight/blacklight/tree/main/app/components/blacklight/document"
    click FacetComponents "https://github.com/projectblacklight/blacklight/tree/main/app/components/blacklight/facet_"
    click SearchComponents "https://github.com/projectblacklight/blacklight/tree/main/app/components/blacklight/search"
    click SysComponents "https://github.com/projectblacklight/blacklight/tree/main/app/components/blacklight/system"
    click FieldConfig "https://github.com/projectblacklight/blacklight/blob/main/lib/blacklight/configuration/field.rb"
    click FacetConfig "https://github.com/projectblacklight/blacklight/blob/main/lib/blacklight/configuration/facet_field.rb"
    click SearchConfig "https://github.com/projectblacklight/blacklight/blob/main/lib/blacklight/configuration/search_field.rb"
    click ViewConfig "https://github.com/projectblacklight/blacklight/blob/main/lib/blacklight/configuration/view_config.rb"
```
