Disaster Recovery Plan
Run ID: 69cc6d643e7fb09ff16a1d012026-04-01Infrastructure
PantheraHive BOS
BOS Dashboard

Generate a comprehensive disaster recovery plan with RTO/RPO targets, backup strategies, failover procedures, communication plans, and testing schedules.

As part of the "Disaster Recovery Plan" workflow, this deliverable outlines a comprehensive Disaster Recovery Plan (DRP) tailored to ensure business continuity and minimize the impact of disruptive events. This plan incorporates RTO/RPO targets, robust backup strategies, detailed failover procedures, clear communication protocols, and a structured testing schedule.

Disaster Recovery Plan (DRP)

1. Executive Summary

This Disaster Recovery Plan (DRP) provides a structured approach for [Organization Name] to respond to and recover from significant disruptions that could impact critical IT systems and business operations. The primary objective is to restore essential services within defined Recovery Time Objectives (RTOs) and minimize data loss within Recovery Point Objectives (RPOs), thereby ensuring business continuity, protecting data integrity, and maintaining stakeholder confidence. This plan encompasses strategies for data backup, system failover, emergency communication, and regular testing to ensure readiness.

2. Introduction and Purpose

The purpose of this DRP is to:

  • Minimize the impact of disasters on critical business functions and IT infrastructure.
  • Provide clear, actionable procedures for the Disaster Recovery Team.
  • Define roles, responsibilities, and communication protocols during a disaster.
  • Ensure the rapid and effective recovery of systems and data to pre-defined operational levels.
  • Safeguard the organization's assets, reputation, and compliance standing.

3. Scope

This DRP covers all critical IT infrastructure, applications, data, and associated business processes essential for [Organization Name]'s core operations. This includes:

  • Primary Data Centers/Server Rooms: [List specific locations, e.g., Main Office Server Room, Cloud Infrastructure (AWS/Azure/GCP)]
  • Critical Applications: [List key applications, e.g., ERP, CRM, Financial Systems, Email, Web Services]
  • Critical Data: [List types of data, e.g., Customer Data, Transactional Data, Intellectual Property, Employee Records]
  • Network Infrastructure: [e.g., WAN, LAN, VPN access]
  • Key Personnel: All designated DRP team members and critical business unit leaders.

Disasters covered include, but are not limited to: natural disasters (e.g., floods, fires, earthquakes), cyber-attacks (e.g., ransomware, data breaches), major equipment failures, power outages, and human error.

4. DRP Team and Roles

A dedicated Disaster Recovery Team is crucial for effective plan execution.

| Role | Primary Contact | Alternate Contact | Responsibilities | Disaster Recovery Manager (DRP Team Lead) | CTO / Head of Infrastructure | Leads all DRP activities, declares a disaster, authorizes recovery efforts, and makes critical decisions. Ensures DRP is updated and tested.

gemini Output

Disaster Recovery Plan

Document Version: 1.0

Date: October 26, 2023

Prepared For: [Customer Company Name]

Prepared By: PantheraHive


1. Executive Summary

This Disaster Recovery Plan (DRP) outlines the strategies, procedures, and responsibilities for responding to and recovering from a disruptive event that impacts critical IT systems and business operations at [Customer Company Name]. The primary objective of this DRP is to minimize downtime, prevent data loss, and ensure the timely restoration of critical business functions, thereby safeguarding the company's assets, reputation, and ability to serve its customers.

This plan focuses on achieving defined Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs) for critical systems, establishing clear communication protocols, and implementing robust testing and maintenance schedules to ensure preparedness.

2. Introduction

2.1. Purpose

The purpose of this Disaster Recovery Plan is to provide a comprehensive, actionable framework for the IT department and relevant business units to follow in the event of a disaster. It serves as a guide to:

  • Identify critical systems and their recovery requirements.
  • Detail backup and data recovery strategies.
  • Outline failover and failback procedures.
  • Define communication protocols during and after a disaster.
  • Establish a regular testing and maintenance schedule for the DRP.

2.2. Scope

This DRP covers the recovery of all critical IT infrastructure, applications, and data essential for the continued operation of [Customer Company Name]'s core business functions. This includes, but is not limited to:

  • Primary data center facilities (on-premise and/or cloud infrastructure).
  • Critical business applications (e.g., ERP, CRM, financial systems, customer-facing portals).
  • Network infrastructure (LAN, WAN, VPN).
  • Data storage systems.
  • Telephony and communication systems.
  • Employee workstations and access.

