How dafengzhen/youdeyiwu works
Project type and purpose
• Youdeyiwu is a full-stack, multi-platform open-source lightweight forum.
• It consists of a Java Spring Boot backend (REST API), multiple clients (Flutter mobile/desktop, Angular/Electron desktop, Next.js web), a documentation site, and hosting/deployment scripts.
Key directories and architectural patterns
• /src (Java Spring Boot) follows a layered architecture:
· Controllers (REST endpoints)
· Services (business logic)
· Repositories (data access, JPA/Flyway migrations)
· Entities/DTOs/VOs (domain model)
· Aspects (AOP for logging, security, points, events)
· Event/listener modules (application events, notifications)
· Security (JWT filters, AccessDecisionManager)
• /app (Flutter): cross-platform mobile & desktop app using Provider for state, API client utilities, generated JSON serialization.
• /desktop (Angular + Electron): desktop app using NgRx (actions, reducers, effects), Angular modules & components, Electron preload/main.
• /web (Next.js): React/TypeScript web app using Next.js App Router, React Query-style data fetching (“actions”), contexts, interfaces.
• /hosting: Docker Compose for reverse proxy / static hosting.
• /docs: VitePress documentation site.
Main components
• Clients Layer (left):
• Mobile/Desktop App (Flutter)
• Angular/Electron Desktop App
• Next.js Web Application
• API Layer (center):
• Java Spring Boot REST API
– Controllers & AOP aspects
– Service Layer
– Repository Layer (JPA + Flyway migrations)
– Security Module (JWT authentication/authorization)
– Event Bus (Spring ApplicationEvents, listeners)
• Persistence Layer (right):
• Relational Database (e.g., PostgreSQL/MySQL)
• File Storage Service (local FS or S3/OSS, configurable)
• Supporting Infrastructure (bottom/right):
• Cache Layer (Redis or in-memory, via CacheConfig)
• Message Broker (if external events or notifications needed)
• CDN / Static Hosting (for web assets, via hosting folder)
• DevOps / Deployment (bottom):
• Docker / docker-compose
• CI/CD workflows (GitHub Actions)
• Vercel / Netlify (for Next.js)
• Electron build scripts
Relationships and interactions
• API Layer reads/writes to the Database and File Storage.
• API Layer publishes internal events consumed by NotificationEventIntegrator and Listeners.
• Cache sits between API and Database for read-through/write-back.
• Deployment pipelines push Docker images for API and host static frontends on CDN or Electron installers.
Architectural patterns & design principles
• Backend: layered architecture, separation of concerns, AOP for cross-cutting.
• Persistence: repository pattern, data migrations (Flyway).
• Security: JWT-based stateless auth, custom filters, access decision manager.
• Frontends:
• Flutter uses Provider for DI/state, code generation for JSON models
• Angular/Electron uses NgRx (Redux pattern): actions, reducers, effects
• Next.js uses React Server Components/App Router, encapsulated “actions” for data fetching, React Context