# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview CLEO is a PHP-based ERP (Enterprise Resource Planning) web application built with a custom MVC framework called "d6". It's a multi-tenant system designed for business management with modules for clients, quotes, markets, invoicing, and more. ## Key Commands ### Development Setup ```bash # Install PHP dependencies composer install # Deploy to development environment (Incus container) ./deploy-cleo-dev.sh ``` ## Architecture ### MVC Structure The application follows a strict MVC pattern with naming conventions: - **Controllers** (`/controllers/`): Prefixed with 'c' (e.g., `cclients.php`) - **Models** (`/models/`): Prefixed with 'm' (e.g., `mclients.php`) - **Views** (`/views/`): Prefixed with 'v' (e.g., `vclients.php`) - **AJAX Controllers**: Prefixed with 'cjx' (e.g., `cjxchat.php`) ### Request Flow 1. `index.php` - Entry point that bootstraps the application 2. `config/init.php` - Sets up constants and loads configuration 3. `pub/res/d6/router.php` - Routes requests to appropriate controllers 4. Controller loads model and view based on naming convention ### Database Architecture - Multi-database setup with three main databases: - `frontal` - Main application data - `group` - Group/organization data - `general` - Shared/general data - Database connections are managed through `config/conf.php` - Multi-tenant support based on HTTP host detection ### Key Framework Components (d6) Located in `/pub/res/d6/`: - `router.php` - Request routing - `session.php` - Session management - `tools.php` - Utility functions - `controller.php` - Base controller class - `model.php` - Base model with database operations ### Deployment - Target: Incus containers on Debian 12 - Web server: nginx - Deployment script handles: - File sync via rsync - Container file transfer - Permission setup (nginx:nginx ownership) - Production URL: dcleo.unikoffice.com ### Important Configuration - Development mode detected by IP whitelist in `config/conf.php` - Entity/tenant selection based on domain (e.g., abc.cleo.com → entity 'abc') - File uploads stored in `/pub/files/upload/` - Session data likely stored server-side with custom handler