How redemapas/mapas works
Main Components Identification
a. Web Server / Request Routing:
• The public entry points are in the “public” folder (index.php, bootstrap.php) which ultimately call the core application bootstrap logic in “src/bootstrap.php”.
• The routing and request dispatching is managed via the “src/core/RoutesManager.php” and the controllers housed in “src/core/Controllers” and within each module.
b. Core Engine and Framework:
• “src/core” contains the core libraries including API classes, authentication providers, error handlers, cache, database connection (“src/core/Connection.php”) and other utilities.
• This layer implements an MVC pattern that separates controllers, models/entities and views/templates.
c. Modular/Plugin Architecture:
• Under “src/modules” are a large number of modules (e.g., Apps, FAQ, Home, LGPD, MailNotification, Opportunities, etc.) that encapsulate distinct features of the system. Each module typically has its own Controller.php, Module.php, configuration, templates, and assets.
• Plugins in “src/plugins” extend the core functionalities (e.g., authentication plugins, spam detectors).
d. Theming and Presentation Layer:
• Located under “src/themes”, this layer holds themes (such as BaseV1, BaseV2 and Subsite) that dictate the frontend look-and-feel.
• Themes include templates, assets (CSS, JavaScript, images), and layout definitions which directly correspond to what the end user sees.
e. Database and Persistence:
• The application uses a PostgreSQL database with PostGIS extensions. Configuration files for the database are in “config/db.php” and “dev/db/…” formats to support different environments.
• ORM and entity definitions are present in “src/core/Entities” and there is support for Doctrine mapping (see “src/core/DoctrineMappings/…”) indicating an ORM layer indexing the business objects.
f. Infrastructure and Deployment:
• Docker configuration files (“docker-compose.yml”, “docker/”, “dev/docker-compose.yml”) define containerized environments for development and production, clearly isolating application, database, and auxiliary services.
• CI/CD configurations appear in “.github/workflows” and “.travis.yml” files for automated testing and builds.
g. Tests & Continuous Integration:
• The “tests” directory contains automated tests for various modules and components ensuring that core functionalities (database, API, controllers, routing, etc.) work as intended.
Relationships and Interactions
• User requests enter through the public web server layer, then traverse the routing mechanism to hit the appropriate Controller within the core or specific module.
• Controllers use the core’s business logic (present in the “src/core” folder) and interact with the database via the ORM and raw queries (in “src/core/Connection.php”).
• When a module (e.g., Opportunities or Home) is invoked, it leverages its own controllers and views to generate dynamic content. These modules can also interact with one another (e.g., via shared entities, notifications, or widget integrations).
• Plugins and themes further enhance or customize the experience. Plugins inject extra authentication, caching, or UI components; themes organize the final HTML/CSS/JS rendering.
• Containerized deployment with Docker ensures that the web server, database, and background jobs (e.g., caching updates, scheduled jobs) run in isolated but interconnected services.
Architectural Patterns and Design Principles
• The project follows a modular, plugin-based, and MVC architecture where core functionality is separated from features packaged as modules.
• There is a strong emphasis on separation of concerns with a clear delineation between backend logic, business rules, and presentation layers.
• The system is environment-aware, having dedicated configuration directories (“config”, “dev/config.d”) and container orchestration scripts which facilitate both local development and production deployment.
Incorporating Relevant Technologies, Frameworks, and Libraries
• PHP (with Composer for dependency management) is the central backend language.
• PostgreSQL with PostGIS for geospatial capabilities.
• Docker for environment management along with Docker Compose.
• Frontend assets are managed with Node.js scripts and Sass (Ruby Sass gem) for CSS, as well as vendor libraries included within themes and modules.
• Testing frameworks and scripts (PHP unit tests, integration tests) are present.