How dromara/ujcms works
Project Type and Purpose
• UJCMS is a Java-based, full-stack, enterprise CMS that supports both traditional server-rendered sites (Freemarker templates) and a headless CMS mode (REST API + SPA).
• Backend: a monolithic Spring Boot application (Spring Security, MyBatis, Liquibase, Quartz/Flowable, Lucene).
• Frontend:
• Public site: Freemarker templates under src/main/webapp/templates
• Admin site (“cp”): Vue3/ElementPlus SPA with assets in src/main/webapp/cp, built by Vite/Gulp.
High-Level Components
• Clients
• Public Browser → Freemarker-rendered pages
• Admin Browser → Vue3 SPA (calls backend REST)
• Spring Boot Application (single deployable jar/war)
• Web Layer
– Public MVC Controllers (Freemarker)
– REST Controllers (API under /api, backend API under /cp/api)
• Service Layer (business logic)
• Data Access Layer (MyBatis mappers + domain objects)
• Core Modules
– SecurityConfig, JwtAuthService
– CacheConfig (Spring Cache)
– LuceneConfig (embedded full-text search)
– ScheduleConfig (Quartz or Spring Scheduler)
– MyBatisConfig, SwaggerConfig
– AOP (OperationLogAspect)
• Extension Module (com.ujcms.cms.ext): plugin-style subsystems (collector, survey, message board, import, visit stat, vote, etc.)
• Common Libraries (com.ujcms.commons): shared utilities (captcha, db helpers, file handlers, freemarker tags, security, SMS, web helper classes)
• Persistence
• MySQL 8.0 (with Liquibase changelogs under src/main/resources/db/changelog)
• Freemarker template files and static uploads on filesystem (/uploads)
• Lucene index files (WEB-INF/lucene)
• External Services
• OAuth providers (Weixin, QQ, Weibo)
• SMTP/SMS gateways (Aliyun/Tencent utilities)
• Optional Redis or other cache backends if configured
Relationships & Data Flows
• Browser → HTTP(S) → Spring Boot Web Layer
• Web Layer → Service Layer → Data Access Layer → MySQL
• Service Layer ↔ Spring Cache (in-memory or Redis)
• Service Layer ↔ Lucene Engine (index + search)
• Startup → Liquibase applies DB migrations automatically
• Admin SPA → REST API Controllers → Service → DB/Cache
Architectural Patterns & Principles
• Layered MVC (Controller → Service → Mapper/DAO)
• Plugin/Extension architecture (core vs ext packages)
• Headless CMS support: decoupled API layer for modern SPAs
• Template-plus-tags for server-rendered mode vs API-first for SPAs
• Use of AOP for cross-cutting concerns (logging, security)
• Embedded full-text search with Lucene
Essential Elements
• Clients: Public Browser, Admin Browser (SPA)
• HTTP Layer: MVC Controllers, API Controllers
• Business Layer: Services, AOP aspects
• Data Layer: MyBatis mappers → MySQL (with Liquibase)
• Embedded Search: Lucene index store
• File Storage: templates & uploads directories
• Extensions: plugin modules under com.ujcms.cms.ext
• Commons: shared utilities
• External: OAuth, SMS/Email services