Plugins
Plugin System Overview
Learn about the Universal Data Layer plugin architecture
Overview
The Universal Data Layer uses a plugin-based architecture that allows you to extend functionality and connect to various data sources. Plugins are modular packages that can be configured, registered, and loaded at runtime.
How Plugins Work
Plugins in UDL follow a simple convention:
- Each plugin is a package (npm package or local directory) containing a
udl.config.jsfile - The config file exports plugin metadata and an optional
onLoadlifecycle hook - Plugins are registered in your application's
udl.config.jsfile - When the server starts, UDL loads and initializes all registered plugins
Plugin Types
Currently, UDL supports the following plugin types:
core: Core system plugins that provide foundational functionalitysource: Data source plugins that connect to external APIs or services (e.g., Contentful, Shopify, Okendo)
Key Concepts
Plugin Configuration
Every plugin has a udl.config.js file at its root that exports:
config: Plugin metadata (name, version, type)onLoad: Optional lifecycle hook that runs when the plugin is loaded
Lifecycle Hooks
The onLoad hook is called when a plugin is initialized. It receives a context object containing:
options: Plugin-specific options passed during registrationconfig: The application's UDL configuration
Plugin Resolution
UDL resolves plugins in the following order:
- Relative/absolute paths: If the plugin name starts with
.or/, it's treated as a file path - npm packages: Otherwise, UDL attempts to resolve it as an installed npm package
- Fallback: If resolution fails, UDL falls back to checking
node_modulesdirectly
Next Steps
- Creating a Plugin - Learn how to build your own plugin
- Registering Plugins - Learn how to configure and use plugins
- Lifecycle Methods - Deep dive into plugin lifecycle hooks