How givanz/vvvebjs works
Project Type and Purpose
• This is a JavaScript-based page builder library primarily focused on the front end.
• Its purpose is to allow non-technical users to design and modify web pages interactively.
• It is extensible and supports additional components, plugins, and even file management with optional backend support.
File Structure
• There are several top-level directories and files that indicate the architectural components:
• The root contains configuration files (Dockerfile, docker-compose.yml, package.json, gulpfile.js) for development and deployment.
• The demos in the “demo” folder give examples of pages (e.g., album, blog, carousel, landing) that the editor can work with.
• The “libs” directory is crucial; it contains subdirectories for:
– AOS (animation library)
– Codemirror (for live code editing)
– Builder components and plugins (e.g., builder.js, components-bootstrap5.js, various plugin files)
– Media and other helper libraries.
• Style assets reside in “css” and “scss” directories (plus fonts and images) and indicate the use of Bootstrap along with custom CSS/SCSS.
• PHP files (e.g., editor.php, save.php, upload.php) and Node.js script (save.js) indicate optional backend endpoints.
Key Components
a. Editor / UI Layer
• Editor Interface: Represented by “editor.html” and “editor.php”. This is the main entry point where users interact with the page builder.
• UI Components: The drag-and-drop interface, live code editor (with CodeMirror), undo/redo, and visual panels.
b. Builder Core / JavaScript Library
• Core Builder Engine: Indicated by “libs/builder/builder.js”, which orchestrates the page building, component insertion, and user interactions.
• Component Modules: Various components found in “libs/builder/components-*.js” (for Bootstrap 5, widgets, server components, etc.) that define available blocks, sections, and other elements.
• Plugin System: Plugins (e.g., plugin-ai-assistant.js, plugin-ckeditor.js, plugin-google-fonts.js, etc.) allow the system to be extended. Mark these as optional modules integrated into the core.
• Inputs and Undo Manager: Outline the “libs/builder/inputs.js” and “libs/builder/undo.js” (handling events and providing undo/redo functionality).
c. File and Page Management
• File Manager: Represented by “Vvveb.FileManager” functionalities (see in the example snippet) to manage and load pages.
• Save/Upload Handlers: Include “save.php”, “upload.php”, and “save.js” that allow saving/exporting pages.
d. External Libraries and Dependencies
• Integration with Bootstrap 5 and possibly CodeMirror for code editing.
• Other helper libraries such as Codemirror, Swiper, AOS (Animate on Scroll) that contribute to the user experience.
e. Build and Deployment Utilities
• The build process is managed by Gulp (gulpfile.js) and has tasks for compiling SCSS, generating HTML from templates (especially in demo/landing), and creating screenshots.
• Docker and Docker Compose configuration for local development and deployment.
Relationships and Data Flow
• Builder Core to component modules and plugins to show how the system dynamically loads behavior for each component.
• File Manager component and its interaction with the Builder Core (loading pages, managing assets).
• Build process as a separate, development-time utility that compiles SCSS into CSS and bundles assets.
Visualizing Patterns and Technologies
• If applicable, show an MVC/MVVM-style layering where:
• The “View” layer is the Editor UI (editor.html/php)
• The “Controller/Service” layer is the Builder Core managing interactions
• The “Model” layer is represented by saved templates or state management (managed via FileManager, undo manager, and backend saving features).
• Modularity and extensibility as key design principles, illustrating that new components or plugins can plug into the core without breaking the architecture.