Version: 1.0.0
Last Updated: 2025-12-28
Status: Active
Purpose: Complete guide for regenerating SecuBox modules matching the live demo
📋 FEATURE-REGENERATION-PROMPTS.md - Complete feature specifications for all 15 modules 💻 CODE-TEMPLATES.md - Ready-to-use code templates and implementation examples 🏗️ DEVELOPMENT-GUIDELINES.md - Complete development guidelines and design system ⚡ QUICK-START.md - Quick reference for common tasks 🔧 CLAUDE.md - Build system and architecture reference
This guide shows you how to use the comprehensive documentation to regenerate or create SecuBox modules that match the live demo at secubox.cybermood.eu.
Option A: Use Claude.ai for Code Generation
Option B: Manual Implementation Using Templates
Option C: Hybrid Approach (Recommended)
Before prompting Claude, gather these resources:
# Read the module specification
cat FEATURE-REGENERATION-PROMPTS.md | grep -A 200 "System Hub"
# Review the design system
cat DEVELOPMENT-GUIDELINES.md | grep -A 100 "Design System"
# Check existing implementation (if available)
ls -la luci-app-system-hub/
Create a comprehensive prompt for Claude.ai:
I need you to implement the System Hub module for OpenWrt LuCI framework.
IMPORTANT CONSTRAINTS:
- OpenWrt uses LuCI framework (not React/Vue)
- JavaScript uses L.view.extend() pattern (not ES6 modules)
- Backend is RPCD (shell scripts) communicating via ubus
- CSS must use variables from system-hub/common.css
- All code must be production-ready and match live demo
- Follow the design system exactly
TECHNICAL REQUIREMENTS:
- RPCD script MUST be named: luci.system-hub
- Menu paths MUST match view file locations
- Use CSS variables (--sh-*) for all colors
- Support dark mode with [data-theme="dark"]
- Implement proper error handling
- Add loading states for async operations
REFERENCE DOCUMENTS:
1. Live Demo: https://secubox.cybermood.eu/system-hub
2. Feature Specification: [paste from FEATURE-REGENERATION-PROMPTS.md]
3. Code Templates: [paste relevant templates from CODE-TEMPLATES.md]
Please provide:
1. Complete JavaScript view files (overview.js, services.js, etc.)
2. RPCD backend script (luci.system-hub)
3. API module (system-hub/api.js)
4. CSS styles (system-hub/dashboard.css)
5. Menu configuration JSON
6. ACL configuration JSON
Make sure all code matches the live demo visual design and functionality.
Paste your prompt into Claude.ai and let it generate the implementation.
Check the generated code against these requirements:
API Module Checklist:
'use strict';baseclass and rpcrpc.declare()luci.system-hub)baseclass.extend()View Module Checklist:
view.extend()load() method returning Promiserender(data) methodE() helper for DOM buildingpoll.add() for auto-refreshui.showModal() for loading statesui.addNotification() for user feedbackRPCD Backend Checklist:
#!/bin/sh/lib/functions.sh and /usr/share/libubox/jshn.shlist case with method declarationscall case with method routingjson_* functionsMenu JSON Checklist:
admin/secubox/<category>/<module>"type": "firstchild""type": "view" with correct "path""order" values for menu positioningACL JSON Checklist:
"read"."ubus""write"."ubus"CSS Checklist:
system-hub/common.cssvar(--sh-*))[data-theme="dark"]# Create module directory structure
mkdir -p luci-app-system-hub/htdocs/luci-static/resources/system-hub
mkdir -p luci-app-system-hub/htdocs/luci-static/resources/view/system-hub
mkdir -p luci-app-system-hub/root/usr/libexec/rpcd
mkdir -p luci-app-system-hub/root/usr/share/luci/menu.d
mkdir -p luci-app-system-hub/root/usr/share/rpcd/acl.d
# Copy generated files to appropriate locations
# (Copy from Claude's output to respective files)
# Set RPCD script as executable
chmod +x luci-app-system-hub/root/usr/libexec/rpcd/luci.system-hub
# Fix permissions first (CRITICAL)
./secubox-tools/fix-permissions.sh --local
# Run comprehensive validation (7 checks)
./secubox-tools/validate-modules.sh
# Expected output:
# ✅ All checks passed
# OR
# ❌ Errors found with specific fix instructions
# Build single module
./secubox-tools/local-build.sh build luci-app-system-hub
# Or build all modules
./secubox-tools/local-build.sh build
# Or full validation + build
./secubox-tools/local-build.sh full
# Transfer package
scp build/x86-64/luci-app-system-hub*.ipk root@192.168.1.1:/tmp/
# Install on router
ssh root@192.168.1.1 << 'EOF'
opkg install /tmp/luci-app-system-hub*.ipk
/etc/init.d/rpcd restart
/etc/init.d/uhttpd restart
EOF
# Fix permissions on deployed router (if needed)
./secubox-tools/fix-permissions.sh --remote
http://192.168.1.1/cgi-bin/luciIf issues found:
ssh root@192.168.1.1 "logread | tail -50"ubus call luci.system-hub statusExample: System Hub with 9 tabs
// In render()
var tabs = [
{ id: 'overview', title: 'Overview', icon: '🏠' },
{ id: 'services', title: 'Services', icon: '⚙️' },
{ id: 'logs', title: 'Logs', icon: '📋' }
];
var activeTab = 'overview';
// Render tab navigation
var tabNav = E('div', { 'class': 'sh-nav-tabs' },
tabs.map(function(tab) {
return E('div', {
'class': 'sh-nav-tab' + (activeTab === tab.id ? ' active' : ''),
'click': function() {
// Switch tab logic
document.querySelectorAll('.sh-nav-tab').forEach(function(t) {
t.classList.remove('active');
});
this.classList.add('active');
// Show/hide tab content
}
}, [
E('span', {}, tab.icon),
E('span', {}, tab.title)
]);
})
);
// Render tab content
var tabContent = E('div', { 'class': 'tab-content' }, [
// Overview tab
E('div', { 'class': 'tab-pane' + (activeTab === 'overview' ? ' active' : ''), 'data-tab': 'overview' }, [
this.renderOverviewContent()
]),
// Services tab
E('div', { 'class': 'tab-pane' + (activeTab === 'services' ? ' active' : ''), 'data-tab': 'services' }, [
this.renderServicesContent()
])
]);
Example: SecuBox module grid with category filtering
// Filter tabs
var filterTabs = E('div', { 'class': 'sh-filter-tabs' }, [
E('div', {
'class': 'sh-filter-tab active',
'data-filter': 'all',
'click': function(ev) {
document.querySelectorAll('.sh-filter-tab').forEach(function(t) {
t.classList.remove('active');
});
this.classList.add('active');
self.filterModules('all');
}
}, [
E('span', { 'class': 'sh-tab-icon' }, '📦'),
E('span', { 'class': 'sh-tab-label' }, 'All')
]),
E('div', {
'class': 'sh-filter-tab',
'data-filter': 'security',
'click': function(ev) {
document.querySelectorAll('.sh-filter-tab').forEach(function(t) {
t.classList.remove('active');
});
this.classList.add('active');
self.filterModules('security');
}
}, [
E('span', { 'class': 'sh-tab-icon' }, '🛡️'),
E('span', { 'class': 'sh-tab-label' }, 'Security')
])
]);
// Filter function
filterModules: function(category) {
var modules = document.querySelectorAll('.module-card');
modules.forEach(function(module) {
if (category === 'all' || module.dataset.category === category) {
module.style.display = 'block';
} else {
module.style.display = 'none';
}
});
}
Example: System Hub logs tab
// Logs view with auto-scroll and auto-refresh
renderLogsTab: function() {
var self = this;
var autoScroll = true;
var autoRefresh = true;
var refreshInterval = 5; // seconds
var logsContainer = E('div', { 'class': 'logs-container' });
// Load logs
var loadLogs = function() {
API.getLogs(100, '').then(function(result) {
var logs = result.logs || [];
dom.content(logsContainer,
logs.map(function(log) {
return E('div', { 'class': 'log-line' }, log);
})
);
// Auto-scroll to bottom
if (autoScroll) {
logsContainer.scrollTop = logsContainer.scrollHeight;
}
});
};
// Initial load
loadLogs();
// Auto-refresh
if (autoRefresh) {
setInterval(loadLogs, refreshInterval * 1000);
}
return E('div', {}, [
// Controls
E('div', { 'class': 'logs-controls' }, [
E('label', {}, [
E('input', {
'type': 'checkbox',
'checked': autoScroll,
'change': function() { autoScroll = this.checked; }
}),
' Auto-scroll'
]),
E('label', {}, [
E('input', {
'type': 'checkbox',
'checked': autoRefresh,
'change': function() { autoRefresh = this.checked; }
}),
' Auto-refresh'
]),
E('button', {
'class': 'sh-btn sh-btn-primary',
'click': loadLogs
}, '🔄 Refresh Now')
]),
// Logs display
logsContainer
]);
}
Example: Service management buttons
// Render action button with confirmation
renderActionButton: function(service, action, label, btnClass) {
var self = this;
return E('button', {
'class': 'sh-btn ' + btnClass,
'click': function(ev) {
// Show confirmation modal
ui.showModal(_('Confirm Action'), [
E('p', {}, _('Are you sure you want to %s service %s?').format(action, service)),
E('div', { 'class': 'right' }, [
E('button', {
'class': 'sh-btn sh-btn-secondary',
'click': ui.hideModal
}, _('Cancel')),
E('button', {
'class': 'sh-btn sh-btn-primary',
'click': function() {
ui.hideModal();
self.performServiceAction(service, action);
}
}, _('Confirm'))
])
]);
}
}, label);
},
// Perform service action
performServiceAction: function(service, action) {
var self = this;
ui.showModal(_('Performing Action'), [
E('p', {}, E('em', { 'class': 'spinning' }, _('Please wait...')))
]);
API.serviceAction(service, action).then(function(result) {
ui.hideModal();
if (result.success) {
ui.addNotification(null, E('p', _('Action completed successfully')), 'success');
self.handleRefresh();
} else {
ui.addNotification(null, E('p', _('Action failed: %s').format(result.message)), 'error');
}
}).catch(function(error) {
ui.hideModal();
ui.addNotification(null, E('p', _('Error: %s').format(error.message)), 'error');
});
}
Example: Settings page
renderSettingsForm: function() {
var self = this;
var settings = this.settingsData || {};
return E('form', { 'class': 'settings-form' }, [
// Text input
E('div', { 'class': 'form-group' }, [
E('label', {}, 'Hostname'),
E('input', {
'type': 'text',
'class': 'form-control',
'value': settings.hostname || '',
'id': 'input-hostname'
})
]),
// Number input with validation
E('div', { 'class': 'form-group' }, [
E('label', {}, 'Refresh Interval (seconds)'),
E('input', {
'type': 'number',
'class': 'form-control',
'value': settings.refresh_interval || 30,
'min': 10,
'max': 300,
'id': 'input-refresh'
})
]),
// Checkbox
E('div', { 'class': 'form-group' }, [
E('label', {}, [
E('input', {
'type': 'checkbox',
'checked': settings.auto_refresh || false,
'id': 'input-auto-refresh'
}),
' Enable auto-refresh'
])
]),
// Submit button
E('div', { 'class': 'form-actions' }, [
E('button', {
'class': 'sh-btn sh-btn-primary',
'type': 'submit',
'click': function(ev) {
ev.preventDefault();
self.handleSaveSettings();
}
}, 'Save Settings')
])
]);
},
handleSaveSettings: function() {
var hostname = document.getElementById('input-hostname').value;
var refreshInterval = parseInt(document.getElementById('input-refresh').value);
var autoRefresh = document.getElementById('input-auto-refresh').checked;
// Validate
if (!hostname) {
ui.addNotification(null, E('p', _('Hostname is required')), 'error');
return;
}
if (refreshInterval < 10 || refreshInterval > 300) {
ui.addNotification(null, E('p', _('Refresh interval must be between 10 and 300 seconds')), 'error');
return;
}
// Save via API
API.saveSettings(hostname, refreshInterval, autoRefresh).then(function(result) {
if (result.success) {
ui.addNotification(null, E('p', _('Settings saved successfully')), 'success');
} else {
ui.addNotification(null, E('p', _('Failed to save settings: %s').format(result.message)), 'error');
}
});
}
luci.secubox for module enumerationwg command)cscli command)The production build now includes nine fully supported profiles. Each profile exposes its own RPC (*_config), view, and default values under network-modes.<mode>:
| Mode ID | Description | Notable Features |
|---|---|---|
router |
Standard router | NAT + firewall, DHCP, proxy/HTTPS front-end helpers |
doublenat |
Behind ISP CPE | WAN DHCP client, isolated LAN/guest bridge, UPnP/DMZ controls |
multiwan |
Dual uplink | Health checks, failover hold timers, load-balance/mwan3 |
vpnrelay |
VPN gateway | WireGuard/OpenVPN, kill switch, DNS override, split tunnel |
bridge |
Layer-2 pass-through | No NAT, all ports bridged, DHCP client |
accesspoint |
WiFi AP | Bridge upstream, disable routing/DHCP, 802.11r/k/v toggles |
relay |
WiFi repeater | STA+AP, relayd/WDS, WireGuard assist, MTU/MSS tuning |
travel |
Portable router | Client WiFi scan, MAC clone, WPA3 hotspot, sandbox LAN |
sniffer |
TAP/sniffer | Promiscuous bridge, Netifyd integration, pcap support |
When adding another mode, update: UCI defaults (root/etc/config/network-modes), the RPC script (get_<mode>_config, update_settings, generate_config, set_mode allow-list), the JS API/view/menu, and the docs.
Symptoms:
RPC call to luci.module-name/method failed with error -32000: Object not found
Diagnosis:
# 1. Check RPCD script exists and is executable
ls -la luci-app-module-name/root/usr/libexec/rpcd/
# 2. Check RPCD script name matches ubus object
grep "object:" luci-app-module-name/htdocs/luci-static/resources/module-name/api.js
# 3. Test RPCD script manually
ssh root@router "/usr/libexec/rpcd/luci.module-name list"
# 4. Check RPCD logs
ssh root@router "logread | grep rpcd | tail -20"
Solutions:
luci. prefix)chmod +x luci.module-name/etc/init.d/rpcd restartSymptoms:
HTTP error 404 while loading class file '/luci-static/resources/view/module-name/overview.js'
Diagnosis:
# 1. Check menu path
cat luci-app-module-name/root/usr/share/luci/menu.d/*.json | grep "path"
# 2. Check view file exists
ls -la luci-app-module-name/htdocs/luci-static/resources/view/
# 3. Verify paths match
# Menu: "path": "module-name/overview"
# File: view/module-name/overview.js
Solutions:
Symptoms:
Diagnosis:
# 1. Check browser console for CSS 404 errors
# (Open browser developer tools)
# 2. Verify CSS import in view file
grep "stylesheet" luci-app-module-name/htdocs/luci-static/resources/view/*/overview.js
# 3. Check CSS file exists
ls -la luci-app-module-name/htdocs/luci-static/resources/module-name/dashboard.css
Solutions:
L.resource('module-name/dashboard.css')@import url('../system-hub/common.css');644 for CSS filesSymptoms:
Diagnosis:
# 1. Check poll is registered
# (Look for poll.add() in render() method)
# 2. Check API calls return Promises
# (Verify methods return results from rpc.declare())
# 3. Test API methods directly
ssh root@router "ubus call luci.module-name status"
Solutions:
DO:
DON’T:
DO:
API.getData().then(function(result) {
if (result && result.data) {
// Process data
} else {
console.warn('No data returned');
// Show empty state
}
}).catch(function(error) {
console.error('API error:', error);
ui.addNotification(null, E('p', 'Failed to load data'), 'error');
});
DON’T:
API.getData().then(function(result) {
// Process data without checking
result.data.forEach(function(item) { ... }); // Will crash if data is null
});
DO:
DON’T:
DO:
DON’T:
Before deploying to production:
If you encounter issues not covered in this guide:
./secubox-tools/validate-modules.sh for automated checkslogread | grep -i error on the routerDocument Version: 1.0.0 Last Updated: 2025-12-27 Maintainer: CyberMind.fr Live Demo: https://secubox.cybermood.eu