How coalaura/opfw-admin works
1. Overall shape
- This is a Laravel-based admin panel for OP-Framework FiveM servers.
- The app is split into a PHP backend, a Vue frontend, a MySQL/MariaDB data store, and a separate socket service for live features.
2. Request entry and app shell
- Incoming traffic lands at public/index.php behind nginx.
- Laravel handles routing, middleware, auth, and server-side data assembly.
- The frontend is a single-page style Vue app mounted from resources/views/app.blade.php, with pages in resources/js/Pages and shared UI in resources/js/Components.
3. Backend domain layer
- The core domain is modeled with Eloquent entities such as Player, Character, Ban, Log, Vehicle, Property, Server, Warning, Token, and various specialized log/event models.
- Controllers are organized by feature area: players, bans, characters, logs, map, statistics, tools, suspicious activity, lookup, staff chat, tokens, and docs.
4. Data flow from controller to UI
- Controllers gather domain data, apply filtering/searching, and return structured response objects using app/Http/Resources.
- Validation is centralized through form requests and custom rules, which keeps the controllers focused on orchestration rather than input checks.
5. Authorization and access boundaries
- Access is gated by middleware such as JWT auth, staff-only checks, super-admin checks, Cloudflare/proxy handling, and maintenance/update gates.
- There is also Discord-based login support, plus separate auth-related controllers for login/logout flows.
6. Primary feature subsystems
- The biggest user-facing modules are:
- player and character management
- bans and warnings
- log exploration and search
- live map / player tracking
- anti-cheat and suspicious-event review
- statistics dashboards
- server tooling and configuration helpers
- Y/social content management
- These are exposed as dedicated Vue pages and matching controllers/resources.
7. Real-time and external service integration
- Live features such as map updates and panel chat are proxied to an external socket server, not handled purely inside Laravel.
- The nginx config in the README explicitly forwards /socket, /io, and /panel_chat to that service.
- Helper classes like SocketAPI, ServerAPI, DiscordHelper, and HttpHelper indicate the backend also talks to external APIs and server-side services.
8. Cluster-aware deployment model
- The panel is designed around a cluster/subdomain model: the subdomain determines which environment file under envs/<cluster>/.env is used.
- That means the same codebase can serve multiple server clusters with isolated configuration and data.
9. Background work and maintenance
- Console commands handle recurring or operational jobs such as log parsing, cron-driven tasks, session cleanup, repair, query running, and pinging.
- cron.sh, update.sh, and scripts/panel-update.sh show that the system expects scheduled maintenance outside the web request path.
10. Database and seed/migration pipeline
- Standard Laravel migrations, factories, and seeders are used, with an additional custom migration-build workflow.
- The repo includes test factories for key models, suggesting the database schema is central to the app’s behavior and data browsing features.
11. Frontend asset and content layer
- Frontend code is built with Vite, Vue, Tailwind, and supporting plugins/filters.
- Static data files and media under public/, resources/js/data, and helpers/ feed things like maps, icons, translations, TTS docs, dictionaries, and game-specific metadata used by the UI.
Main entry points: Controllers Feature Controllers · Pages Vue Pages · Kernel.php Laravel Core · app Domain Models
Components 19
Web App
Laravel request handling, backend domain, and browser UI.
- Entrypoint · HTTP entry at public/index.php behind nginx.
public/index.php - Laravel Core · Routes requests through middleware, auth, and response assembly.
app/Http/Kernel.php - Access Gate · JWT, staff, super-admin, proxy, maintenance, and update checks.
app/Http/Middleware - Routes · HTTP and console route definitions.
routes/web.php - Feature Controllers · Domain orchestration for players, bans, logs, map, stats, tools, suspicious activity, lookup, staff chat, tokens, and docs.
app/Http/Controllers - Form Requests · Centralized input validation and custom rules.
app/Http/Requests - API Resources · Structured payloads returned to the frontend.
app/Http/Resources - App Shell · Root layout mounted from Blade and driven by Vue.
resources/views/app.blade.php - Vue Pages · User-facing panels for players, logs, map, stats, anti-cheat, tools, Y/social, and more.
resources/js/Pages - Shared UI · Reusable panels, charts, tables, map widgets, chat, and metadata views.
resources/js/Components - Frontend Plugins · Search, permissions, socket, storage, localization, theme, and other client-side helpers.
resources/js/Plugins - Static Content · Maps, icons, dictionaries, locales, media, and game-specific metadata used by the UI.
resources/js/data
Live Services
External socket-backed features and integration helpers.
- Socket Service · Separate live backend for map updates and panel chat.
- External APIs · Discord, server APIs, HTTP helpers, and other outside integrations.
app/Helpers
Data Layer
Persistent models, migrations, and seed data.
- Domain Models · Players, characters, bans, logs, vehicles, properties, servers, warnings, tokens, and related records.
app - Schema Pipeline · Database schema, factories, seeders, and custom migration generation.
database
Operations
Console jobs and deployment/maintenance scripts.
- Console Jobs · Log parsing, cron work, session cleanup, repair, querying, and pinging.
app/Console/Commands - Maintenance Scripts · Update and operational scripts run outside web requests.
scripts/panel-update.sh - Cluster Config · Per-cluster environment files and Laravel config drive deployment and runtime behavior.
envs
Connections 19
- Entrypoint → Laravel Core: bootstraps · Requests enter Laravel through the front controller.
- Laravel Core → Access Gate: passes through · Middleware and access checks guard application entry.
- Laravel Core → Routes: dispatches · Routes map requests to feature controllers.
- Routes → Feature Controllers: invokes · Feature endpoints are handled by dedicated controllers.
- Feature Controllers → Form Requests: validates via · Input checks are centralized in form requests and rules.
- Feature Controllers → Domain Models: reads/writes · Controllers orchestrate domain entities and queries.
- Feature Controllers → API Resources: returns · Domain data is transformed into response objects.
- API Resources → App Shell: hydrates UI · Structured responses feed the Vue app shell.
- App Shell → Vue Pages: mounts · The shell renders feature pages.
- Vue Pages → Shared UI: composes · Pages reuse shared UI primitives.
- Vue Pages → Frontend Plugins: uses · Client behavior is extended by plugins and helpers.
- Vue Pages → Static Content: consumes · Pages rely on bundled data, media, and localization files.
- Feature Controllers → Socket Service: proxies live data · Map and chat features are delegated to the socket backend.
- Frontend Plugins → Socket Service: connects to · The browser client subscribes to realtime socket features.
- Feature Controllers → External APIs: integrates with · Backend helpers talk to Discord and other external services.
- Domain Models → Schema Pipeline: defined by · Schema and seed data support the model layer.
- Console Jobs → Domain Models: maintains · Scheduled jobs parse logs, clean sessions, and repair data.
- Maintenance Scripts → Cluster Config: uses · Deployment scripts rely on cluster-specific environment setup.
- Cluster Config → Laravel Core: configures · Runtime config determines app behavior per cluster.