Skip to main content

Web Components Architecture

Standards-Based UI with Minimal Tooling

Overview

Web Components architecture leverages browser-native APIs and web standards to build modular, reusable UI components without framework dependencies. This approach relies on Custom Elements, Shadow DOM, and ES Modules to create maintainable web applications with minimal tooling and zero transpilation.

The BCE pattern naturally fits Web Components: Custom Elements act as Boundaries exposing UI interactions, Controls implement business logic and orchestration using plain JavaScript, and Entities manage application state through reducers and data models. This results in a clean, standards-based architecture with unidirectional data flow.

Business Components

Each Web Component represents a cohesive business feature organized in a BCE structure. Components are named after their domain responsibilities (e.g., product-list, checkout-form, user-profile).

The directory structure follows: [component-name]/[boundary|control|entity], where boundary contains Custom Element definitions, control holds business logic, and entity manages state. This ensures clear separation of concerns and maintainable, reusable UI components.

Boundary

Custom Elements serving as the UI layer and entry point for user interactions. Boundaries render HTML, handle events, and delegate business logic to control classes. They remain thin, focusing solely on presentation and event handling without business logic.

Control

Business logic and orchestration layer implementing application behavior as pure JavaScript functions. Controls handle validation, transformation, API calls, and coordinate state changes through action dispatching. They remain framework-agnostic and easily testable.

Entity

State management layer representing application data and domain models. Entities define the data structure, reducers handle state transformations, and the store maintains the single source of truth. This layer ensures predictable state updates through immutable operations.

Implementation Characteristics

Web Standards & Browser APIs

State Management

Development Experience

Testing & Quality

Resources

Examples & References