Complete reference for the AMPBridge service and backend communication.
Central hub for all communication with the Neutralino.js backend.
import { ampBridge } from '@/services/AMPBridge';// No need to instantiate - use the exported singleton
const bridge = ampBridge;Get AMP Manager version info.
Returns:
{
status: string;
version: string;
build: string;
engine: string;
}Example:
const info = await ampBridge.version();
// { status: 'ok', version: '1.0.0', build: '2026-03-07', engine: 'amp-manager' }Check if the AMP backend is available (running in Neutralino).
Returns: boolean
Example:
if (ampBridge.isAvailable()) {
const status = await ampBridge.status();
} else {
console.log('Running in browser dev mode');
}Check if running in development mode (browser localhost).
Returns: boolean
Example:
if (ampBridge.isDevMode()) {
console.log('Dev mode - some features disabled');
}Get overall system status.
Returns: AmpResponse
Get runtime status including Docker containers.
Returns: AmpResponse
Verify environment and get project root.
Returns:
{
status: string;
project_root: string;
[key: string]: any;
}Example:
const env = await ampBridge.envCheck();
// { status: 'ok', project_root: 'C:\\amp' }Clear application cache.
Returns: AmpResponse
Clear log files.
Returns: AmpResponse
Scan Windows hosts file for domain entries.
Returns: AmpResponse
List all configured domains.
Returns: AmpResponse
Create a new local domain.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string |
Domain name (without .local) |
options |
{ scaffold?: boolean } |
Create scaffold files |
Returns: AmpResponse
Example:
const result = await ampBridge.createDomain('myproject', { scaffold: true });Remove a domain.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string |
Domain name to remove |
Returns: AmpResponse
Regenerate domain configuration.
Parameters:
| Name | Type | Description |
|---|---|---|
domain |
string |
Domain name |
Returns: AmpResponse
Execute database query via amp-tasks.bat.
Parameters:
| Name | Type | Description |
|---|---|---|
query |
string |
Query string (e.g., "LIST", "createDB") |
Returns: AmpResponse
Example:
// List databases
const dbs = await ampBridge.dbQuery('LIST');
// Create database
await ampBridge.dbQuery('mydb|||user|||password');
// Delete database
await ampBridge.dbQuery('deletemydb');Check Certificate Authority status.
Returns: AmpResponse
Reset/reinstall CA certificate.
Returns: AmpResponse
Uninstall CA certificate.
Returns: AmpResponse
Regenerate SSL for a domain.
Parameters:
| Name | Type | Description |
|---|---|---|
domain |
string |
Domain name |
Returns: AmpResponse
Regenerate SSL for all domains.
Returns: AmpResponse
Check SSH key status.
Returns:
AmpResponse & {
key_exists: boolean;
fingerprint?: string;
public_key?: string;
key_path?: string;
}Generate new SSH key pair.
Parameters:
| Name | Type | Description |
|---|---|---|
username |
string |
Username for key comment |
Returns:
AmpResponse & {
key_path?: string;
fingerprint?: string;
public_key?: string;
}Operating system operations.
ampBridge.os.open(url: string): Promise<void>
ampBridge.os.execCommand(command: string): Promise<{ exitCode: number; stdOut: string; stdErr: string }>
ampBridge.os.spawnProcess(command: string, options?: { cwd?: string; envs?: Record<string, string> }): Promise<{ id: number; pid: number }>
ampBridge.os.updateSpawnedProcess(id: number, action: string, data?: string): Promise<{ status: string }>
ampBridge.os.getSpawnedProcesses(): Promise<any[]>
ampBridge.os.getEnv(key: string): Promise<string>
ampBridge.os.getEnvs(): Promise<Record<string, string>>
ampBridge.os.showSaveDialog(title?: string, options?: any): Promise<string>
ampBridge.os.showOpenDialog(title?: string, options?: any): Promise<string[]>
ampBridge.os.showFolderDialog(title?: string, options?: any): Promise<string>File system operations.
ampBridge.fs.readTextFile(path: string): Promise<string>
ampBridge.fs.writeTextFile(path: string, content: string): Promise<void>
ampBridge.fs.copyFile(source: string, dest: string): Promise<void>
ampBridge.fs.deleteFile(path: string): Promise<void>
ampBridge.fs.readDirectory(path: string): Promise<any[]>
ampBridge.fs.getFolderSize(path: string): Promise<string>
ampBridge.fs.createDirectory(path: string): Promise<void>
ampBridge.fs.remove(path: string): Promise<void>
ampBridge.fs.getAbsolutePath(path: string): Promise<string>Angie web server operations.
ampBridge.angie.testConfig(): Promise<{ valid: boolean; output: string }>
ampBridge.angie.reload(): Promise<void>
ampBridge.angie.liveStatus(): Promise<AmpResponse>Docker container operations.
ampBridge.docker.stats(): Promise<DockerStat[]>
ampBridge.docker.disk(): Promise<DockerDisk[]>
ampBridge.docker.info(): Promise<any>
ampBridge.docker.envMetrics(): Promise<AmpResponse>
ampBridge.docker.launchDesktop(): Promise<AmpResponse>
ampBridge.docker.startContainers(): Promise<AmpResponse>
ampBridge.docker.stopContainers(): Promise<AmpResponse>
ampBridge.docker.restartAngie(): Promise<AmpResponse>
ampBridge.docker.restartRuntime(): Promise<AmpResponse>
ampBridge.docker.restartFullStack(): Promise<AmpResponse>Workflow execution commands.
ampBridge.workflow.npm(domain: string, cmd: string): Promise<AmpResponse>
ampBridge.workflow.node(domain: string, cmd: string): Promise<AmpResponse>
ampBridge.workflow.shell(domain: string, cmd: string): Promise<AmpResponse>
ampBridge.workflow.git(domain: string, cmd: string): Promise<AmpResponse>
ampBridge.workflow.sftpWithAmpKey(host: string, username: string, localPath: string, remotePath: string): Promise<AmpResponse>
ampBridge.workflow.sftpWithCustomKey(host: string, username: string, localPath: string, remotePath: string, keyContent: string): Promise<AmpResponse>
ampBridge.workflow.webhook(url: string, data: string): Promise<AmpResponse>Neutralino event handling.
ampBridge.events.on(event: string, handler: (data: any) => void): void
ampBridge.events.off(event: string, handler: (data: any) => void): void
ampBridge.events.dispatch(event: string, data?: any): voidWindow management.
ampBridge.window.minimize(): void
ampBridge.window.maximize(): void
ampBridge.window.unmaximize(): void
ampBridge.window.isMaximized(): void
ampBridge.window.close(): void
ampBridge.window.setDraggableRegion(id: string): voidApplication control.
ampBridge.app.exit(): voidimport { databaseService } from '@/services/DatabaseService';
const databases = await databaseService.listDatabases();
await databaseService.createDatabase('mydb|||user|||pass');
await databaseService.deleteDatabase('mydb');
await databaseService.launchTool('https://localhost:8080', 'url');interface AmpResponse {
status: 'ok' | 'error';
message?: string;
details?: string;
[key: string]: any;
}interface DockerStat {
name: string;
cpu: string;
memory: string;
status: string;
}interface DockerDisk {
name: string;
size: string;
}if (ampBridge.isAvailable()) {
const status = await ampBridge.status();
} else {
console.log('Running in browser mode');
}const result = await ampBridge.workflow.shell('mydomain.local', 'npm install');
if (result.status === 'ok') {
console.log(result.message);
}const content = await ampBridge.fs.readTextFile('C:\\amp\\config\\app.conf');AMP Manager includes safeguards against NeutralinoJS idle freezes:
Starts a heartbeat to prevent the app from hanging during idle periods.
import { startKeepalive } from '@/services/AMPBridge';
// Start heartbeat every 30 seconds (default)
startKeepalive(30000);Note: The keepalive pings silently fail. If the backend becomes unresponsive, the
serverOfflineevent fires and triggers a navigation to the login screen.Diagnostic: Check browser console for
[AMP] Keepalivelogs to verify the heartbeat is firing.
When the NeutralinoJS backend becomes unresponsive (freeze detection), the app automatically navigates to / which triggers the login modal. This ensures:
- User is prompted to re-authenticate after idle periods
- No duplicate error messages
- Clean session recovery
Diagnostic: Check browser console for
[AMP] serverOffline event firedwhen disconnect occurs.
If the app becomes unresponsive after idle:
- Open browser DevTools (F12) -> Console tab
- Look for
[AMP]log messages:[AMP] Keepalive starting with 30000ms interval- keepalive active[AMP] Keepalive ping #N failed- backend not responding[AMP] serverOffline event fired- critical disconnect detected
- Check NeutralinoJS logs in app data folder
Execute commands with automatic timeout to prevent hangs.
import { execWithTimeout } from '@/services/AMPBridge';
// Execute with 30 second timeout
const result = await execWithTimeout('docker ps', 30000);- already documented above as
ampBridge.isDevMode()
Execute a backend call with retry logic.
import { execWithRetry } from '@/services/AMPBridge';
// Retry 3 times with exponential backoff
const result = await execWithRetry(() => ampBridge.status(), 3, 1000);Start heartbeat to prevent Windows suspension.
import { startKeepalive } from '@/services/AMPBridge';
startKeepalive(30000); // 30 second intervalStop the heartbeat keepalive.
import { stopKeepalive } from '@/services/AMPBridge';
stopKeepalive();Spawn watchdog for zombie app recovery.
ampBridge.spawnWatchdog();
// Called automatically on app startup