2.3. Objectives

Upon activation, the DRP aims to achieve the following objectives:

  • Minimize Downtime: Restore critical systems and services within their defined RTOs.
  • Prevent Data Loss: Recover data up to its defined RPO, minimizing data loss.
  • Ensure Business Continuity: Enable the continuation of essential business operations.
  • Protect Assets: Safeguard IT infrastructure, data, and intellectual property.
  • Maintain Reputation: Demonstrate resilience and reliability to customers, partners, and stakeholders.
  • Comply with Regulations: Adhere to relevant industry and regulatory requirements.

3. Key Definitions

  • Disaster Recovery (DR): The process of restoring critical IT systems and data after a disruptive event.
  • Business Continuity (BC): The overall process of identifying potential threats to an organization and building organizational resilience with the capability to safeguard personnel and assets and continue to function in the event of an emergency or disaster.
  • Recovery Time Objective (RTO): The maximum tolerable duration of time that a computer system, network, or application can be down after a disaster or disruption without causing significant damage to the business.
  • Recovery Point Objective (RPO): The maximum tolerable amount of data that can be lost from an IT service due to a major incident. It is measured in time (e.g., 4 hours of data loss).
  • Critical System: An IT system or application whose unavailability would cause unacceptable impact to business operations.
  • Failover: The process of switching to a redundant or standby system upon the failure or abnormal termination of the previously active system.
  • Failback: The process of restoring operations to the primary production environment after a failover has occurred and the primary environment has been restored.

4. Disaster Recovery Team

The Disaster Recovery Team (DRT) is responsible for executing this plan. Roles and responsibilities are defined below. Specific individuals and their contact information are maintained in Appendix A: Contact List.

| Role | Responsibilities |

| :------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

| DR Coordinator / Incident Manager | Overall management and leadership of the DR effort. Declares a disaster, activates the DRP, coordinates all recovery activities, manages communications with executive management and external stakeholders. |

| Infrastructure Lead | Manages the recovery of physical/virtual servers, networking equipment, storage, and other core infrastructure components. Oversees failover to DR site/cloud and ensures connectivity. |

| Applications Lead | Oversees the recovery and validation of critical business applications. Coordinates with business units to ensure application functionality and data integrity. |

| Data Lead | Manages data restoration from backups, ensuring data integrity and consistency. Oversees database recovery and synchronization. |

| Network & Security Lead | Responsible for restoring network connectivity, configuring firewalls, VPNs, and ensuring the security of the recovered environment. Manages DNS, IP addressing, and external access. |

| Communications Lead | Manages all internal and external communications during a disaster. Drafts and distributes status updates, press releases (if necessary), and coordinates with the DR Coordinator. |

| Business Unit Representatives | Provide business context, assist in validating recovered systems and data, and support business operations from the recovery site or alternative locations. (e.g., Finance, Sales, Operations, HR representatives) |

| Vendor Liaison | Coordinates with critical third-party vendors (e.g., cloud providers, hardware/software support, internet service providers) to facilitate recovery efforts. |

5. Business Impact Analysis (BIA) Summary & Critical Systems

A comprehensive BIA has identified and prioritized the following critical systems and their associated recovery requirements. This summary serves as a foundation for setting RTOs and RPOs.

| System/Application ID | System Name | Business Function Supported | Impact Level (High, Medium, Low) | Data Classification | RTO Target | RPO Target | Recovery Tier |

| :-------------------- | :---------------------- | :-------------------------------------------------------- | :------------------------------- | :-------------------- | :----------------- | :----------------- | :------------ |

| APP-001 | ERP System (e.g., SAP) | Order Processing, Inventory, Financials, Manufacturing | High | Confidential | 4 Hours | 1 Hour | Tier 1 |

| APP-002 | CRM System (e.g., Salesforce) | Customer Management, Sales Pipeline, Support Tickets | High | Confidential | 8 Hours | 2 Hours | Tier 1 |

| APP-003 | Primary Database Server | Core Application Data Store (e.g., SQL Server, Oracle) | High | Confidential | 4 Hours | 1 Hour | Tier 1 |

