How yunggialyana/rpg-elearn works
Main Components
• Frontend Presentation Layer:
• The “public” directory contains user-facing pages including distinct sections for admin, teacher (dosen), and student (siswa). Also, pages like index.php, battle.php, logout.php, and map.php support core functionalities (e.g., gamification, interactive map).
• The “templates” directory holds reusable UI components (alert, avatar, badge_card, quest_box, xp_bar) and layout files (header, footer, navbar, sidebar).
• Backend/API Layer:
• The “api” directory is subdivided into specific endpoints for functions such as analytics, authentication (login/register), handling quest submissions, accessing/mutating data (user profile, XP), badge management, and course content (materi). These endpoints define the service interfaces between the frontend and the business logic.
• Business Logic & Core Services:
• The “includes” directory encapsulates core functionality: authentication, configuration, session management, middleware, logging, and a “core” folder for gamification logics (achievement, badge, event, inventory, level, map, notification, quest, xp). This acts as the central hub where the application’s rules and processes come together.
• The “includes/db.php” likely handles database connectivity.
• Data Persistence:
• The “database” directory contains the SQL schema (rpg-elearn-schema.sql), representing the underlying data model including tables for users, quests, XP, badges, etc.
• Dev Ops & Utilities:
• The “tools” directory includes scripts for backup, exporting user data, and toggling maintenance mode (helpful for deployments and operations).
• The “tests” directory contains test scripts (dummy_user, quest_test, xp_generator) which provide a view into how critical components are validated.
• The “uploads” directory hints at user-submitted or system-uploaded files (e.g., course materials).
Out Relationships & Interactions
• That business logic in the “includes” folder underpins API calls and also interacts directly with the database.
• How user actions (different roles: admin, teacher, student) trigger UI flows that route requests to different API endpoints.
• External utility scripts (“tools”) and “tests” that serve auxiliary functions to support the system.
Architectural Patterns & Design Principles
• MVC or layered separation: Although not a strict MVC framework, the clear separation between frontend pages (views), API endpoints (controllers/services), and business logic/data access layers (models via “includes” and database) is apparent.
• Role-based access: Distinct folder structures for admin, teacher, and student pages indicate separation of concerns and specialized access controls.
• Modularity and reusability: The components in the “templates” and “includes/core” directories emphasize reusable UI and core business logic components.
• Utility/maintenance scripts are separated out to simplify operations and maintenance.