Disaster Recovery Plan
Run ID: 69cd16483e7fb09ff16a7d742026-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.

This document outlines a comprehensive Disaster Recovery Plan (DRP) designed to ensure business continuity and minimize the impact of disruptive events on critical IT systems and operations.

Disaster Recovery Plan: Executive Summary

This Disaster Recovery Plan (DRP) provides a structured approach for responding to unforeseen incidents that may disrupt normal business operations, including natural disasters, cyber-attacks, hardware failures, or human error. The primary goal of this plan is to facilitate the rapid recovery of critical systems and data, ensuring the continuity of essential business functions with minimal downtime and data loss. It details RTO and RPO targets, backup strategies, failover procedures, communication protocols, and a rigorous testing schedule to maintain preparedness.

1. Introduction and Scope

1.1 Purpose

The purpose of this Disaster Recovery Plan is to define the procedures, responsibilities, and resources required to recover critical IT infrastructure and data following a disaster or major disruption. This plan aims to:

  • Minimize downtime and data loss.
  • Ensure the continuity of essential business operations.
  • Protect the organization's reputation and financial stability.
  • Comply with regulatory requirements.

1.2 Scope

This DRP covers all critical IT systems, applications, data, and associated infrastructure identified as essential for the continued operation of [Your Organization Name]'s core business functions. This includes, but is not limited to:

  • [List specific critical applications, e.g., ERP System, CRM, E-commerce Platform, Financial Systems]
  • [List specific critical data, e.g., Customer Databases, Transactional Data, Intellectual Property]
  • Network infrastructure (LAN, WAN, VPN)
  • Server infrastructure (physical and virtual)
  • Cloud-based services and integrations
  • User workstations and associated data (where critical)

Out-of-scope for this document are business continuity plans (BCP) related to non-IT specific functions (e.g., supply chain disruption, human resource management during a crisis, physical facility recovery, unless directly impacting IT infrastructure). However, this DRP is a critical component of the overall BCP.

2. Objectives: Recovery Time Objective (RTO) and Recovery Point Objective (RPO)

2.1 Definitions

  • Recovery Time Objective (RTO): The maximum tolerable duration of time that a computer system, network, or application can be down after a disaster or failure. It defines the target time for restoration.
  • Recovery Point Objective (RPO): The maximum tolerable amount of data loss measured in time. It defines the point in time to which systems and data must be recovered (e.g., data restored from 4 hours ago, meaning up to 4 hours of data could be lost).

2.2 Critical Systems and RTO/RPO Targets

The following table outlines the RTO and RPO targets for critical systems and applications based on their business impact analysis (BIA) classification. These targets are non-negotiable and form the basis for all recovery strategies.

| Critical System/Application | Business Impact | RTO Target | RPO Target |

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

| Tier 1: Mission-Critical | | | |

| ERP System (e.g., SAP, Oracle) | High | 4 hours | 1 hour |

| E-commerce Platform | High | 2 hours | 15 minutes |

| Core Financial Applications | High | 4 hours | 1 hour |

| Customer Relationship Management (CRM) | High | 6 hours | 2 hours |

| Tier 2: Business-Critical | | | |

| Email & Collaboration (e.g., Exchange, M365) | Medium | 8 hours | 4 hours |

| File Servers / Document Management | Medium | 12 hours | 4 hours |

| Internal Web Applications | Medium | 12 hours | 4 hours |

| Tier 3: Supporting | | | |

| Development/Test Environments | Low | 24 hours | 8 hours |

| HRIS System | Low | 24 hours | 8 hours |

Note: These targets are aspirational and will be continuously refined through testing and technological advancements.

3. Key Personnel and Roles (DRP Team)

The DRP Team is responsible for executing this plan. All members must have up-to-date contact information, understand their roles, and be trained on DRP procedures.

3.1 DRP Coordinator (Incident Commander)

  • Role: Overall leadership and decision-making during a disaster. Declares disaster, authorizes DRP activation, and oversees all recovery efforts.
  • Primary: [Name/Title]
  • Alternate: [Name/Title]

3.2 Technical Recovery Team Lead

  • Role: Leads the technical team in executing system and application recovery procedures.
  • Primary: [Name/Title]
  • Alternate: [Name/Title]

3.3 Network Recovery Team

  • Role: Restores network connectivity, firewalls, VPNs, and ensures routing to recovery site.
  • Members: [Name/Title], [Name/Title]

