CFCRM Web Application Structure ================================ Project Directory Layout: ------------------------ /cfcrm/ ├── config/ # Configuration files │ └── database.php # Database connection settings │ ├── lib/ # Library/utility files │ ├── auth.php # Authentication functions │ └── helpers.php # Helper functions (sanitize, format, etc) │ ├── models/ # Data models (one per table) │ ├── User.php # User operations │ ├── Customer.php # Customer operations │ ├── Address.php # Address operations │ ├── Invoice.php # Invoice operations │ ├── Appointment.php # Appointment operations │ └── Part.php # Parts operations │ ├── db/ # Database scripts │ └── schema.sql # Database table definitions │ └── public/ # Web root (publicly accessible) ├── login.php # Login page ├── logout.php # Logout handler ├── dashboard.php # Main dashboard ├── customers.php # Customer listing └── api.php # AJAX API endpoint File Organization Philosophy: ----------------------------- - Each file has a single, specific purpose - Models handle all database operations for their table - Authentication is centralized in lib/auth.php - Helper functions are reusable across all pages - Public folder is the web root for security - All database queries use prepared statements Key Features: ------------ - Mobile-first responsive design - Role-based access control (RBAC) - Address-centric data architecture - Clean separation of concerns - PDO with prepared statements for security - UUID primary keys for scalability Setup Instructions: ------------------ 1. Upload files to server 2. Set web root to /public directory 3. Import db/schema.sql to MySQL 4. Update config/database.php if needed 5. Create initial admin user via MySQL Security Notes: -------------- - All inputs sanitized - Passwords hashed with bcrypt - Session-based authentication - Role checks on every protected page - Prepared statements prevent SQL injection Development Notes: ----------------- - Follow existing patterns for new pages - Keep files short and focused - Use helper functions for common tasks - Test on mobile devices first - Maintain clean, consistent code style