# 🚀 SaaS Master Multi-Tool Platform A complete WordPress-based SaaS platform for hosting 150+ individual tools with separate subdomains, authentication, credit system, and pro subscriptions. ## 📁 Project Structure ``` /public_html/ ├── .htaccess # Subdomain routing + WordPress exclusions ├── wp-content/plugins/ │ └── saas-master-api/ │ └── saas-master-api.php # Backend API plugin v1.6.0 ├── saas-frontend/ │ ├── index1.html # Boxed design template (CURRENT) │ ├── index.html # Flat design template (ALT) │ ├── generate-tools.php # Tool generator script │ └── youtube-downloader/ │ └── index.html # Individual tool (200 lines each) └── [WordPress core files] ``` ## 🎨 Design System (Boxed Template - index1.html) ### Color Scheme - **Main Background:** `#9ab6c1` (blue-gray) - **Box Interiors & Title:** `#dfeef4` (light blue) - **Buttons/Actions:** `#4a5c6a` (darker blue) - **Hover Effects:** `#3a4c5a` (darkest blue) - **Success Messages:** `#c8d8df` with `#6b8491` border - **Error Messages:** `#d4b5b5` with `#8f6b6b` border ### Component Structure ```css .main-nav # Top navigation bar .header # Tool title area (#dfeef4 background) .auth-section # Login/Register/Guest options .user-info # User credits and logout .main-card # Main tool interface (#dfeef4 background) .pro-features # Pro upgrade box .related-tools # Cross-promotion section .ad-section # AdSense placeholder ``` ## 🔧 Backend API (WordPress Plugin) ### File Location ``` /wp-content/plugins/saas-master-api/saas-master-api.php ``` ### Key Features - ✅ JWT Authentication integration - ✅ Credit system with user management - ✅ Tool access control (free/paid/subscription tiers) - ✅ Usage logging and analytics - ✅ IP-based free tier limiting (5 uses/day) - ✅ CORS support for *.bulkcreator.com - ✅ Admin dashboard with user/tool management ### API Endpoints ``` Base URL: https://bulkcreator.com/wp-json/saas-api/v1/ POST /tools/{slug}/execute # Execute tool functionality GET /status # Get user credits and info GET /tools # List all available tools GET /tools/{slug} # Get specific tool details ``` ### Database Tables ```sql wp_saas_master_usage_logs # Track all tool usage wp_usermeta # Store user credits (_saas_master_credits) wp_posts (saas_tool CPT) # Tool configurations ``` ## 🌐 Frontend Architecture (Separate Tools) ### Template System Each tool is a **completely separate HTML file** (200 lines) based on index1.html template: ```html {{TOOL_TITLE}}

{{TOOL_TITLE}}

{{TOOL_DESCRIPTION}}

