How pridejoy/malusadmin works
Project type and purpose
• This is a full-stack, front-end/back-end-separated administration system called Malus Admin, built on .NET 7/8 + SqlSugar for the back end and Vue3 + Vite4 + TypeScript + NaiveUI for the front end.
• It provides user authentication (JWT), role-based permissions, system configuration, logging, real-time online-user monitoring (SignalR), scheduled backup jobs (Quartz), and a WeChat mini-service endpoint.
File structure
Top-level split into:
• MalusApi/ – Back-end solution with multiple projects:
• Common – shared components (DI, config, cache, JWT auth, RabbitMQ, Swagger, dynamic API controllers).
• Repository – data models, SqlSugar repository layers.
• Servers – business logic services, subdivided into BackStageManager (system management features) and BusinessManager (domain features like gallery, customer, Bing wallpaper).
• WebApi – ASP.NET Core Web API host, controllers organized per feature, custom filters/middleware, SignalR hub for online user.
• BackUpServices – a console/Quartz service for scheduled tasks (init data, daily Bing image fetch, word jobs).
• ConsoleApp1 – one-time data initialization scripts.
• Wechat.Servers + Wechat.WebApi – separate back-end and API layers to support WeChat-specific endpoints.
• MalusWeb/ – Front-end monorepo (pnpm workspace)
• src/ – Vue3 Single-Page App: components, layouts, views, router, store (Pinia), service layer invoking back-end APIs (axios), SignalR plugin.
• doc/dbsql/ – database dump scripts (MySQL, SQL Server).
• Root also has LICENSE, README in multiple languages, and solution files.
README
• Confirms front-end/back-end separation, JWT auth, deployment instructions, highlights .NET7 + SqlSugar, Vue3 + NaiveUI.
• Mentions three “ends” (web, mobile, mini-program) but code mainly covers admin web and WeChat API.
Main components
a. User Interfaces
• Admin Web UI (Vue3/NaiveUI SPA)
• WeChat Mini/Service UI (calls WeChat.WebApi)
b. API Gateway / Web API Hosts
• MalusAdmin.WebApi – main HTTP/REST API, JWT authentication
• Wechat.WebApi – WeChat-specific endpoints
c. Business Services (class-library services)
• BackStageManager – system management logic (config, cache, menu, role, user, logging)
• BusinessManager – domain entities (gallery, customer, Bing wallpaper, weather forecast)
d. Infrastructure Components
• Common – DI, config, cache (Memory/Redis), JWT, Swagger, RabbitMQ integration
• Repository – SqlSugar repositories mapping to MySQL/SQL Server DB
• SignalR Hub – real-time online user notifications
• Quartz Scheduler – scheduled jobs (BackupServices)
• Console Data Init – one-time seeding JSON into DB
e. Data Stores
• Relational Database (MySQL/SQL Server)
• Redis (optional cache)
• RabbitMQ (optional message broker)
Relationships and data flows
• Admin Web UI → HTTP(S) calls → MalusAdmin.WebApi → DI/Config → Business Services → Repository → Database
• Wechat UI → HTTP(S) calls → Wechat.WebApi → Wechat.Servers logic → Repository → Database
• MalusAdmin.WebApi publishes/subscribes via RabbitMQ (through Common) for asynchronous events.
• SignalR Hub (inside WebApi) → bi-directional live online-user updates to Admin Web UI.
• Quartz Jobs (BackUpServices) and ConsoleApp1 seed data directly access Repository → Database on schedule or manual run.
• Cache Layer (MemoryCacheService/RedisCacheService) sits between Services and Repo for hot data.
Architectural patterns and principles
• Layered Architecture: UI → API → Services → Repository → Database
• Dependency Injection for loose coupling (Common/DI)
• Configuration-First via Options pattern
• Attribute-Driven auth and permission checks (CustomAuthorizationAttribute)
• Dynamic API Controllers for rapid expansion
• CQRS-Style Separation: simple DTO inputs/outputs for each service
• Event-Driven (RabbitMQ) and Real-Time (SignalR) for asynchronous features
• Scheduled Tasks (Quartz) for background processing