How markokroselj/launch-tracker works
Main Components
• Frontend:
– Views: Found in the “view” folder and its “components” subdirectory. Includes pages like home, dashboard, 404/500 error handling, and various forms (e.g., addLaunch.php).
– Public Assets: Static files such as images, PDF report, CSS (compiled from Tailwind CSS via an input file and configured with tailwind.config.js), and the entry front-end file “index.php.”
• Back-end:
– Controllers: Stored in the “controller” directory (Controller.php, jwtAuth.php, callback.php) that handle routing, authentication, and application logic.
– Models: In the “model” folder; these files (e.g., Launch.php, User.php, Rocket.php, Orbit.php, etc.) interact with the database.
– Routing: “router.php” along with the .htaccess file which manages Apache routing hints.
• Configuration & Dependency Management:
– Environment Variables: Managed via a .env file loaded by PHP dotenv.
– Composer and Node.js: “composer.json” for PHP dependencies and “package.json” with Node scripts for building CSS.
• Database:
Relationships & Interactions
– User Requests: Start at “index.php” and “router.php” (with routing rules defined in .htaccess). Incoming requests are passed on to the appropriate controller.
– Controllers use Models to fetch or update data in the MySQL database.
– Views render the data and include components like headers, footers, and tables.
– Async interactions and form submissions are enhanced by HTMX on the client side.
– Authentication: JWT and GitHub OAuth, as seen by dependencies in composer.json, facilitate secure user login and callbacks.
– Build Process: Node.js scripts (build:css, build:min-css) handle the styling part using Tailwind CSS.
Architectural Patterns and Design Principles
• MVC Structure: Separate concerns into Models, Views, and Controllers.
• Routing and Middleware: Use of .htaccess along with dedicated routing (router.php) to direct user requests.
• Modular Components: Reusable view components (header, footer, menu) increase maintainability.
• Use of Environment Variables: Centralized configuration management using PHP dotenv.