How aaadityapal/connect works
Main Components
• Frontend/UI Layer: Capture pages like login.php, dashboards (admin_dashboard.php, employee_dashboard.php, manager_dash.php, etc.), and various HTML/CSS/JS resources (found under assets, css, js, modal_contents, etc.). Identify the templates and static assets that render the views.
• Backend/API Layer: Represent the core PHP scripts and API endpoints. The file tree shows many PHP scripts that handle user authentication (login.php, logout.php, auth_check.php), customer and sales data management (add_announcement.php, add_employee.php, add_project.php, etc.), and extensive API sub-folders (like api/, which contains endpoints for project/task management, file uploads, chat, etc.). Include also the business logic functions and utility functions (like functions.php and includes/).
• Database: Show the MySQL/MariaDB data store, with key tables such as users, customers, sales, tasks, documents, roles, and permissions (as outlined in the README and supported by SQL files in the file tree). Also note that SQL files are available for schema definitions and triggers.
• External Dependencies & Libraries: Include Composer (vendor/), and Node.js dependencies (package.json, package-lock.json) plus 3rd-party libraries like Bootstrap, jQuery, and TCPDF for PDF generation.
• File Storage: Represent the uploads directories for documents, profile images, and project files which are used for document management within the CRM.
• Web Server & Environment: Represent Apache/Nginx (with .htaccess in several folders) and environment configuration (.env, config files) that manage DB and server settings.
Relationships and Interactions
• The frontend communicates with the backend through form submissions, AJAX calls (handled by various ajax_handlers/ and assets/api/ endpoints), and through API endpoints (under api/).
• The backend interacts with the database for all CRUD operations (user management, customer data, sales, tasks, etc.) using configuration scripts found in config/, includes/ and api/config/.
• There is also file handling for uploads, document viewing (e.g., view_document.php, download.php), and chat functionality (websocket/ChatServer.php, chat-popup).
Key Architectural Patterns and Design Principles
• Layered Architecture: Separation between the presentation (HTML/CSS/JS), business logic (PHP scripts), and data persistence (MySQL).
• Role-based Access Control: Multiple PHP files implementing login, role checking, and user session handling (includes/auth_check.php, process_login.php, etc.).
• API-style Communication: Dedicated API endpoints (in the api/ folder) for operations like adding projects or tasks.
• Modular Components: Though many PHP files exist in the root, there are logical groupings (for example, HR components, project management, chat) that should be depicted as modules.
• Use of Standard Libraries: TCPDF for PDF generation and the composer-managed vendor libraries for external functions.