3.4 Server/Infrastructure Recovery Team

  • Role: Recovers virtual/physical servers, operating systems, and core infrastructure services (DNS, AD).
  • Members: [Name/Title], [Name/Title]

3.5 Application Recovery Team

  • Role: Restores and configures critical business applications, databases, and ensures data integrity.
  • Members: [Name/Title], [Name/Title]

3.6 Communications Lead

  • Role: Manages internal and external communications during the disaster and recovery phases.
  • Primary: [Name/Title]
  • Alternate: [Name/Title]

3.7 Business Unit Representatives

  • Role: Provide business priorities, validate recovered systems, and assist with user acceptance testing.
  • Members: [Name/Title - Dept A], [Name/Title - Dept B]

Emergency Contact List: An up-to-date, off-site accessible contact list for all DRP team members, key vendors, and emergency services is maintained in Appendix A.

4. Backup and Data Recovery Strategy

4.1 Data Classification

All data is classified according to its criticality and sensitivity to determine appropriate backup and retention policies.

  • Critical Data: Data essential for business operation, high RPO.
  • Sensitive Data: Data requiring special protection (e.g., PII, financial).

4.2 Backup Types and Frequency

| Data/System Type | Backup Type | Frequency | Retention Policy | Location(s) |

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

| Tier 1 Apps/DBs | Full + Incremental/Log | Hourly/Daily | 7 days (hourly), 30 days (daily), 1 year (monthly) | Primary DC, Off-site DR site, Secure Cloud |

| Tier 2 Apps/DBs | Full + Incremental | Daily | 30 days (daily), 1 year (monthly) | Primary DC, Off-site DR site, Secure Cloud |

| File Servers | Full + Differential | Daily | 90 days (daily), 7 years (yearly) | Primary DC, Off-site DR site, Secure Cloud |

| Workstations | User Data Backup | Daily (via Cloud Sync) | 30 days | Cloud storage (e.g., OneDrive, Google Drive) |

| System Images | Full (VMs/OS) | Weekly | 4 weeks | Primary DC, Off-site DR site, Secure Cloud |

4.3 Backup Storage Locations

  • On-site Primary Data Center: Local backups for fast recovery from minor incidents.
  • Off-site Disaster Recovery Site: Replicated data and backups stored at a geographically separate facility (e.g., [DR Site Location/Provider]).
  • Secure Cloud Storage: Encrypted backups stored in a reputable cloud provider (e.g., AWS S3, Azure Blob Storage) for additional redundancy and geographic dispersion.

4.4 Backup Verification and Integrity Checks

  • Daily: Automated checks for backup job completion and error logs.
  • Weekly: Random file restoration tests from backups.
  • Monthly: Full system image restoration tests to a sandbox environment.
  • Annually: Comprehensive data integrity check and full restoration test as part of DRP testing.

4.5 Data Restoration Procedures

  1. Identify Data Loss/Corruption: Determine the extent and specific data affected.
  2. Determine Recovery Point: Select the appropriate backup point based on RPO and data integrity.
  3. Isolate Affected Systems: Prevent further data corruption or loss.
  4. Initiate Restoration: Use documented procedures for the specific backup solution (e.g., Veeam, Commvault, native cloud tools).
  5. Verify Restoration: Confirm data integrity and accessibility post-restoration.
  6. Business Validation: Business users verify data accuracy and application functionality.

5. Failover and System Recovery Procedures

5.1 DRP Activation Criteria

The DRP will be activated by the DRP Coordinator (Incident Commander) upon confirmation of any of the following events:

  • Loss of primary data center functionality due to power outage, fire, flood, etc.
  • Major cyber-attack rendering critical systems unusable.
  • Widespread system failure exceeding defined RTOs for critical applications.
  • Declaration of a disaster by external authorities impacting operations.
  • Any event that prevents normal operations for an extended period.

5.2 Incident Response Steps

  1. Detection & Notification: Monitoring systems alert DRP team. Initial assessment of the incident.
  2. Assessment & Declaration: DRP Coordinator assesses the impact, potential duration, and determines if DRP activation is necessary. Formal declaration of disaster.
  3. Team Mobilization: DRP team members are notified and assembled (virtually or physically).
  4. Initial Communication: DRP Communications Lead initiates internal and external communications.

5.3 Failover Procedures (General)

The general failover process involves redirecting traffic and operations from the primary site to the designated disaster recovery site.

  1. Isolate Primary Site: If possible and safe, disconnect the primary site from the network to prevent further issues.
  2. Activate DR Site Infrastructure:

