Skip to content

Architecture Overview

liseli edited this page Feb 19, 2026 · 4 revisions

Architecture Overview

Table of Contents

  1. Architecture Overview
  2. Technology Stack
  3. [Configuration Files] (#configuration-files)
  4. [Key Business Logic Summary] (#key-business-logic-summary)
  5. Error Handling
  6. Development Notes
  7. Security Considerations
  8. Performance Considerations
  9. Bottlenecks
  10. Deployment Architecture
  11. Glossary

Architecture Overview

System Type

  • Framework: VuFind- (Villanova University Find) - PHP search framework
  • Pattern: Front Controller + Module/Action MVC
  • Primary Purpose: Digital library catalog search interface for HathiTrust
  • Search Engine: Apache Solr
  • Template Engine: Smarty 4
  • Session Management: Custom database-backed sessions (DSession)

Technology Stack

┌─────────────────────────────────────────┐
│         User Browser (HTTP/HTTPS)       │
└────────────────┬────────────────────────┘
                 │
┌────────────────▼───────────────────────────────────────┐
│             Web servers                                |
│        Development - Nginx (Reverse Proxy) + PHP-FPM   |           
│       Production  - Apache + mod_php                   |
└────────────────┬───────────────────────────────────────│
                 │
┌────────────────▼────────────────────────┐
│                PHP 8.4                  │
│    ┌──────────────────────────────┐     │
│    │    index.php (Entry Point)   │     │
│    │    ├─ Module/Action Router   │     │
│    │    ├─ Services Layer         │     │
│    │    └─ System Classes (sys/)  │     │
│    └──────────────────────────────┘     │
└────────────────┬────────────────────────┘
                 │
    ┌────────────┼────────────┐
    │            │            │
┌───▼──────┐ ┌──▼──────┐ ┌──▼────────┐
│  Solr    │ │  MySQL  │ │  GeoIP    │
│ (Search) │ │(Session)│ │(Location) │
└──────────┘ └─────────┘ └───────────┘

Configuration Files

Main Configuration: conf/config.ini

[System]
available = true
debug = false

[Site]
url = https://catalog.hathitrust.org
theme = default
language = en
locale = en_US
facetDir = /app/catalog_facet_info

[Index]
engine = Solr
url = http://solr:8983/solr/catalog
urlFile = solr_url.ini

[GeoIP]
path = /usr/share/GeoIP/GeoIP2-Country.mmdb

[OpenURL]
url = https://...

Additional Configs

  • conf/authspecs.yaml - Session and authentication config
  • conf/solr_url.ini - Solr URL override
  • conf/config.local.ini - Local overrides (not in git)

Key Business Logic Summary

Access Control Matrix

User Type Location Institution Full-Text Access Viewable Items
Guest International None ✗ Public domain only
Guest USA None ✓ (limited) Public domain + Section 108
Authenticated International Member ✗ PD + Institution holdings
Authenticated USA Member ✓ PD + Section 108 + Institution
Emergency Access Any Member ✓ PD + Section 108 + Institution + Expanded

Search Query Processing

  1. Parse user query (SearchStructure)
  2. Apply filters:
    • Geographic (if international: only PD)
    • Institution (if authenticated: add institution filter)
    • Full-text (if enabled: rights filter)
    • Collection (HathiTrust collections)
  3. Execute Solr query
  4. Process results:
    • Pagination
    • Facets
    • Highlighting
    • Access determination per item
  5. Render template

Error Handling

PEAR Error Handler

// index.php line 327
function handlePEARError($error, $method = null) {
    $interface = new UInterface();
    $interface->assign('error', $error);
    header('HTTP/1.1 404 Not Found');
    $interface->display('error.tpl');
    exit();
}

Triggered By:

  • Missing controller file
  • Invalid module/action
  • PEAR library errors

Development Notes

Adding a New Controller

  1. Create file: services/{Module}/{Action}.php
  2. Define class: class {Action} extends Action
  3. Implement methods:
    function setup() { /* initialize */ }
    function launch() { /* entry point */ }
  4. Access via: /{Module}/{Action}

Adding Session Data

$session = VFSession::instance();
$session->set('my_variable', $value);
$value = $session->get('my_variable');

Adding Template Variable

global $interface;
$interface->assign('my_var', $value);
// Available in template as: {$my_var}

Security Considerations

Current Security Measures

  1. XSS Prevention: Strip > from all inputs
  2. Session Security: HttpOnly cookies
  3. CSRF: ❌ Not implemented
  4. SQL Injection: ✅ PDO prepared statements in DSession
  5. Input Validation: ⚠️ Minimal (only > removal)

Performance Considerations

Caching

  • Smarty Templates: Compiled templates cached in interface/compile/
  • Session Data: Database-backed (not file-based)
  • Solr: No application-level caching (relies on Solr caching)

Bottlenecks

  1. Database sessions: Every request reads/writes MySQL
  2. GeoIP lookup: Maxmind database read on first request
  3. Solr queries: Network latency to Solr server

Deployment Architecture

                    Internet
                        │
                        ▼
               ┌────────────────┐
               │  Load Balancer │
               └────────┬───────┘
                        │
         ┌──────────────┼──────────────┐
         │              │              │
    ┌────▼───┐     ┌───▼────┐    ┌───▼────┐
    │ Nginx  │     │ Nginx  │    │ Nginx  │
    │   +    │     │   +    │    │   +    │
    │PHP-FPM │     │PHP-FPM │    │PHP-FPM │
    └────┬───┘     └───┬────┘    └───┬────┘
         │             │              │
         └─────────────┼──────────────┘
                       │
         ┌─────────────┼─────────────┐
         │             │             │
    ┌────▼────┐   ┌───▼────┐   ┌───▼────┐
    │  Solr   │   │ MySQL  │   │ Shibbo-│
    │ Cluster │   │Sessions│   │ leth   │
    └─────────┘   └────────┘   │  SSO   │
                               └────────┘

Glossary

  • HathiTrust: Digital library preserving millions of digitized books
  • ETAS: Emergency Temporary Access Service (expanded access during COVID-19)
  • VuFind: Open-source library discovery interface - VuFind-
  • Solr: Apache Solr search platform
  • Shibboleth: SAML-based SSO authentication system
  • MARC: Machine-Readable Cataloging (bibliographic record format)

Clone this wiki locally