How sintaxytb/guardsman-web-origin-repo works
Project Type and Purpose
• Guardsman Web is a full-stack administration panel (Laravel PHP backend + Vue.js SPA frontend) designed to automate tasks (punishment expiry, data backups, statistics) and provide a management UI for users, roles, servers, logs, etc.
File-Structure Analysis
• Top-level “app/”, “config/”, “routes/”, “database/” directories → Laravel MVC backend.
• “resources/ts/” and “resources/styles/” → Vue 3 + TypeScript + SCSS SPA.
• “public/” → built assets and entry-point (index.php) served by Nginx/PHP-FPM.
• “app/Console” → artisan commands & scheduled tasks (purge, stats).
• Presence of “docker-compose.yml”, “.env.example” → environment configuration & containerized services (web, db).
• CI config in “.github/workflows” and Qodana static-analysis.
Main Components
A. Client Layer
• Browser (Admin users interacting with SPA)
B. Presentation & Proxy Layer
• NGINX reverse proxy (serves static files, routes /api → PHP-FPM, proxies /api/docs → Swagger)
C. Application Layer
• PHP-FPM running Laravel
– HTTP Kernel, Controllers (app/Http/Controllers)
– Middleware chain (authentication, CSRF, API guards)
– Service Providers (Auth, Broadcast, Events, Routes)
• Vue SPA (built by Vite)
– Components, Pages, Layouts, Pinia stores, Router
D. Scheduling & CLI Layer
• Cron daemon invoking “php artisan schedule:run” each minute
• Artisan Console Commands (auto-punishment expiry, backups, stats, purge)
E. Data Layer
• MariaDB/MySQL (migrations, seeders, Eloquent ORM)
• (Optional) Redis for queues/cache (configurable in config/queue.php, config/cache.php)
• File storage (local or S3 via config/filesystems.php)
F. External Services
• Discord API (via DiscordAPIController)
• Game API (via GameAPIController)
• OpenAPI/Swagger docs service on port 9001
• Optional Broadcast drivers (Pusher, Redis)
G. Observability & DevOps
• Sentry (error tracking)
• GitHub Actions → CI/CD (testing, code-quality)
• Docker Compose orchestration
Relationships & Data Flows
• Browser ↔ HTTP(S) ↔ NGINX ↔ PHP-FPM (Laravel) ↔ SQL ↔ MariaDB
• Browser requests static assets (JS/CSS) directly from NGINX’s “public/” folder
• SPA invokes REST endpoints (/api/*) to Laravel controllers
• Laravel controllers call Eloquent models → database or dispatch console jobs
• Cron → artisan scheduler → executes Console commands → interacts with Models/Services → DB or external APIs
• Laravel → External Discord/Game APIs over HTTPS
• NGINX → proxies /api/docs to Swagger UI container on port 9001
Architectural Patterns & Design Principles
• MVC (Laravel) + SPA (Vue) separation of concerns
• RESTful API layer for data access
• Service-Provider and IoC container for decoupling
• Middleware pipeline for cross-cutting concerns (auth, throttling)
• Command Bus pattern for console tasks
• Scheduled-Task pattern (artisan schedule)
• Event-Driven hooks (EventServiceProvider, BroadcastServiceProvider)
Key Technologies & Frameworks
• Backend: PHP 8.3, Laravel 10, Composer
• Frontend: Vue 3, TypeScript, Vite, Pinia, Vue Router, SCSS (CoreUI template)
• Web Server: NGINX + php-fpm.sock
• Data Store: MariaDB/MySQL, optional Redis
• External APIs: Discord, Game API
• Documentation: OpenAPI (Swagger)
• Observability: Sentry
• CI: GitHub Actions (Qodana)
• Containerization: Docker Compose