* Power up DR site hardware/virtual infrastructure.

* Verify network connectivity, firewalls, and security settings.

* Configure DNS to point to DR site IPs (if applicable).

  1. Restore/Replicate Critical Data: Ensure the latest available data (per RPO) is synchronized or restored to the DR site.
  2. Recover Operating Systems and Applications:

* Restore/deploy server images/VMs.

* Install and configure necessary operating systems and patches.

* Deploy and configure critical applications and databases.

  1. Configure Network Services: Ensure Active Directory, DNS, DHCP, and other core services are functional at the DR site.
  2. Connectivity & Access: Restore VPNs, remote access, and user access to recovered applications.
  3. Business Validation: Business unit representatives perform user acceptance testing (UAT) on recovered applications and data.

5.4 System-Specific Recovery Procedures

Detailed, step-by-step recovery procedures for each critical system are maintained in a separate runbook (Appendix B) and include:

  • ERP System Recovery:

* Restore database to DR site.

* Deploy ERP application servers.

* Configure integrations with other systems.

* Test core functionalities (e.g., order processing, financial transactions).

  • E-commerce Platform Recovery:

* Restore database and application code.

* Configure web servers and load balancers.

* Update DNS records to point to DR site.

* Test end-to-end customer journey.

  • Core Financial Applications Recovery:

* Restore databases and application instances.

* Verify data integrity and reporting capabilities.

* Ensure secure access for finance team.

5.5 Failback Procedures

Once the primary site is fully restored and verified, a planned failback operation will commence to return operations to the primary data center.

  1. Stabilize Primary Site: Ensure all primary site infrastructure is fully functional and stable.
  2. Synchronize Data: Replicate any data changes from the DR site back to the primary site. This is a critical step to avoid data loss during failback.
  3. Pre-Failback Testing: Thoroughly test the primary site systems with synchronized data in isolation.
  4. Scheduled Failback: Announce a maintenance window.
  5. Reverse DNS/Traffic: Re-point DNS and network traffic back to the primary site.
  6. Monitor & Verify: Closely monitor systems and applications at the primary site and verify functionality with business users.
  7. Deactivate DR Site: Safely shut down and/or prepare the DR site for future use.

6. Communication Plan

Effective communication is paramount during a disaster. This plan outlines internal and external communication strategies.

6.1 Internal Communication

  • DRP Team:

* Initial Notification: SMS, automated alerts, dedicated conference bridge.

* Updates: Regular updates via conference calls, dedicated chat channels (e.g., Microsoft Teams, Slack), and status dashboards.

  • Employees:

* Notification: Email (to personal emails if corporate email is down), SMS, company intranet (if accessible), dedicated emergency hotline.

* Updates: Regular updates on system status, estimated recovery times, and instructions for alternative work procedures.

* Key Message: Focus on safety, critical information, and clear instructions.

6.2 External Communication

  • Customers:

* Notification: Website banner, dedicated status page, email, social media updates.

* Content: Acknowledge the issue, state steps being taken, provide estimated resolution time (if known), and offer alternative contact methods.

* Customer Service: Brief customer service teams with FAQs and approved talking points.

  • Vendors/Partners:

* Notification: Direct email, phone calls to key contacts.

* Content: Inform them of the situation, potential impact on services, and coordinate support needs.

  • Media/Public:

* Notification: All media inquiries are directed to the Communications Lead.

* Content: Only approved statements will be released. Avoid speculation.

  • Regulators/Legal:

* Notification: As required by law or contract, legal counsel will guide communication.

* Content: Factual information regarding the incident and recovery efforts.

6.3 Communication Channels and Templates

gemini Output

Disaster Recovery Plan

Document Version: 1.0

Date: October 26, 2023

Prepared For: [Customer Name/Organization Name]

Prepared By: PantheraHive Solutions


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. The primary objective of this DRP is to minimize downtime, prevent data loss, and ensure the rapid restoration of essential services to maintain business continuity. This plan establishes clear Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs), details backup and failover strategies, defines communication protocols, and sets forth a rigorous testing and maintenance schedule to ensure its effectiveness.

2. Purpose and Scope

2.1 Purpose