| APP-004 | Web Server Cluster | Customer-Facing Website, E-commerce Portal | High | Public | 8 Hours | 2 Hours | Tier 2 |

| APP-005 | Email System (e.g., M365) | Internal/External Communications | Medium | Internal | 12 Hours | 4 Hours | Tier 2 |

| APP-006 | File Shares | Document Storage, Collaboration | Medium | Internal | 24 Hours | 4 Hours | Tier 3 |

| APP-007 | Development/Test Env. | Software Development, QA | Low | Internal | 48 Hours | 24 Hours | Tier 4 |

| Add more as needed | | | | | | | |

Recovery Tiers:

  • Tier 1 (Critical): Must be recovered first, highest RTO/RPO requirements.
  • Tier 2 (Essential): Important for business operations but can tolerate slightly longer downtime.
  • Tier 3 (Important): Can sustain moderate downtime without severe business impact.
  • Tier 4 (Non-Critical): Can be recovered last, or on an as-needed basis.

6. Recovery Objectives (RTO/RPO Targets)

Based on the BIA, the following RTO and RPO targets have been established for different tiers of systems:

6.1. Recovery Time Objectives (RTO)

| Recovery Tier | RTO Target | Description |

| :------------ | :--------- | :----------------------------------------------------------------------------- |

| Tier 1 | 4-8 Hours | Critical systems required for core business functions. |

| Tier 2 | 8-24 Hours | Essential systems, significant impact if unavailable, but can tolerate some delay. |

| Tier 3 | 24-48 Hours| Important systems, moderate impact if unavailable. |

| Tier 4 | >48 Hours | Non-critical systems, minimal business impact if unavailable for extended periods. |

6.2. Recovery Point Objectives (RPO)

| Recovery Tier | RPO Target | Description |

| :------------ | :--------- | :----------------------------------------------------------------------------- |

| Tier 1 | 1-2 Hours | Minimal data loss tolerated. Achieved via continuous replication or very frequent snapshots. |

| Tier 2 | 2-4 Hours | Low data loss tolerated. Achieved via frequent snapshots or transaction log shipping. |

| Tier 3 | 4-12 Hours | Moderate data loss tolerated. Achieved via daily backups with incremental/differential. |

| Tier 4 | >12 Hours | Higher data loss tolerated. Achieved via daily or weekly backups. |

7. Backup and Data Recovery Strategies

A multi-layered backup strategy ensures data availability and recoverability.

7.1. Backup Types and Frequency

| System/Data Type | Backup Type | Frequency | Retention Policy |

| :---------------------- | :------------------------- | :-------------- | :--------------------------------------------- |

| Tier 1 Applications | Full, Incremental, Log | Daily Full, Hourly Incremental/Log shipping | 7 days daily, 4 weeks weekly, 12 months monthly |

| Tier 2 Applications | Full, Differential | Daily Full, 4-hourly Differential | 7 days daily, 4 weeks weekly, 6 months monthly |

| Tier 3 Applications | Full, Incremental | Daily Full, Daily Incremental | 30 days daily, 3 months weekly |

| User Data (File Shares) | Full, Incremental | Daily Full, Hourly Incremental | 90 days daily, 1 year monthly |

| Configuration Files | Full | Daily | 30 days |

| Operating Systems | Snapshot/Image | Weekly | 4 weeks |

7.2. Backup Locations and Storage

  • Primary On-site Storage: Backups stored locally on NAS/SAN for quick recovery of recent data.
  • Off-site Replication: All critical backups are replicated to an off-site location (e.g., secondary data center, cloud storage like AWS S3/Azure Blob) for protection against site-wide disasters.
  • Cloud Archival: Long-term archival of historical backups (e.g., monthly, yearly) to cost-effective cloud storage tiers (e.g., AWS Glacier, Azure Archive Storage).
  • Immutable Backups: Critical data backups are configured with immutability where possible to protect against ransomware and accidental deletion.

7.3. Encryption and Security

  • All data at rest (on-site and off-site) is encrypted using AES-256.
  • All data in transit during replication or transfer is encrypted using TLS 1.2+.
  • Access to backup systems and storage is restricted to authorized personnel only, utilizing Multi-Factor Authentication (MFA).
  • Backup credentials are managed securely via a privileged access management (PAM) solution.