...
{{TOOL_SPECIFIC_FIELDS}}
...
``` ### Subdomain Routing ```apache # .htaccess configuration RewriteCond %{HTTP_HOST} ^([^.]+)\.bulkcreator\.com$ [NC] RewriteCond %{REQUEST_URI} !^/saas-frontend/ RewriteRule ^(.*)$ /saas-frontend/%1/index.html [L] ``` **Flow:** `youtube-downloader.bulkcreator.com` → `/saas-frontend/youtube-downloader/index.html` ## 🛠️ Tool Configuration System ### Plugin Settings (WordPress Admin) ``` Microservice URL: http://localhost:3001/process-video Microservice API Key: a-very-strong-and-secret-key-shared-with-wp Default User Credits: 100 Free Tier Daily Limit: 5 Max File Size (MB): 10 Enable API Logging: ✓ (for debugging) ``` ### Tool Generator (generate-tools.php) ```php $tools = [ 'youtube-downloader' => [ 'title' => 'YouTube Downloader', 'description' => 'Download YouTube videos in various formats', 'category' => 'video', 'primary_color' => '#9ab6c1', 'secondary_color' => '#dfeef4', 'related' => ['video-converter', 'audio-extractor'], 'pro_features' => ['HD Quality', '4K Support', 'No Ads'], 'fields' => [ [ 'name' => 'videoUrl', 'label' => 'YouTube URL', 'type' => 'url', 'required' => true ] ], 'submit_text' => 'Download Video' ] ]; ``` ## 🔐 Authentication & Access Control ### Free Tier (Anonymous Users) - 5 uses per day per IP per tool - Standard quality/features only - Shows ads - LocalStorage tracking: `free_usage_{tool-slug}` ### Registered Users - 20 uses per day (configurable) - Credit system integration - No ads for logged users - JWT token authentication ### Pro Users - Unlimited usage - Premium features unlocked - Priority support - Access to all 150+ tools ### Auth Flow ```javascript // Login POST /wp-json/jwt-auth/v1/token { username: email, password: password } → { token: "jwt_token_here" } // Tool Access POST /wp-json/saas-api/v1/tools/youtube-downloader/execute Headers: { Authorization: "Bearer jwt_token" } → Deducts credits, logs usage, returns result ``` ## 📊 User Management ### WordPress Admin Features - **Dashboard:** Usage stats, recent activity - **Users & Credits:** Bulk credit management - **Tools Management:** Create/edit tool configurations - **Settings:** API configuration, limits ### Credit System ```php // Check user credits $credits = get_user_meta($user_id, '_saas_master_credits', true); // Deduct credits saas_deduct_credits($user_id, $cost); // Log usage saas_log_usage($user_id, $tool_id, $ip, $credits_used); ``` ## 🎯 Creating New Tools ### 1. Add Tool Configuration Edit `generate-tools.php` and add new tool: ```php 'pdf-converter' => [ 'title' => 'PDF Converter', 'description' => 'Convert documents to PDF format', 'category' => 'document', 'primary_color' => '#9ab6c1', 'secondary_color' => '#dfeef4', 'fields' => [ [ 'name' => 'file', 'label' => 'Select Document', 'type' => 'file', 'accept' => '.doc,.docx,.pdf' ] ] ] ``` ### 2. Generate Tool Files ```bash php generate-tools.php # Creates: /saas-frontend/pdf-converter/index.html ``` ### 3. Add Backend Logic Edit `saas-master-api.php` in `handle_saas_tool_execution()`: ```php if ( $tool_slug_from_url === 'pdf-converter' ) { $file = $request->get_param('file'); // Process PDF conversion return new WP_REST_Response(['success' => true, 'data' => $result]); } ``` ### 4. Configure DNS Add subdomain: `pdf-converter.bulkcreator.com` → Server IP ## 📁 File Permissions ```bash # Correct ownership chown -R bulkc7087:bulkc7087 /saas-frontend/ chmod 644 /saas-frontend/*.html chmod 755 /saas-frontend/*/ ``` ## 🚀 Deployment Checklist ### DNS Configuration (GoDaddy) - [ ] A Record: `@` → Server IP - [ ] A Record: `www` → Server IP - [ ] A Record: `*` → Server IP (wildcard for subdomains) ### WordPress Setup - [ ] Install SaaS Master API plugin - [ ] Configure JWT Authentication plugin - [ ] Set plugin settings (API keys, limits) - [ ] Create initial tool configurations ### File Structure - [ ] Upload .htaccess with subdomain routing - [ ] Create /saas-frontend/ directory - [ ] Upload index1.html template - [ ] Generate individual tool files - [ ] Test direct file access ### Security & Performance - [ ] Enable HTTPS for all subdomains - [ ] Configure CORS headers - [ ] Set up file upload limits - [ ] Enable gzip compression - [ ] Add security headers ## 🔍 Testing URLs ### Direct File Access - `https://bulkcreator.com/saas-frontend/index1.html` - `https://bulkcreator.com/saas-frontend/youtube-downloader/index.html` ### Subdomain Routing - `https://youtube-downloader.bulkcreator.com` - `https://pdf-converter.bulkcreator.com` ### API Endpoints - `https://bulkcreator.com/wp-json/saas-api/v1/status` - `https://bulkcreator.com/wp-json/saas-api/v1/tools` ## 🐛 Common Issues & Solutions ### 404 Errors on Subdomains 1. Check wildcard DNS propagation: `https://whatsmydns.net` 2. Verify .htaccess subdomain routing rules 3. Confirm file permissions (644 for HTML files) ### WordPress Intercepting Requests ```apache # Ensure .htaccess excludes saas-frontend RewriteCond %{REQUEST_URI} ^/saas-frontend/ RewriteRule ^(.*)$ - [L] ``` ### Modal Display Issues ```css /* Fix z-index conflicts */ z-index: 99999 !important; background: rgba(0,0,0,0.8) !important; ``` ### Authentication Failures 1. Check JWT_AUTH_SECRET_KEY in wp-config.php 2. Verify CORS settings for *.bulkcreator.com 3. Test API endpoints directly ## 📈 Scaling to 150+ Tools ### Performance Optimization - Use CDN for static assets - Enable object caching - Optimize database queries - Implement API rate limiting ### Content Management - Batch tool generation scripts - Automated testing for all tools - Version control for template updates - SEO optimization per tool ### Monitoring & Analytics - Track usage per tool - Monitor server resources - User behavior analytics - Revenue tracking ## 🎨 Customization Guide ### Changing Color Scheme Update these variables in index1.html template: ```css /* Main colors */ body { background: #9ab6c1; } /* Page background */ .header { background: #dfeef4; } /* Title area */ .main-card { background: #dfeef4; } /* Tool interface */ .btn { background: #4a5c6a; } /* Buttons */ ``` ### Adding New Form Fields ```javascript // In tool configuration fields: [ { name: 'fieldName', label: 'Field Label', type: 'text|url|file|select|textarea', placeholder: 'Placeholder text', required: true|false, pro: true|false // Pro feature flag } ] ``` ### Custom Tool Categories ```php // Add to related tools database $all_tools = [ 'seo-category' => [ 'keyword-research' => 'Keyword Research Tool', 'backlink-checker' => 'Backlink Checker', 'meta-generator' => 'Meta Tag Generator' ] ]; ``` --- ## 📞 Support & Documentation - **Plugin Admin:** WordPress Admin → SaaS Master - **Template Base:** `/saas-frontend/index1.html` (boxed design) - **Generator:** `/saas-frontend/generate-tools.php` - **API Docs:** Built into plugin admin interface **Current Status:** ✅ Working with YouTube Downloader as reference implementation