The purpose of this Disaster Recovery Plan is to provide a structured and actionable framework for:

  • Identifying critical business functions and supporting IT systems.
  • Establishing clear objectives for recovery (RTO and RPO).
  • Defining procedures for data backup, restoration, and system recovery.
  • Outlining roles, responsibilities, and communication protocols during a disaster.
  • Ensuring the capability to recover essential IT services and data within acceptable timeframes.
  • Minimizing the financial, operational, and reputational impact of a disaster.
  • Meeting regulatory compliance requirements.

2.2 Scope

This DRP covers the recovery of critical IT infrastructure, applications, and data supporting the core business operations of [Customer Name/Organization Name]. It addresses potential disruptions arising from various incidents, including but not limited to:

  • Major hardware failures (servers, storage, network devices).
  • Software failures or corruption.
  • Cybersecurity incidents (e.g., ransomware attacks, data breaches).
  • Natural disasters (e.g., fire, flood, earthquake, severe weather affecting primary site).
  • Utility outages (e.g., prolonged power loss, internet service disruption).
  • Human error or malicious acts.

This plan focuses on the IT-related aspects of disaster recovery and integrates with broader Business Continuity Planning (BCP) efforts.

3. Key Personnel and Roles

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

3.1 Disaster Recovery Team (DRT) Lead

  • Role: Overall coordination and decision-making during a disaster. Authorizes DRP activation.
  • Primary: [Name, Title, Contact Info]
  • Alternate: [Name, Title, Contact Info]

3.2 Infrastructure Recovery Team

  • Role: Restores network, server, and storage infrastructure.
  • Members: [Name, Title, Contact Info], [Name, Title, Contact Info]

3.3 Application Recovery Team

  • Role: Restores and validates critical business applications and databases.
  • Members: [Name, Title, Contact Info], [Name, Title, Contact Info]

3.4 Data Recovery Team

  • Role: Manages data restoration from backups and ensures data integrity.
  • Members: [Name, Title, Contact Info], [Name, Title, Contact Info]

3.5 Communications Team

  • Role: Manages internal and external communications during and after an event.
  • Members: [Name, Title, Contact Info], [Name, Title, Contact Info]

3.6 Business Operations Liaison

  • Role: Coordinates with business units to ensure operational needs are met during recovery.
  • Members: [Name, Title, Contact Info], [Name, Title, Contact Info]

4. Disaster Declaration Criteria

A disaster is declared when a critical incident causes significant disruption to IT services and normal business operations, exceeding the capabilities of standard incident response procedures.

Criteria for Disaster Declaration:

  • Unavailability of a critical system or service beyond its defined RTO.
  • Widespread data corruption or loss affecting critical data beyond its defined RPO.
  • Physical damage to the primary data center or critical infrastructure.
  • Prolonged power outage or network connectivity loss at the primary site.
  • Cybersecurity incident rendering critical systems inoperable or compromised.
  • Inability to resume normal operations within [e.g., 4-8] hours using standard procedures.

Declaration Authority:

The DRT Lead, in consultation with senior management, is authorized to declare a disaster and activate this DRP.

5. Recovery Objectives (RTO/RPO)

Recovery objectives are critical metrics defining the acceptable limits for downtime and data loss for each essential system.

5.1 Recovery Time Objective (RTO)

The maximum acceptable duration of time that a critical system or business function can be offline following a disaster before significant damage to the business occurs.

5.2 Recovery Point Objective (RPO)

The maximum acceptable amount of data loss, measured in time, that an application or system can sustain during a disaster event.

5.3 Critical Systems and Their RTO/RPO Targets

| Critical System/Application | Description | RTO (Hours) | RPO (Hours) | Recovery Strategy (See Appendix B for detailed system inventory and dependencies.)|

| CRM System (e.g., Salesforce) | Manages customer relationships, sales, and marketing. | 4 | 1 | Active-passive DR site in a different region; data replication; cloud-to-cloud backup. In case of primary region failure, DNS failover and activation of secondary region.

gemini Output

Disaster Recovery Plan: [Your Organization Name]

Document Version: 1.0

Date: October 26, 2023

Prepared For: [Your Organization Name] Management and Stakeholders

Prepared By: [Your Name/Department]


1. Executive Summary

This Disaster Recovery Plan (DRP) outlines the strategies, procedures, and responsibilities for responding to and recovering from a disaster that impacts the critical IT systems and operations of [Your Organization Name]. The primary objective of this DRP is to minimize downtime, prevent data loss, and ensure business continuity in the face of unforeseen events, thereby protecting our assets, reputation, and ability to serve our customers. This plan establishes clear Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs), outlines comprehensive backup and failover strategies, details communication protocols, and defines a robust testing and maintenance schedule.

