How seriawei/zkeacms works
Main Components
• Web Host Layer: At the front, the “ZKEACMS.WebHost” project is the entry point. It functions as the MVC presentation layer (controllers, views, assets, CSS/JavaScript) and handles user requests. It also contains the Dockerfile and deployment scripts.
• CMS Core/Framework: The “ZKEACMS” directory and the “EasyFrameWork” repository provide the core libraries. This part includes core CMS services such as routing, authentication, context management, dependency injection, layout rendering, and the integration of plugins.
• Plugin and Modules Ecosystem: There are multiple modules (e.g., ZKEACMS.Article, ZKEACMS.Product, ZKEACMS.EventAction, ZKEACMS.FormGenerator, etc.) that extend the CMS functionality. They typically implement widget functionality, domain-specific services, and event handling. Also, plugins under tools and the “zkea.plugin” markers indicate that a plugin-based architecture is used.
• Widget, Layout, and Theme System: The system emphasizes WYSIWYG page design, layout design (leveraging the Bootstrap grid), theme customization (LESS-based themes included in ZKEACMS.Theme and various widget view folders) and a widget engine (widget base classes and widget activators in the “Widget” and “WidgetTemplate” folders).
• API Layer: There is an “Api” folder (and ApiControllers within ZKEACMS.Api and the web host) that likely exposes REST API endpoints for content management.
• Data Layer: The “Database” directory (with multiple database types and migration scripts) and the use of Entity Framework (see CMSDbContext, EasyDbContext, etc.) show that the data layer is abstracted; it provides persistence and supports multiple SQL providers.
• Infrastructure & Utilities: Additional components include caching mechanisms, logging, encryption services, notification handlers, and even a rule engine (found in ZKEACMS.RuleEngine) that provide support functions across the system.
• Build, Publish, and Deployment: Scripts like Build.cmd/sh, Publish.cmd/sh, and Docker-related files indicate dedicated build and deployment support.
Out the Relationships and Data Flow
• Present front-end requests flowing into the WebHost layer – these requests hit MVC Controllers and API endpoints.
• WebHost interacts with the CMS Core layer, which in turn calls into various services: the routing provider, authentication/authorization (possibly via JWT in the API), caching, event handling, etc.
• The core and module services invoke business logic in the plugin modules. They further interact with the data layer (the EF-based repositories/DbContext) to store and retrieve persistent content.
• The widget, layout, and theme components collaborate – the layout engine pulls grid and template information while widget services supply renderable content.
• Administration, publishing (via the ZKEACMS.Publisher NuGet tool), and API integrations form an external boundary for deploying content to production.
• Development tools (such as PluginTemplate and LanguageScriptGen under the tools/ folder) support extensibility and operational tooling for customizations.
Architectural Patterns & Design Principles
• Modularity and Plugin Architecture: Each module is self-contained (with its own controllers, models, views, and even event handlers) and is discovered/activated at runtime.
• MVC Pattern: The separation between controllers, models, and views is evident in the WebHost layer. This separation supports both administrative UI and front-end rendering.
• Repository / Unit-of-Work Pattern: The structure of the “DbContext” files and “EntityFrameWorkModelCreating” classes shows a clear separation of data access concerns.
• Dependency Injection & IoC: The use of “ServiceCollectionExtend.cs” and clear provider classes illustrates that components are wired using DI best practices.
• Event-Driven Architecture: Several “EventHandler” directories indicate that events (such as cache removals on page changes) are used to decouple components.
• Multi-Database & Cross-Platform Support: Script files under the Database folder support different SQL providers, and Docker scripts underline containerized deployment.
Relevant Technologies
• .NET 8 & C#
• ASP.NET Core MVC for the WebHost
• Entity Framework for data access with providers for MSSQL, MySQL, and SQLite
• Bootstrap and LESS for responsive layout and theming
• GitHub Actions workflows for CI/CD
• Docker for containerized deployment
• NuGet packaging and command-line publisher tool
• Be very detailed: capture not only the high-level layers but also sub-components like API endpoints, event handlers, and even the build/deployment pipeline.
• External dependencies explicitly (databases, external publishing tools, Docker, and cloud deployment).