How miguelcarmona00/inafinder works
1. What this repository is
- InaFinder is a PHP 8.2 MVC application, built without a framework, for searching Inazuma Eleven players and managing a transfer market.
- The architecture is centered around a classic server-rendered web app with a MariaDB backend and a thin custom application layer.
2. Runtime and deployment boundary
- The app runs in Docker, with a dedicated image under inafinder/ and Compose files under compose/inafinder/.
- Development uses a Compose override that bind-mounts the source code and exposes MariaDB on the host; production runs from the built image and keeps the database internal.
- Apache is the web server layer inside the container, with public/ as the web root.
3. Request entrypoint
- HTTP requests land in public/index.php, which is the front controller.
- public/.htaccess likely rewrites routes into that entrypoint, so the application uses clean URLs rather than direct PHP file access.
- bootstrap.php initializes shared configuration and wiring, including environment loading from .env.
4. Routing and application control flow
- app/Core/Router.php is the custom routing layer that maps URLs to controller actions.
- app/Controllers/BaseController.php provides shared controller behavior, while the rest of the controllers implement feature-specific endpoints.
- The main flow is: request -> router -> controller -> model/data access -> view rendering.
5. Controller boundaries
- The controllers are organized by domain: Jugadores, Entrenadores, Talentos, Tecnicas, Tiros, Regates, Paradas, Bloqueos, plus User and Default.
- TecnicaCrudController suggests a dedicated administrative flow for technique management that differs from normal browsing.
- This indicates a split between public-facing browsing/search and admin-style CRUD operations.
6. Domain/data model layer
- app/Models/DBAbstractModel.php is the shared database access base class.
- Concrete models mirror the business domain: Jugadores, Equipos, Entrenadores, Fichajes, Monederos, Usuarios, LoginIntentos, Talentos, Tecnicas, JugadoresTalentos, and JugadoresSupertecnicas.
- The model layer is where the app’s main relationships live: players, teams, skills, transfers, wallets/credits, and login security records.
7. Database as a core subsystem
- MariaDB is the persistent system of record, seeded from bds/inafinderprod.sql on first startup.
- The dump contains both schema and seed data, so the repository includes a reproducible initial dataset for development and testing.
- The app’s database credentials are injected through container environment variables and .env files, not hardcoded in the codebase.
8. View layer and server-rendered UI
- Views live in app/views/ and are split by feature area, matching the controllers and models.
- There are dedicated views for list/edit/create flows, plus higher-level pages like index_view.php, login_view.php, mercado_view.php, and jugador_view.php.
- Shared UI fragments live in app/views/partials/ for the navbar, block messages, and SweetAlert integration.
9. Client-side behavior
- The frontend is mostly traditional server-rendered HTML with supplemental JavaScript in public/js/.
- Scripts such as mercado.js, monedero.js, reembolso.js, filtros.js, confirmDelete.js, csrf.js, and loginTimer.js support form UX, filtering, security tokens, confirmation dialogs, and market interactions.
- This means some user interactions are handled client-side, but the system remains primarily backend-driven.
10. Assets and media storage
- Static assets are served from public/css, public/js, and public/imgs.
- Uploaded images are organized under public/imgs/uploads/ by entity type, such as jugadores, entrenadores, regates, tiros, paradas, bloqueos, escudos, and more.
- That structure implies the app stores uploaded media on the filesystem rather than in the database.
11. Security and session-related concerns
- app/Core/Csrf.php and public/js/csrf.js show CSRF protection as a first-class part of the app.
- LoginIntentos indicates tracking for failed login attempts, and loginTimer.js suggests session or login timeout behavior.
- scripts/migrar_passwords.php is a one-off maintenance script for password migration, separating operational data tasks from the runtime app.
12. Architecture boundaries to show in a diagram
- One boundary is the container/runtime boundary: browser -> Apache/PHP app -> MariaDB.
- Another is the application boundary: routing/controller/view layer vs. database-backed domain models.
- A third is the filesystem boundary for uploads and static assets, which is important because media and CSS/JS are served directly from public/.
Main entry points: DBAbstractModel.php Domain models · Router.php Router · index_view.php Views · index.php Public webroot
Components 20
Runtime & deploy
Dockerized Apache/PHP application runtime and environment wiring.
- Browser · User-facing entry to the app.
- Compose · Dev/prod container orchestration and environment overrides.
compose/inafinder/docker-compose.yml - PHP image · Built Apache/PHP runtime for the application.
inafinder/Dockerfile - Apache · HTTP server layer inside the container.
inafinder/docker/apache/000-default.conf
Application core
Front controller, routing, controllers, models, and shared security/config.
- Public webroot · Document root and route entry boundary.
inafinder/public/index.php - Bootstrap · Shared configuration and environment wiring.
inafinder/bootstrap.php - Router · Maps URLs to controller actions.
inafinder/app/Core/Router.php - CSRF · Cross-site request forgery protection.
inafinder/app/Core/Csrf.php - Base controller · Shared controller behavior.
inafinder/app/Controllers/BaseController.php - Browse controllers · Public domain controllers for players, skills, and match actions.
inafinder/app/Controllers/JugadoresController.php - Admin controller · Dedicated management flow for technique CRUD.
inafinder/app/Controllers/TecnicaCrudController.php - User controller · Login and user-related endpoints.
inafinder/app/Controllers/UserController.php - Domain models · Database-backed domain objects for players, teams, transfers, wallets, and login records.
inafinder/app/Models/DBAbstractModel.php - Maintenance script · Password migration utility outside the normal request flow.
inafinder/scripts/migrar_passwords.php
Views & assets
Server-rendered templates, partials, and static client-side resources.
- Views · Server-rendered pages for listing, editing, login, and market flows.
inafinder/app/views/index_view.php - Partials · Reusable UI fragments such as navbar, blocks, and alerts.
inafinder/app/views/partials/navbar.php - Static assets · CSS, JavaScript, and direct-served browser resources.
inafinder/public/js/mercado.js
Data layer
Database schema, seed data, and upload storage.
Connections 25
- Browser → Compose: runs via · Development and production deployment are containerized.
- Compose → PHP image: builds · Compose uses the custom PHP/Apache image.
- PHP image → Apache: hosts · Apache serves the application inside the container.
- Apache → Public webroot: serves · Document root points at the public web entrypoint.
- Browser → Public webroot: HTTP requests · All web traffic lands in the front controller.
- Public webroot → Bootstrap: initializes · Shared config and environment are loaded before dispatch.
- Public webroot → Router: dispatches to · Front controller hands off request routing.
- Router → Base controller: instantiates · Controllers share common base behavior.
- Router → Browse controllers: routes to · Public browsing and search endpoints.
- Router → Admin controller: routes to · Administrative technique management endpoints.
- Router → User controller: routes to · Authentication and user endpoints.
- Browse controllers → Domain models: reads/writes · Controllers use domain models for database-backed actions.
- Admin controller → Domain models: reads/writes · CRUD flow persists through the model layer.
- User controller → Domain models: reads/writes · Login and user management interact with user and audit data.
- Browse controllers → Views: renders · Feature controllers return server-rendered pages.
- Admin controller → Views: renders · Admin forms and listings are template-driven.
- User controller → Views: renders · Login and account views are server-rendered.
- Views → Partials: includes · Common UI fragments are shared across pages.
- Views → Static assets: loads · Pages use CSS and JavaScript served from public/ .
- Static assets → CSRF: supports · Client-side CSRF handling complements server protection.
- Domain models → MariaDB: persists to · Domain state is stored in MariaDB.
- MariaDB → SQL dump: initialized by · Database starts from the repository SQL dump.
- Domain models → Uploads: stores media in · Uploaded entity images are filesystem-backed.
- Bootstrap → CSRF: wires · Security utilities are part of app initialization.
- Maintenance script → Domain models: migrates · One-off script operates on stored account data.