How adobe/aem-react-editable-components works
Project type and purpose
• It’s an NPM-distributed React library, not a standalone application.
• Purpose: supply editable React components and an integration layer that hooks into the AEM SPA Editor and AEM SPA Page Model Manager.
Main components
A. Consumer React SPA (the host application)
B. @adobe/aem-react-editable-components library, broken down into:
1. API Layer
– fetchModel.ts
2. Core Integration
– ComponentMapping.tsx
– EditableComponent.tsx
3. React UI Components
– Page.tsx (entry point)
– Container.tsx
– ResponsiveGrid.tsx
– Placeholder.tsx
– AllowedComponentsContainer.tsx
4. Hooks & Utilities
– useEditor.ts
– Utils.ts
– constants & types
C. External Services
– AEM SPA Page Model Manager (remote JSON model provider)
– AEM SPA Editor (authoring environment)
Relationships & data-flow
1. At app startup the Consumer SPA invokes fetchModel → AEM Page Model Manager
2. fetchModel returns a JSON “page model”
3. Core ComponentMapping maps model component names to React UI Components
4. Page component recursively renders the tree via EditableComponent wrappers
5. useEditor hook and EditableComponent register edit events with the AEM SPA Editor window APIs
6. User actions in the browser (drag, drop, edit) emit events back to AEM SPA Editor
Architectural patterns & principles
• Plugin-style component mapping for extensibility (ComponentMapping)
• Separation of concerns:
– API layer (fetchModel)
– Rendering layer (Page, Container, etc.)
– Integration layer (EditableComponent, useEditor)
• Hook pattern for lifecycle integration with external editor
• Strongly-typed contract via Typescript types in src/types
Special notes for this open-source tool
• Extensibility boundary at ComponentMapping (users can register custom components).
• Dependency on the AEM SPA Page Model Manager (consumer must include it).
• That the library is a middleware between a React SPA and AEM services.