7.4. Data Restoration Procedures

  1. Identify Data Loss/Corruption: Determine the extent and nature of data loss.
  2. Locate Backup: Identify the appropriate backup set based on the required RPO.
  3. Isolate Affected Systems: If corruption or malware is suspected, isolate the affected systems before restoration.
  4. Restore to Staging: Restore data to a staging environment first to verify integrity and functionality.
  5. Perform Restoration: Execute the restoration process to the production environment or DR site.
  6. Validate Data: Verify data integrity, consistency, and application functionality post-restoration.
  7. Documentation: Document the restoration event, including timestamps, issues, and resolutions.

8. Disaster Detection and Declaration

8.1. Criteria for Declaring a Disaster

A disaster is declared when a disruptive event significantly impacts critical IT services and/or facilities, making normal operations impossible and exceeding standard incident management capabilities. Examples include:

  • Major power outage affecting primary data center for more than [X] hours.
  • Physical damage to the primary data center (fire, flood, earthquake).
  • Widespread network failure preventing access to critical systems.
  • Catastrophic hardware failure impacting multiple critical servers.
  • Major cyber-attack (e.g., ransomware, data breach) compromising critical systems and data.
  • Loss of critical personnel impacting IT operations.

8.2. Initial Assessment Steps

  1. Immediate Notification: Report the incident to the DR Coordinator and relevant IT management.
  2. Damage Assessment: The Infrastructure Lead and Network & Security Lead conduct a rapid assessment to determine the extent of the damage, affected systems, and estimated downtime.
  3. Severity Determination: DR Coordinator, in consultation with leads, determines the severity and potential impact on business operations.
  4. Disaster Declaration: Based on the assessment, the DR Coordinator (or designated alternate) declares a disaster and officially activates the DRP.

8.3. Notification Process

  1. DR Team Activation: DR Coordinator initiates the DR team call tree (see Appendix A: Contact List).
  2. Executive Management Notification: DR Coordinator notifies executive leadership.
  3. Internal Stakeholder Notification: Communications Lead prepares and distributes initial internal communications to employees.
  4. External Stakeholder Notification: Communications Lead prepares and distributes initial external communications to customers, partners, and vendors, if necessary.

9. Failover and Recovery Procedures

This section outlines the general steps for failing over to the DR environment. Detailed, system-specific runbooks are maintained in Appendix C: System-Specific Runbooks.

9.1. DR Site Activation

  1. Initiate DR Environment: Activate resources at the designated DR site (e.g., cloud region, secondary data center). This may involve provisioning virtual machines, network configurations, and storage.
gemini Output

This document outlines a comprehensive Disaster Recovery Plan (DRP) designed to minimize downtime and data loss in the event of a catastrophic incident. It details the strategies, procedures, and responsibilities required to restore critical business operations and IT services efficiently and effectively.


Disaster Recovery Plan

Document Version: 1.0

Date: October 26, 2023

Author: PantheraHive Solutions Team


1. Introduction

1.1. Purpose

The purpose of this Disaster Recovery Plan (DRP) is to provide a structured and actionable framework for responding to, managing, and recovering from disruptive events that could impact critical IT systems and business operations. This plan aims to ensure the continuity of essential services, protect organizational assets, and minimize financial and reputational damage.

1.2. Scope

This DRP covers the recovery of critical IT infrastructure, applications, and data essential for the operation of [Organization Name]'s core business functions. It encompasses procedures for:

  • Detection and declaration of a disaster.
  • Activation of the disaster recovery team.
  • Failover to alternate recovery sites/systems.
  • Restoration of data and applications.
  • Communication with stakeholders.
  • Post-recovery verification and lessons learned.
  • Regular testing and maintenance of the plan.

1.3. Objectives

  • Achieve defined Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs) for critical systems.
  • Ensure the availability of essential business functions during and after a disaster.
  • Minimize data loss and system downtime.
  • Provide clear roles, responsibilities, and procedures for disaster response.
  • Facilitate efficient and orderly recovery operations.
  • Maintain stakeholder confidence and regulatory compliance.

2. Key Personnel and Roles & Responsibilities

Effective disaster recovery relies on a dedicated team with clearly defined responsibilities.