2. Introduction and Scope

2.1 Purpose

The purpose of this DRP is to provide a structured and actionable framework to:

  • Safeguard critical information systems and data.
  • Restore essential business functions within predefined RTOs and RPOs.
  • Minimize the financial and reputational impact of a disaster.
  • Ensure the safety and well-being of personnel during and after an event.
  • Comply with regulatory requirements and industry best practices.

2.2 Scope

This DRP covers the recovery of critical IT infrastructure, applications, and data essential for the continuous operation of [Your Organization Name]. It primarily focuses on the systems hosted at [Primary Data Center Location] and includes:

  • Core Business Applications: [List 2-3 critical applications, e.g., CRM, ERP, E-commerce Platform]
  • Database Systems: [List 2-3 critical databases, e.g., SQL Server, PostgreSQL, MongoDB]
  • Network Infrastructure: [e.g., Firewalls, Routers, Switches, VPN access]
  • Virtualization Platform: [e.g., VMware vSphere, Microsoft Hyper-V]
  • Critical Servers: [e.g., Web Servers, Application Servers, Directory Services (AD/LDAP)]
  • Data Storage: [e.g., SAN, NAS, Cloud Storage]
  • Communication Systems: [e.g., Email, VoIP, Collaboration Platforms]
  • Cloud Services: [e.g., AWS, Azure, GCP services used for critical functions]

Exclusions: This plan does not specifically cover individual desktop/laptop recovery unless they are explicitly defined as critical assets in Appendix A.

3. Disaster Recovery Team and Roles

A dedicated Disaster Recovery Team (DRT) is established to manage and execute the DRP. Each member has specific responsibilities and an assigned backup.

| Role | Primary Contact | Backup Contact | Responsibilities

This document outlines the Disaster Recovery Plan (DRP) for [Your Organization Name], focusing on achieving specific Recovery Time Objectives (RPOs) and Recovery Point Objectives (RTOs) for critical business systems.


4. Key Definitions

  • Recovery Time Objective (RTO): The maximum acceptable duration of time that a computer system, application, or network can be down after a disaster.
  • Recovery Point Objective (RPO): The maximum acceptable amount of data loss measured in time. This is determined by the interval between the last backup and the disaster.
  • Disaster: Any event that causes an interruption of critical business functions for an unacceptable duration.
  • Failover: The process of switching to a redundant or standby computer server, system, hardware component, or network upon the failure or abnormal termination of the previously active application, server, or network.
  • Failback: The process of restoring systems to their original primary location after a disaster and successful recovery operations have been completed at the DR site.
  • Warm Site: A disaster recovery site that has the necessary hardware and network connectivity, but may require some configuration and data restoration.
  • Cold Site: A basic facility with power and cooling, but no hardware or pre-installed infrastructure. Requires significant time to become operational.
  • Hot Site: A fully equipped redundant data center that can take over operations almost immediately.

5. Recovery Objectives (RTO/RPO Targets)

Systems have been categorized based on their criticality to business operations.

5.1 System Criticality Tiers

  • Tier 0 (Mission-Critical): Systems whose unavailability causes immediate and significant financial loss, legal/regulatory non-compliance, or severe reputational damage. Requires near-zero downtime and data loss.
  • Tier 1 (Business-Critical): Systems whose unavailability significantly impacts core business operations, leading to substantial financial loss or operational disruption if not restored quickly.
  • Tier 2 (Business-Important): Systems that support business operations but can tolerate a moderate period of unavailability without immediate severe impact.
  • Tier 3 (Non-Critical/Support): Systems that are not essential for immediate business operations and can tolerate extended downtime.

5.2 RTO and RPO Targets by Tier

| Criticality Tier | Example Systems | Recovery Time Objective (RTO) | Recovery Point Objective (RPO) |

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

| Tier 0 (Mission-Critical) | E-commerce Platform, Core Database, Payment Gateway | < 1 hour | 0 - 5 minutes |

| Tier 1 (Business-Critical) | CRM, ERP, Email, Active Directory, VoIP | 2 - 4 hours | 15 - 30 minutes |

| Tier 2 (Business-Important) | HR System, Internal File Shares, Development Servers | 8 - 24 hours | 1 - 4 hours |

| Tier 3 (Non-Critical/Support) | Test Environments, Monitoring Tools, Archival Systems | > 24 hours / As needed | 24 hours |

**Note

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);}});}