How wangzmgit/alnitak works
Main Components
a. Front-end Clients:
• Web Client (nuxt-based UI)
• Admin Client (management interface for content/users)
• Mobile Client (mobile-tailored client)
b. Back-end Server:
• Core Go Server (located in the “server” directory) that handles API endpoints, business logic, and request routing.
• API Layer (inside server/internal/api/v1) that aggregates endpoints for features like video, article/专栏, comments, likes, collections, etc.
• Middleware (authentication, CORS, request logging, operation logging) that secures and intercepts HTTP calls.
• Services & Domain Logic:
– Services for handling functionalities including transcoding, caching, messaging (real-time, WebSocket), and user management.
– Domain models, Data Transfer Objects (DTOs) and Value Objects (VOs) in server/internal/domain for business logic.
• Utilities and Helpers:
– Packages handling logging, JWT, MySQL, OSS (integrating Aliyun or MinIO), Redis, and WebSocket (server/pkg/ws).
c. Databases and External Storage:
• MySQL: Managed via configuration files (server/internal/config/mysql.go; sql/structure.sql) and used as the relational database.
• Redis: Used for caching and session management (server/internal/config/redis.go; server/pkg/redis).
• Object Storage Service (OSS): For file and video/media uploads which rely on libraries inside server/pkg/oss (support for Aliyun and MinIO).
d. Additional Components:
• Docker Infrastructure: docker-compose.yml and Dockerfiles for server and clients that indicate containerized deployment.
• Third-party Integrations: External libraries like wplayer-next (弹幕播放器) and the Go-based puzzle sliding captcha (jigsaw).
• Cron Jobs: In server/internal/cron for scheduled jobs (popular video, click count aggregations, etc.) indicating background processing.
• WebSocket Service: For live messaging and online user counts.
Relationships and Interactions
• File uploads and Media Handling: Illustrate OSS (or local disk storage in “data/upload” and “server/upload”) as a storage component interfacing with the server.
Architectural Patterns & Design Principles
• Modularization (the Go code is organized into modules such as internal/api, service, domain, config, middleware, etc.). This separation of concerns shows layered architecture (route → middleware → service → repository/data access).
• Separation of Frontend and Backend: The different front-end directories (web/admin-client, web/mobile-client, web/web-client) clearly illustrate a decoupled architecture communicating with a centralized API server.
• Use of JWT for Authentication and Casbin for RBAC indicates security best practices.
• Containerization with Docker suggests deployment in clustered or microservice-like environments even if the Go server is more monolithic in structure.
Technologies, Frameworks & Libraries
• Front-end: Nuxt (Vue-based) for web and mobile UI.
• Back-end: Go with a structured project layout. Look for “server/internal/” to highlight controllers, services, and domain models.
• Database: MySQL (with schema defined in sql/structure.sql).
• Caching: Redis.
• OSS Integration: Aliyun/MinIO for media file handling.
• WebSocket: For real-time features and notifications.
• Docker: Deployment and container orchestration.
• Additional dependencies like wplayer and jigsaw are significant in terms of external packages.
Detailed Suggestions for the Principal Software Engineer
• Dependencies between modules – for example, the service layer depends on repository/data access, Redis caching, and OSS integration.
• Use nested blocks or containers to show the internal organization of the monolithic Go server if needed.
• Explicitly mention that the front-end clients are built with Nuxt/Vue and that the server code uses Go’s standard packages and an organized internal structure to support real-time communication and video functionalities.