2.1. Disaster Recovery Team Structure

| Role | Primary Contact | Secondary Contact | Responsibilities

disaster_recovery_plan.md
Download as Markdown
Copy all content
Full output as text
Download ZIP
IDE-ready project ZIP
Copy share link
Permanent URL for this run
Get Embed Code
Embed this result on any website
Print / Save PDF
Use browser print dialog
"); var hasSrcMain=Object.keys(extracted).some(function(k){return k.indexOf("src/main")>=0;}); if(!hasSrcMain) zip.file(folder+"src/main."+ext,"import React from 'react' import ReactDOM from 'react-dom/client' import App from './App' import './index.css' ReactDOM.createRoot(document.getElementById('root')!).render( ) "); var hasSrcApp=Object.keys(extracted).some(function(k){return k==="src/App."+ext||k==="App."+ext;}); if(!hasSrcApp) zip.file(folder+"src/App."+ext,"import React from 'react' import './App.css' function App(){ return(

"+slugTitle(pn)+"

Built with PantheraHive BOS

) } export default App "); zip.file(folder+"src/index.css","*{margin:0;padding:0;box-sizing:border-box} body{font-family:system-ui,-apple-system,sans-serif;background:#f0f2f5;color:#1a1a2e} .app{min-height:100vh;display:flex;flex-direction:column} .app-header{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:40px} h1{font-size:2.5rem;font-weight:700} "); zip.file(folder+"src/App.css",""); zip.file(folder+"src/components/.gitkeep",""); zip.file(folder+"src/pages/.gitkeep",""); zip.file(folder+"src/hooks/.gitkeep",""); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+" Generated by PantheraHive BOS. ## Setup ```bash npm install npm run dev ``` ## Build ```bash npm run build ``` ## Open in IDE Open the project folder in VS Code or WebStorm. "); zip.file(folder+".gitignore","node_modules/ dist/ .env .DS_Store *.local "); } /* --- Vue (Vite + Composition API + TypeScript) --- */ function buildVue(zip,folder,app,code,panelTxt){ var pn=pkgName(app); var C=cc(pn); var extracted=extractCode(panelTxt); zip.file(folder+"package.json",'{ "name": "'+pn+'", "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "vue-tsc -b && vite build", "preview": "vite preview" }, "dependencies": { "vue": "^3.5.13", "vue-router": "^4.4.5", "pinia": "^2.3.0", "axios": "^1.7.9" }, "devDependencies": { "@vitejs/plugin-vue": "^5.2.1", "typescript": "~5.7.3", "vite": "^6.0.5", "vue-tsc": "^2.2.0" } } '); zip.file(folder+"vite.config.ts","import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { resolve } from 'path' export default defineConfig({ plugins: [vue()], resolve: { alias: { '@': resolve(__dirname,'src') } } }) "); zip.file(folder+"tsconfig.json",'{"files":[],"references":[{"path":"./tsconfig.app.json"},{"path":"./tsconfig.node.json"}]} '); zip.file(folder+"tsconfig.app.json",'{ "compilerOptions":{ "target":"ES2020","useDefineForClassFields":true,"module":"ESNext","lib":["ES2020","DOM","DOM.Iterable"], "skipLibCheck":true,"moduleResolution":"bundler","allowImportingTsExtensions":true, "isolatedModules":true,"moduleDetection":"force","noEmit":true,"jsxImportSource":"vue", "strict":true,"paths":{"@/*":["./src/*"]} }, "include":["src/**/*.ts","src/**/*.d.ts","src/**/*.tsx","src/**/*.vue"] } '); zip.file(folder+"env.d.ts","/// "); zip.file(folder+"index.html"," "+slugTitle(pn)+"
"); var hasMain=Object.keys(extracted).some(function(k){return k==="src/main.ts"||k==="main.ts";}); if(!hasMain) zip.file(folder+"src/main.ts","import { createApp } from 'vue' import { createPinia } from 'pinia' import App from './App.vue' import './assets/main.css' const app = createApp(App) app.use(createPinia()) app.mount('#app') "); var hasApp=Object.keys(extracted).some(function(k){return k.indexOf("App.vue")>=0;}); if(!hasApp) zip.file(folder+"src/App.vue"," "); zip.file(folder+"src/assets/main.css","*{margin:0;padding:0;box-sizing:border-box}body{font-family:system-ui,sans-serif;background:#fff;color:#213547} "); zip.file(folder+"src/components/.gitkeep",""); zip.file(folder+"src/views/.gitkeep",""); zip.file(folder+"src/stores/.gitkeep",""); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+" Generated by PantheraHive BOS. ## Setup ```bash npm install npm run dev ``` ## Build ```bash npm run build ``` Open in VS Code or WebStorm. "); zip.file(folder+".gitignore","node_modules/ dist/ .env .DS_Store *.local "); } /* --- Angular (v19 standalone) --- */ function buildAngular(zip,folder,app,code,panelTxt){ var pn=pkgName(app); var C=cc(pn); var sel=pn.replace(/_/g,"-"); var extracted=extractCode(panelTxt); zip.file(folder+"package.json",'{ "name": "'+pn+'", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test" }, "dependencies": { "@angular/animations": "^19.0.0", "@angular/common": "^19.0.0", "@angular/compiler": "^19.0.0", "@angular/core": "^19.0.0", "@angular/forms": "^19.0.0", "@angular/platform-browser": "^19.0.0", "@angular/platform-browser-dynamic": "^19.0.0", "@angular/router": "^19.0.0", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.15.0" }, "devDependencies": { "@angular-devkit/build-angular": "^19.0.0", "@angular/cli": "^19.0.0", "@angular/compiler-cli": "^19.0.0", "typescript": "~5.6.0" } } '); zip.file(folder+"angular.json",'{ "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "'+pn+'": { "projectType": "application", "root": "", "sourceRoot": "src", "prefix": "app", "architect": { "build": { "builder": "@angular-devkit/build-angular:application", "options": { "outputPath": "dist/'+pn+'", "index": "src/index.html", "browser": "src/main.ts", "tsConfig": "tsconfig.app.json", "styles": ["src/styles.css"], "scripts": [] } }, "serve": {"builder":"@angular-devkit/build-angular:dev-server","configurations":{"production":{"buildTarget":"'+pn+':build:production"},"development":{"buildTarget":"'+pn+':build:development"}},"defaultConfiguration":"development"} } } } } '); zip.file(folder+"tsconfig.json",'{ "compileOnSave": false, "compilerOptions": {"baseUrl":"./","outDir":"./dist/out-tsc","forceConsistentCasingInFileNames":true,"strict":true,"noImplicitOverride":true,"noPropertyAccessFromIndexSignature":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"paths":{"@/*":["src/*"]},"skipLibCheck":true,"esModuleInterop":true,"sourceMap":true,"declaration":false,"experimentalDecorators":true,"moduleResolution":"bundler","importHelpers":true,"target":"ES2022","module":"ES2022","useDefineForClassFields":false,"lib":["ES2022","dom"]}, "references":[{"path":"./tsconfig.app.json"}] } '); zip.file(folder+"tsconfig.app.json",'{ "extends":"./tsconfig.json", "compilerOptions":{"outDir":"./dist/out-tsc","types":[]}, "files":["src/main.ts"], "include":["src/**/*.d.ts"] } '); zip.file(folder+"src/index.html"," "+slugTitle(pn)+" "); zip.file(folder+"src/main.ts","import { bootstrapApplication } from '@angular/platform-browser'; import { appConfig } from './app/app.config'; import { AppComponent } from './app/app.component'; bootstrapApplication(AppComponent, appConfig) .catch(err => console.error(err)); "); zip.file(folder+"src/styles.css","* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: system-ui, -apple-system, sans-serif; background: #f9fafb; color: #111827; } "); var hasComp=Object.keys(extracted).some(function(k){return k.indexOf("app.component")>=0;}); if(!hasComp){ zip.file(folder+"src/app/app.component.ts","import { Component } from '@angular/core'; import { RouterOutlet } from '@angular/router'; @Component({ selector: 'app-root', standalone: true, imports: [RouterOutlet], templateUrl: './app.component.html', styleUrl: './app.component.css' }) export class AppComponent { title = '"+pn+"'; } "); zip.file(folder+"src/app/app.component.html","

"+slugTitle(pn)+"

Built with PantheraHive BOS

"); zip.file(folder+"src/app/app.component.css",".app-header{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:60vh;gap:16px}h1{font-size:2.5rem;font-weight:700;color:#6366f1} "); } zip.file(folder+"src/app/app.config.ts","import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; import { provideRouter } from '@angular/router'; import { routes } from './app.routes'; export const appConfig: ApplicationConfig = { providers: [ provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes) ] }; "); zip.file(folder+"src/app/app.routes.ts","import { Routes } from '@angular/router'; export const routes: Routes = []; "); Object.keys(extracted).forEach(function(p){ var fp=p.startsWith("src/")?p:"src/"+p; zip.file(folder+fp,extracted[p]); }); zip.file(folder+"README.md","# "+slugTitle(pn)+" Generated by PantheraHive BOS. ## Setup ```bash npm install ng serve # or: npm start ``` ## Build ```bash ng build ``` Open in VS Code with Angular Language Service extension. "); zip.file(folder+".gitignore","node_modules/ dist/ .env .DS_Store *.local .angular/ "); } /* --- Python --- */ function buildPython(zip,folder,app,code){ var title=slugTitle(app); var pn=pkgName(app); var src=code.replace(/^```[w]* ?/m,"").replace(/ ?```$/m,"").trim(); var reqMap={"numpy":"numpy","pandas":"pandas","sklearn":"scikit-learn","tensorflow":"tensorflow","torch":"torch","flask":"flask","fastapi":"fastapi","uvicorn":"uvicorn","requests":"requests","sqlalchemy":"sqlalchemy","pydantic":"pydantic","dotenv":"python-dotenv","PIL":"Pillow","cv2":"opencv-python","matplotlib":"matplotlib","seaborn":"seaborn","scipy":"scipy"}; var reqs=[]; Object.keys(reqMap).forEach(function(k){if(src.indexOf("import "+k)>=0||src.indexOf("from "+k)>=0)reqs.push(reqMap[k]);}); var reqsTxt=reqs.length?reqs.join(" "):"# add dependencies here "; zip.file(folder+"main.py",src||"# "+title+" # Generated by PantheraHive BOS print(title+" loaded") "); zip.file(folder+"requirements.txt",reqsTxt); zip.file(folder+".env.example","# Environment variables "); zip.file(folder+"README.md","# "+title+" Generated by PantheraHive BOS. ## Setup ```bash python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt ``` ## Run ```bash python main.py ``` "); zip.file(folder+".gitignore",".venv/ __pycache__/ *.pyc .env .DS_Store "); } /* --- Node.js --- */ function buildNode(zip,folder,app,code){ var title=slugTitle(app); var pn=pkgName(app); var src=code.replace(/^```[w]* ?/m,"").replace(/ ?```$/m,"").trim(); var depMap={"mongoose":"^8.0.0","dotenv":"^16.4.5","axios":"^1.7.9","cors":"^2.8.5","bcryptjs":"^2.4.3","jsonwebtoken":"^9.0.2","socket.io":"^4.7.4","uuid":"^9.0.1","zod":"^3.22.4","express":"^4.18.2"}; var deps={}; Object.keys(depMap).forEach(function(k){if(src.indexOf(k)>=0)deps[k]=depMap[k];}); if(!deps["express"])deps["express"]="^4.18.2"; var pkgJson=JSON.stringify({"name":pn,"version":"1.0.0","main":"src/index.js","scripts":{"start":"node src/index.js","dev":"nodemon src/index.js"},"dependencies":deps,"devDependencies":{"nodemon":"^3.0.3"}},null,2)+" "; zip.file(folder+"package.json",pkgJson); var fallback="const express=require("express"); const app=express(); app.use(express.json()); app.get("/",(req,res)=>{ res.json({message:""+title+" API"}); }); const PORT=process.env.PORT||3000; app.listen(PORT,()=>console.log("Server on port "+PORT)); "; zip.file(folder+"src/index.js",src||fallback); zip.file(folder+".env.example","PORT=3000 "); zip.file(folder+".gitignore","node_modules/ .env .DS_Store "); zip.file(folder+"README.md","# "+title+" Generated by PantheraHive BOS. ## Setup ```bash npm install ``` ## Run ```bash npm run dev ``` "); } /* --- Vanilla HTML --- */ function buildVanillaHtml(zip,folder,app,code){ var title=slugTitle(app); var isFullDoc=code.trim().toLowerCase().indexOf("=0||code.trim().toLowerCase().indexOf("=0; var indexHtml=isFullDoc?code:" "+title+" "+code+" "; zip.file(folder+"index.html",indexHtml); zip.file(folder+"style.css","/* "+title+" — styles */ *{margin:0;padding:0;box-sizing:border-box} body{font-family:system-ui,-apple-system,sans-serif;background:#fff;color:#1a1a2e} "); zip.file(folder+"script.js","/* "+title+" — scripts */ "); zip.file(folder+"assets/.gitkeep",""); zip.file(folder+"README.md","# "+title+" Generated by PantheraHive BOS. ## Open Double-click `index.html` in your browser. Or serve locally: ```bash npx serve . # or python3 -m http.server 3000 ``` "); zip.file(folder+".gitignore",".DS_Store node_modules/ .env "); } /* ===== MAIN ===== */ var sc=document.createElement("script"); sc.src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"; sc.onerror=function(){ if(lbl)lbl.textContent="Download ZIP"; alert("JSZip load failed — check connection."); }; sc.onload=function(){ var zip=new JSZip(); var base=(_phFname||"output").replace(/.[^.]+$/,""); var app=base.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"my_app"; var folder=app+"/"; var vc=document.getElementById("panel-content"); var panelTxt=vc?(vc.innerText||vc.textContent||""):""; var lang=detectLang(_phCode,panelTxt); if(_phIsHtml){ buildVanillaHtml(zip,folder,app,_phCode); } else if(lang==="flutter"){ buildFlutter(zip,folder,app,_phCode,panelTxt); } else if(lang==="react-native"){ buildReactNative(zip,folder,app,_phCode,panelTxt); } else if(lang==="swift"){ buildSwift(zip,folder,app,_phCode,panelTxt); } else if(lang==="kotlin"){ buildKotlin(zip,folder,app,_phCode,panelTxt); } else if(lang==="react"){ buildReact(zip,folder,app,_phCode,panelTxt); } else if(lang==="vue"){ buildVue(zip,folder,app,_phCode,panelTxt); } else if(lang==="angular"){ buildAngular(zip,folder,app,_phCode,panelTxt); } else if(lang==="python"){ buildPython(zip,folder,app,_phCode); } else if(lang==="node"){ buildNode(zip,folder,app,_phCode); } else { /* Document/content workflow */ var title=app.replace(/_/g," "); var md=_phAll||_phCode||panelTxt||"No content"; zip.file(folder+app+".md",md); var h=""+title+""; h+="

"+title+"

"; var hc=md.replace(/&/g,"&").replace(//g,">"); hc=hc.replace(/^### (.+)$/gm,"

$1

"); hc=hc.replace(/^## (.+)$/gm,"

$1

"); hc=hc.replace(/^# (.+)$/gm,"

$1

"); hc=hc.replace(/**(.+?)**/g,"$1"); hc=hc.replace(/ {2,}/g,"

"); h+="

"+hc+"

Generated by PantheraHive BOS
"; zip.file(folder+app+".html",h); zip.file(folder+"README.md","# "+title+" Generated by PantheraHive BOS. Files: - "+app+".md (Markdown) - "+app+".html (styled HTML) "); } zip.generateAsync({type:"blob"}).then(function(blob){ var a=document.createElement("a"); a.href=URL.createObjectURL(blob); a.download=app+".zip"; a.click(); URL.revokeObjectURL(a.href); if(lbl)lbl.textContent="Download ZIP"; }); }; document.head.appendChild(sc); }function phShare(){navigator.clipboard.writeText(window.location.href).then(function(){var el=document.getElementById("ph-share-lbl");if(el){el.textContent="Link copied!";setTimeout(function(){el.textContent="Copy share link";},2500);}});}function phEmbed(){var runId=window.location.pathname.split("/").pop().replace(".html","");var embedUrl="https://pantherahive.com/embed/"+runId;var code='';navigator.clipboard.writeText(code).then(function(){var el=document.getElementById("ph-embed-lbl");if(el){el.textContent="Embed code copied!";setTimeout(function(){el.textContent="Get Embed Code";},2500);}});}