Top-Level Layout
qaflow/
├── admin/ # Admin panel (80+ pages)
├── assets/ # CSS, JS, images, fonts
├── includes/ # Core libraries (DB, auth, functions)
├── install/ # Installer (delete after install)
├── themes/ # Frontend themes (default + custom)
├── uploads/ # User-uploaded content
├── updates/ # Downloaded updates before install
├── cache/ # File-based cache
├── webhook/ # Payment gateway webhook handlers
├── api/ # REST API endpoints
├── xhr/ # AJAX request handlers
├── sources/ # Language / locale files
├── config.php # DB credentials + site URL (created by installer)
├── index.php # Router entry point
├── updater.php # Auto-update installer
├── cron-job.php # Scheduled task runner
└── .htaccess # Apache rewrite rules
Core Files
config.php— DB credentials, site URL. Never committed to git.includes/functions.php— utility functions (5,000+ lines)includes/db.php— PDO wrapper with helpersincludes/update_checker.php— auto-update clientincludes/ai/AIHelper.php— AI provider abstraction (Groq/OpenAI/Gemini/Claude)includes/widgets.php— reusable UI components
Admin Panel Structure
admin/ is flat — each feature is a single PHP file that includes includes/header.php (sidebar + topbar) and includes/footer.php.
admin/index.php → Dashboard
admin/questions.php → Manage questions
admin/users.php → Manage users
admin/ai-settings.php → AI provider config
admin/payment-gateways.php → 31 payment gateway toggles
admin/updates.php → Auto-update UI
...
Theme System
Themes live in themes/. Default theme is themes/default/. Switch via Admin → Appearance → Theme.
Each theme has:
theme.json— metadata (name, author, version)assets/css/theme.css— theme-specific stylestemplates/*.php— optional page overrides
Routing
QAFlow uses .htaccess pretty-URL rewriting. All unknown paths route through index.php which parses the URL and includes the appropriate page file.
Database
See install/database.sql — 45 tables, InnoDB, UTF-8MB4. Main tables: users, questions, answers, votes, notifications, subscriptions, pro_plans, settings.