Disaster Recovery Plan
Run ID: 69cadcba74bac0555ea30fa62026-03-30Infrastructure
PantheraHive BOS
BOS Dashboard

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

Disaster Recovery Plan (DRP)

This document outlines a comprehensive Disaster Recovery Plan (DRP) designed to ensure the continued operation and rapid recovery of critical business functions and IT systems in the event of a disruptive incident. This plan establishes clear procedures, responsibilities, and targets to minimize downtime and data loss, thereby protecting organizational assets, reputation, and customer trust.


1. Introduction and Purpose

The primary purpose of this Disaster Recovery Plan is to provide a structured approach for responding to and recovering from disruptive events that could impact critical IT infrastructure and business operations. This plan aims to:

  • Minimize the impact of disasters on business operations.
  • Ensure the timely recovery of critical systems and data.
  • Define roles, responsibilities, and procedures for disaster response and recovery.
  • Safeguard the organization's assets, data integrity, and reputation.
  • Comply with relevant regulatory requirements and industry best practices.

2. Scope

This DRP covers all critical IT infrastructure, applications, and data essential for the continuous operation of the organization's core business functions. This includes, but is not limited to:

  • Primary data centers and cloud environments.
  • Critical servers (physical and virtual).
  • Databases (production, staging).
  • Networking infrastructure (routers, switches, firewalls).
  • Core business applications (e.g., ERP, CRM, financial systems, customer-facing portals).
  • Communication systems (email, VoIP).
  • Employee workstations and remote access capabilities.
  • Associated data storage and backup systems.

3. Key Definitions

  • Disaster: An event that causes significant disruption to business operations, rendering critical systems or facilities unavailable.
  • Recovery Time Objective (RTO): The maximum tolerable duration of time in which 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).
  • Maximum Tolerable Downtime (MTD): The total amount of time a business process can be disrupted without causing unacceptable harm to the business.
  • Work Recovery Time (WRT): The time required to configure a recovered system and verify its integrity.
  • Business Impact Analysis (BIA): The process of identifying and evaluating the potential effects of an interruption to critical business operations.

4. Disaster Recovery Team and Roles

A dedicated Disaster Recovery Team (DRT) is established with clear roles and responsibilities to manage and execute the DRP.

| Role | Responsibility | Primary Contact | Backup Contact |

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

| DRP Coordinator | Overall plan management, activation, communication, and decision-making. | [Name/Title] | [Name/Title] |

| IT Infrastructure Lead | Server, network, storage, and virtualization recovery. | [Name/Title] | [Name/Title] |

| Application Lead | Application-specific recovery, data restoration, and configuration. | [Name/Title] | [Name/Title] |

| Data & Database Lead | Database recovery, data integrity, and consistency checks. | [Name/Title] | [Name/Title] |

| Network & Security Lead | Network connectivity, firewall configuration, VPNs, and security hardening. | [Name/Title] | [Name/Title] |

| Communications Lead | Internal and external communications, stakeholder updates. | [Name/Title] | [Name/Title] |

| Business Operations Lead | Business process validation, user acceptance testing, and operational continuity. | [Name/Title] | [Name/Title] |

| Executive Sponsor | High-level decision-making, resource allocation, and approval of major deviations. | [Name/Title] | [Name/Title] |


5. Risk Assessment Summary

A comprehensive risk assessment has identified the following potential threats to our IT infrastructure and business operations:

  • Natural Disasters: Fires, floods, earthquakes, severe weather (e.g., hurricanes, blizzards).
  • Technological Failures: Hardware failure, software bugs, power outages, network outages, cooling system failures.
  • Cybersecurity Incidents: Ransomware attacks, data breaches, denial-of-service (DoS) attacks, insider threats.
  • Human Error: Accidental data deletion, misconfigurations, operational mistakes.
  • Vendor/Supply Chain Failures: Disruption of critical third-party services.

6. Business Impact Analysis (BIA) Summary

The BIA identifies critical business functions, their dependencies on IT systems, and the potential impact of their unavailability.

| Critical Business Function | Supporting IT Systems/Applications | MTD (Hours) | RTO (Hours) | RPO (Hours) | Impact of Disruption (High/Med/Low) |

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

| Order Processing | ERP System, Database, Web Server | 4 | 2 | 1 | High |

| Customer Service | CRM System, VoIP, Email | 8 | 4 | 2 | High |

| Financial Reporting | Financial System, Database | 24 | 8 | 4 | Medium |

| Internal Communications | Email, Collaboration Tools | 12 | 6 | 4 | Medium |

| Data Analytics | Data Warehouse, Reporting Tools | 48 | 24 | 12 | Low |


7. RTO/RPO Targets for Critical Systems

Based on the BIA, the following RTO and RPO targets are established for critical systems:

| System/Application | RTO Target (Hours) | RPO Target (Hours) | Justification |

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

| ERP System (Production) | 2 | 1 | Direct impact on revenue, order fulfillment. |

| Primary Database | 1 | 0.5 | Data integrity and transactional consistency. |

| CRM System | 4 | 2 | Customer relationship management, support. |

| Email Server | 6 | 4 | Essential for internal/external communication. |

| Web Server (Customer) | 2 | 1 | Customer access to services, brand reputation. |

| File Servers | 8 | 4 | Critical shared documents and operational files. |


8. Backup and Recovery Strategies

Our backup strategy is designed to meet the defined RPO targets and ensure data availability for recovery.

8.1. Data Backup

  • Primary Data:

* Frequency: Continuous data protection (CDP) for critical databases (RPO < 1 hour). Hourly snapshots for critical file shares. Daily full backups for all other production data.

* Method: Database replication (synchronous/asynchronous), block-level incremental backups, application-aware backups.

* Retention: Daily backups for 30 days, weekly backups for 90 days, monthly backups for 1 year, annual backups for 7 years (or as per regulatory requirements).

* Location: Primary backups stored on-site in a separate fire-rated zone. Replicated to an off-site cloud storage provider (e.g., AWS S3, Azure Blob Storage) in a different geographical region.

  • Application Configuration & System State:

* Frequency: Weekly full backups, daily incremental backups.

* Method: System image backups, configuration file backups.

* Location: Stored on-site and replicated off-site.

  • Endpoint Data (Laptops/Desktops):

* Frequency: Continuous synchronization to cloud storage (e.g., OneDrive, Google Drive, Dropbox Business) for critical user data.

* Method: Cloud-based file synchronization and versioning.

8.2. Recovery Procedures

  • Database Recovery:

* Restore from latest available replication snapshot or transaction logs for RPO compliance.

* Verify data integrity post-restoration.

  • Server Recovery:

* Utilize virtual machine (VM) snapshots and replication for rapid recovery to a DR site.

* Bare-metal recovery using system images for physical servers if replication is not available.

  • Application Recovery:

* Restore application binaries and configurations from backups.

* Connect to recovered databases.

* Perform application-specific integrity checks.

  • Data Restoration:

* Utilize backup software to restore specific files or folders as needed.

* Prioritize restoration based on BIA criticality.


9. Failover Procedures

Failover procedures are designed to switch operations from the primary site to the disaster recovery site with minimal disruption.

9.1. Activation Criteria

The DRP Coordinator, in consultation with the Executive Sponsor, will declare a disaster and activate the DRP if any of the following conditions are met:

  • Loss of primary data center functionality (e.g., power, cooling, network).
  • Catastrophic system failure impacting multiple critical applications.
  • Unrecoverable data corruption in primary systems.
  • Significant security breach compromising critical infrastructure.
  • Prolonged unavailability of critical services exceeding defined RTOs.

9.2. Step-by-Step Failover Process

  1. Declare Disaster & Activate DRT:

* DRP Coordinator initiates the emergency communication plan (Section 10).

* DRT members are notified and convene immediately.

  1. Assess Damage & Confirm Scope:

* Identify affected systems and the extent of the disaster.

* Confirm which systems require failover to the DR site.

  1. Initiate DR Site Activation:

* Power on and verify network connectivity at the DR site.

* Confirm availability of virtual infrastructure (hypervisors, storage

gemini Output

Disaster Recovery Plan

Document Version: 1.0

Date: October 26, 2023

Author: PantheraHive AI

Status: Draft / For Review


1. Introduction

This Disaster Recovery Plan (DRP) outlines the procedures and strategies to ensure the continued operation of critical business functions and the recovery of IT infrastructure and data following a disruptive event. The primary goal is to minimize downtime, data loss, and financial impact, thereby safeguarding the organization's reputation and ability to serve its stakeholders.

1.1 Purpose

The purpose of this DRP is to provide a structured approach for responding to and recovering from various types of disasters, including natural calamities, technological failures, cyber-attacks, and human error. It serves as a comprehensive guide for the Disaster Recovery Team and all relevant personnel.

1.2 Scope

This DRP covers the recovery of critical IT systems, applications, data, and associated infrastructure deemed essential for business continuity. It addresses the processes, roles, and resources required to restore operations to an acceptable level within defined Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs).

In-Scope Systems/Services (Example Categories):

  • Core Business Application Servers (e.g., ERP, CRM, Financial Systems)
  • Database Servers
  • Web Servers and Public-Facing Applications
  • Email and Communication Systems
  • Network Infrastructure (Routers, Switches, Firewalls)
  • Data Storage and Backup Systems
  • Virtualization Platforms
  • Critical End-User Computing (EUC) data

Out-of-Scope (unless specified):

  • Full business continuity planning for non-IT aspects (e.g., supply chain, human resources, physical facilities beyond IT infrastructure). However, coordination points are included.

1.3 Objectives

  • Minimize the duration of service interruption for critical business functions.
  • Minimize data loss to an acceptable level.
  • Establish clear roles, responsibilities, and communication channels during a disaster.
  • Ensure the availability of necessary resources (personnel, equipment, facilities) for recovery.
  • Provide a framework for regular testing, review, and maintenance of the DRP.
  • Protect the organization's assets, reputation, and legal obligations.

2. Roles and Responsibilities

A clear chain of command and defined responsibilities are crucial for effective disaster recovery.

2.1 Disaster Recovery Team (DRT) Structure

  • DR Coordinator (Overall Lead): Manages the entire DR process, declares disaster, authorizes expenditures, communicates with executive management.
  • IT Recovery Lead: Directs all technical recovery efforts, manages IT recovery teams.
  • Network Team Lead: Responsible for restoring network connectivity, firewalls, and security.
  • Server & Virtualization Team Lead: Manages server hardware, operating systems, and virtualization platform recovery.
  • Database Team Lead: Oversees database restoration and integrity.
  • Application Team Lead: Manages application deployment, configuration, and testing.
  • Data Protection & Backup Lead: Responsible for data recovery from backups.
  • Communication Lead: Manages internal and external communications.
  • Business Unit Liaisons: Represent specific business units, assist with UAT and business process validation.

2.2 Key Responsibilities

| Role | Key Responsibilities

gemini Output

This document outlines the comprehensive Disaster Recovery Plan (DRP) for [Your Organization Name], designed to ensure the rapid recovery of critical IT systems and data in the event of a disaster, minimizing downtime and data loss to maintain business continuity.


Disaster Recovery Plan

Document Name: Disaster Recovery Plan

Version: 1.0

Date: October 26, 2023

Prepared By: [Your Name/Department]

Approved By: [Approving Authority, e.g., Head of IT, Executive Management]

Review Date: October 26, 2024


1. Introduction

1.1 Purpose

The purpose of this Disaster Recovery Plan (DRP) is to provide a structured and actionable framework for restoring critical IT systems, applications, and data following a disruptive event. This plan aims to minimize the impact of disasters on business operations, protect organizational assets, and ensure the timely resumption of essential services.

1.2 Scope

This DRP covers the recovery of critical IT infrastructure, applications, and data hosted within [Specify Data Centers/Cloud Environments, e.g., Primary Data Center, AWS us-east-1, Azure West US 2]. It addresses potential disaster scenarios including, but not limited to:

  • Major hardware failure (server, storage, network)
  • Data center outage (power, cooling, network connectivity)
  • Natural disasters (fire, flood, earthquake)
  • Cybersecurity incidents (ransomware, major data breach)
  • Significant human error

1.3 Objectives

  • Minimize the financial and operational impact of a disaster.
  • Ensure the safety of personnel during and after a disaster.
  • Achieve defined Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs) for critical systems.
  • Provide clear, actionable procedures for disaster response and recovery.
  • Maintain effective communication with all stakeholders throughout a disaster event.
  • Facilitate a smooth and efficient return to normal operations.

2. Key Definitions and Acronyms

  • DRP: Disaster Recovery Plan
  • BCP: Business Continuity Plan (broader plan encompassing DRP)
  • RTO: Recovery Time Objective – The maximum tolerable duration for a computer system, network, or application outage. It dictates the speed at which a system or service must be restored after a disaster.
  • RPO: Recovery Point Objective – The maximum tolerable amount of data loss measured in time. It dictates how frequently data must be backed up (e.g., an RPO of 1 hour means you can afford to lose 1 hour of data at most).
  • DR Site: Disaster Recovery Site (alternative location for IT operations)
  • SLA: Service Level Agreement
  • VPN: Virtual Private Network
  • DNS: Domain Name System
  • IT: Information Technology

3. Disaster Recovery Team and Roles/Responsibilities

A dedicated Disaster Recovery Team is responsible for executing this plan. Team members are expected to be available 24/7 during an active disaster event.

3.1 DR Team Structure

| Role | Primary Contact | Alternate Contact | Responsibilities |

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

| DR Coordinator | [Name, Title, Phone, Email] | [Name, Title, Phone, Email] | Overall command and control; declares disaster, initiates DRP, coordinates all recovery efforts, liaison with executive management, ensures communication plan execution, approves failback. |

| Infrastructure Lead | [Name, Title, Phone, Email] | [Name, Title, Phone, Email] | Recovers network, server, and storage infrastructure; manages physical/virtual server provisioning, network configuration, storage restoration, and DR site connectivity. |

| Applications Lead | [Name, Title, Phone, Email] | [Name, Title, Phone, Email] | Recovers critical applications; manages application installation, configuration, data restoration (if needed), testing, and service validation. Coordinates with business owners for application-specific testing. |

| Database Lead | [Name, Title, Phone, Email] | [Name, Title, Phone, Email] | Restores and recovers databases; manages database backups, replication, consistency checks, and performance tuning in the DR environment. |

| Security Lead | [Name, Title, Phone, Email] | [Name, Title, Phone, Email] | Ensures security posture is maintained during recovery; manages firewall rules, access controls, incident response coordination, vulnerability scanning of DR environment, and security monitoring. |

| Communication Lead | [Name, Title, Phone, Email] | [Name, Title, Phone, Email] | Executes the communication plan; drafts internal/external notifications, manages communication channels (e.g., status page, email blasts, SMS), provides regular updates to stakeholders. |

| Business Liaison | [Name, Title, Phone, Email] | [Name, Title, Phone, Email] | Represents business unit needs; provides input on service prioritization, assists with business process recovery, communicates with end-users, and provides feedback on system functionality post-recovery. |

(Refer to Appendix A for a full contact list with emergency contact details.)


4. Disaster Scenario Activation Criteria

A disaster event is characterized by the unavailability of critical IT systems or infrastructure that significantly impacts business operations and cannot be resolved through standard operational recovery procedures.

4.1 Declaration Process

  1. Initial Assessment (IT Operations/Help Desk): Upon detection of a major incident (e.g., widespread outage, data center failure, confirmed ransomware attack), IT Operations will conduct an immediate assessment to determine the scope and potential duration of the outage.
  2. Notification to DR Coordinator: If the incident is deemed to exceed a predefined threshold (e.g., critical system down for >2 hours, primary data center inaccessible), the DR Coordinator must be notified immediately.
  3. DR Coordinator Decision: The DR Coordinator, in consultation with executive management and relevant technical leads, will evaluate the situation against the activation criteria.
  4. Disaster Declaration: If criteria are met, the DR Coordinator will formally declare a disaster, activate the DRP, and notify the DR Team.

4.2 Activation Criteria Examples

  • Loss of primary data center facility (e.g., power, cooling, physical access).
  • Catastrophic failure of core network infrastructure.
  • Unrecoverable corruption or loss of critical production data.
  • Widespread ransomware infection affecting critical systems.
  • Major application outage exceeding [e.g., 4 hours] for a Tier 0/1 system.
  • Any event where the RTOs of critical systems cannot be met through normal operational recovery.

5. Critical Systems and RTO/RPO Targets

The following table details critical systems, their criticality levels, business owners, and their respective Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs). These targets dictate the urgency and strategy for recovery.

| System/Service Name | Criticality Level | Business Owner | RTO (Time) | RPO (Data Loss) | Dependencies | Recovery Strategy |

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

| Enterprise Resource Planning (ERP) | Tier 0 | Finance/Operations | 2 hours | 15 minutes | Database, Authentication, Network | Active-Passive DR site with database replication and VM snapshots. |

| Customer Relationship Management (CRM) | Tier 1 | Sales/Marketing | 4 hours | 1 hour | Database, Authentication, Web Servers | Active-Passive DR site with hourly database backups and VM replication. |

| E-commerce Platform | Tier 0 | Sales | 1 hour | 5 minutes | Database, Web Servers, Payment Gateway, CDN | Active-Active multi-region deployment with real-time data synchronization. |

| Email System (Exchange/O365) | Tier 1 | All Departments | 6 hours | 4 hours | Active Directory, Network, Storage | Cloud-native resilience (O365) or DR site for on-prem Exchange with DAG. |

| File Servers / SharePoint | Tier 2 | All Departments | 8 hours | 4 hours | Active Directory, Network, Storage | Daily backups to cloud storage with versioning; DR site VM restoration. |

| Active Directory | Tier 0 | IT Infrastructure | 2 hours | 30 minutes | Network, DNS, Domain Controllers | Multiple domain controllers in geographically separate locations; regular system state backups. |

| Core Network Infrastructure | Tier 0 | IT Infrastructure | 1 hour | N/A | Physical Hardware, ISP connectivity | Redundant hardware, redundant ISP links, pre-configured DR network appliances. |

Tier Definitions:

  • Tier 0 (Mission Critical): Systems essential for immediate business operations. Downtime directly results in significant financial loss or regulatory non-compliance.
  • Tier 1 (Business Critical): Systems important for daily operations. Downtime causes significant business disruption but may not halt all operations immediately.
  • Tier 2 (Business Support): Systems that support business functions. Downtime is inconvenient but allows for manual workarounds or delayed processing.

6. Backup and Data Recovery Strategies

A robust backup strategy is fundamental to achieving RPO targets and ensuring data integrity.

6.1 Data Classification

  • Critical Data: Data required for Tier 0/1 systems (e.g., transaction logs, customer databases). High RPO.
  • Important Data: Data for Tier 2 systems (e.g., general files, internal reports). Moderate RPO.
  • Non-critical Data: Data that can be easily recreated or is not essential for immediate recovery.

6.2 Backup Methods and Frequencies

  • Databases (Tier 0/1):

* Method: Transaction log shipping/replication (e.g., SQL Server AlwaysOn, PostgreSQL streaming replication) for near real-time RPO.

* Frequency: Continuous for transaction logs; full backups daily; differential backups hourly.

* Retention: 7 days on-site, 30 days off-site/cloud.

  • Virtual Machines (Tier 0/1/2):

* Method: Hypervisor-level snapshots/replication (e.g., VMware vSphere Replication, Azure Site Recovery).

* Frequency: Hourly snapshots for Tier 0/1; daily for Tier 2.

* Retention: 3-5 days of snapshots, weekly full VM backups for 4 weeks.

  • File Servers:

* Method: Incremental backups with deduplication.

* Frequency: Daily.

* Retention: 30 days, with monthly full backups archived for 1 year.

  • SaaS Applications (e.g., Salesforce, O365):

* Method: Utilize native backup/restore capabilities where available, or third-party SaaS backup solutions.

* Frequency: Daily.

* Retention: As per vendor/SLA or 90 days.

6.3 Backup Locations and Security

  • On-site: Short-term backups for quick recovery of minor incidents.
  • Off-site (Cloud Storage - e.g., AWS S3, Azure Blob Storage): Encrypted, geographically separate storage for long-term retention and disaster recovery. All cloud backups are encrypted in transit and at rest.
  • Immutability: Critical backups stored in immutable storage to protect against ransomware and accidental deletion.

6.4 Backup

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
\n\n\n"); 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'\nimport ReactDOM from 'react-dom/client'\nimport App from './App'\nimport './index.css'\n\nReactDOM.createRoot(document.getElementById('root')!).render(\n \n \n \n)\n"); 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'\nimport './App.css'\n\nfunction App(){\n return(\n
\n
\n

"+slugTitle(pn)+"

\n

Built with PantheraHive BOS

\n
\n
\n )\n}\nexport default App\n"); zip.file(folder+"src/index.css","*{margin:0;padding:0;box-sizing:border-box}\nbody{font-family:system-ui,-apple-system,sans-serif;background:#f0f2f5;color:#1a1a2e}\n.app{min-height:100vh;display:flex;flex-direction:column}\n.app-header{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:40px}\nh1{font-size:2.5rem;font-weight:700}\n"); 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)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nnpm run dev\n\`\`\`\n\n## Build\n\`\`\`bash\nnpm run build\n\`\`\`\n\n## Open in IDE\nOpen the project folder in VS Code or WebStorm.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n"); } /* --- 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",'{\n "name": "'+pn+'",\n "version": "0.0.0",\n "type": "module",\n "scripts": {\n "dev": "vite",\n "build": "vue-tsc -b && vite build",\n "preview": "vite preview"\n },\n "dependencies": {\n "vue": "^3.5.13",\n "vue-router": "^4.4.5",\n "pinia": "^2.3.0",\n "axios": "^1.7.9"\n },\n "devDependencies": {\n "@vitejs/plugin-vue": "^5.2.1",\n "typescript": "~5.7.3",\n "vite": "^6.0.5",\n "vue-tsc": "^2.2.0"\n }\n}\n'); zip.file(folder+"vite.config.ts","import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport { resolve } from 'path'\n\nexport default defineConfig({\n plugins: [vue()],\n resolve: { alias: { '@': resolve(__dirname,'src') } }\n})\n"); zip.file(folder+"tsconfig.json",'{"files":[],"references":[{"path":"./tsconfig.app.json"},{"path":"./tsconfig.node.json"}]}\n'); zip.file(folder+"tsconfig.app.json",'{\n "compilerOptions":{\n "target":"ES2020","useDefineForClassFields":true,"module":"ESNext","lib":["ES2020","DOM","DOM.Iterable"],\n "skipLibCheck":true,"moduleResolution":"bundler","allowImportingTsExtensions":true,\n "isolatedModules":true,"moduleDetection":"force","noEmit":true,"jsxImportSource":"vue",\n "strict":true,"paths":{"@/*":["./src/*"]}\n },\n "include":["src/**/*.ts","src/**/*.d.ts","src/**/*.tsx","src/**/*.vue"]\n}\n'); zip.file(folder+"env.d.ts","/// \n"); zip.file(folder+"index.html","\n\n\n \n \n "+slugTitle(pn)+"\n\n\n
\n \n\n\n"); 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'\nimport { createPinia } from 'pinia'\nimport App from './App.vue'\nimport './assets/main.css'\n\nconst app = createApp(App)\napp.use(createPinia())\napp.mount('#app')\n"); var hasApp=Object.keys(extracted).some(function(k){return k.indexOf("App.vue")>=0;}); if(!hasApp) zip.file(folder+"src/App.vue","\n\n\n\n\n"); 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}\n"); 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)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nnpm run dev\n\`\`\`\n\n## Build\n\`\`\`bash\nnpm run build\n\`\`\`\n\nOpen in VS Code or WebStorm.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n"); } /* --- 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",'{\n "name": "'+pn+'",\n "version": "0.0.0",\n "scripts": {\n "ng": "ng",\n "start": "ng serve",\n "build": "ng build",\n "test": "ng test"\n },\n "dependencies": {\n "@angular/animations": "^19.0.0",\n "@angular/common": "^19.0.0",\n "@angular/compiler": "^19.0.0",\n "@angular/core": "^19.0.0",\n "@angular/forms": "^19.0.0",\n "@angular/platform-browser": "^19.0.0",\n "@angular/platform-browser-dynamic": "^19.0.0",\n "@angular/router": "^19.0.0",\n "rxjs": "~7.8.0",\n "tslib": "^2.3.0",\n "zone.js": "~0.15.0"\n },\n "devDependencies": {\n "@angular-devkit/build-angular": "^19.0.0",\n "@angular/cli": "^19.0.0",\n "@angular/compiler-cli": "^19.0.0",\n "typescript": "~5.6.0"\n }\n}\n'); zip.file(folder+"angular.json",'{\n "$schema": "./node_modules/@angular/cli/lib/config/schema.json",\n "version": 1,\n "newProjectRoot": "projects",\n "projects": {\n "'+pn+'": {\n "projectType": "application",\n "root": "",\n "sourceRoot": "src",\n "prefix": "app",\n "architect": {\n "build": {\n "builder": "@angular-devkit/build-angular:application",\n "options": {\n "outputPath": "dist/'+pn+'",\n "index": "src/index.html",\n "browser": "src/main.ts",\n "tsConfig": "tsconfig.app.json",\n "styles": ["src/styles.css"],\n "scripts": []\n }\n },\n "serve": {"builder":"@angular-devkit/build-angular:dev-server","configurations":{"production":{"buildTarget":"'+pn+':build:production"},"development":{"buildTarget":"'+pn+':build:development"}},"defaultConfiguration":"development"}\n }\n }\n }\n}\n'); zip.file(folder+"tsconfig.json",'{\n "compileOnSave": false,\n "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"]},\n "references":[{"path":"./tsconfig.app.json"}]\n}\n'); zip.file(folder+"tsconfig.app.json",'{\n "extends":"./tsconfig.json",\n "compilerOptions":{"outDir":"./dist/out-tsc","types":[]},\n "files":["src/main.ts"],\n "include":["src/**/*.d.ts"]\n}\n'); zip.file(folder+"src/index.html","\n\n\n \n "+slugTitle(pn)+"\n \n \n \n\n\n \n\n\n"); zip.file(folder+"src/main.ts","import { bootstrapApplication } from '@angular/platform-browser';\nimport { appConfig } from './app/app.config';\nimport { AppComponent } from './app/app.component';\n\nbootstrapApplication(AppComponent, appConfig)\n .catch(err => console.error(err));\n"); zip.file(folder+"src/styles.css","* { margin: 0; padding: 0; box-sizing: border-box; }\nbody { font-family: system-ui, -apple-system, sans-serif; background: #f9fafb; color: #111827; }\n"); 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';\nimport { RouterOutlet } from '@angular/router';\n\n@Component({\n selector: 'app-root',\n standalone: true,\n imports: [RouterOutlet],\n templateUrl: './app.component.html',\n styleUrl: './app.component.css'\n})\nexport class AppComponent {\n title = '"+pn+"';\n}\n"); zip.file(folder+"src/app/app.component.html","
\n
\n

"+slugTitle(pn)+"

\n

Built with PantheraHive BOS

\n
\n \n
\n"); 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}\n"); } zip.file(folder+"src/app/app.config.ts","import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';\nimport { provideRouter } from '@angular/router';\nimport { routes } from './app.routes';\n\nexport const appConfig: ApplicationConfig = {\n providers: [\n provideZoneChangeDetection({ eventCoalescing: true }),\n provideRouter(routes)\n ]\n};\n"); zip.file(folder+"src/app/app.routes.ts","import { Routes } from '@angular/router';\n\nexport const routes: Routes = [];\n"); 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)+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\nng serve\n# or: npm start\n\`\`\`\n\n## Build\n\`\`\`bash\nng build\n\`\`\`\n\nOpen in VS Code with Angular Language Service extension.\n"); zip.file(folder+".gitignore","node_modules/\ndist/\n.env\n.DS_Store\n*.local\n.angular/\n"); } /* --- Python --- */ function buildPython(zip,folder,app,code){ var title=slugTitle(app); var pn=pkgName(app); var src=code.replace(/^\`\`\`[\w]*\n?/m,"").replace(/\n?\`\`\`$/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("\n"):"# add dependencies here\n"; zip.file(folder+"main.py",src||"# "+title+"\n# Generated by PantheraHive BOS\n\nprint(title+\" loaded\")\n"); zip.file(folder+"requirements.txt",reqsTxt); zip.file(folder+".env.example","# Environment variables\n"); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\n\`\`\`\n\n## Run\n\`\`\`bash\npython main.py\n\`\`\`\n"); zip.file(folder+".gitignore",".venv/\n__pycache__/\n*.pyc\n.env\n.DS_Store\n"); } /* --- Node.js --- */ function buildNode(zip,folder,app,code){ var title=slugTitle(app); var pn=pkgName(app); var src=code.replace(/^\`\`\`[\w]*\n?/m,"").replace(/\n?\`\`\`$/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)+"\n"; zip.file(folder+"package.json",pkgJson); var fallback="const express=require(\"express\");\nconst app=express();\napp.use(express.json());\n\napp.get(\"/\",(req,res)=>{\n res.json({message:\""+title+" API\"});\n});\n\nconst PORT=process.env.PORT||3000;\napp.listen(PORT,()=>console.log(\"Server on port \"+PORT));\n"; zip.file(folder+"src/index.js",src||fallback); zip.file(folder+".env.example","PORT=3000\n"); zip.file(folder+".gitignore","node_modules/\n.env\n.DS_Store\n"); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Setup\n\`\`\`bash\nnpm install\n\`\`\`\n\n## Run\n\`\`\`bash\nnpm run dev\n\`\`\`\n"); } /* --- 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:"\n\n\n\n\n"+title+"\n\n\n\n"+code+"\n\n\n\n"; zip.file(folder+"index.html",indexHtml); zip.file(folder+"style.css","/* "+title+" — styles */\n*{margin:0;padding:0;box-sizing:border-box}\nbody{font-family:system-ui,-apple-system,sans-serif;background:#fff;color:#1a1a2e}\n"); zip.file(folder+"script.js","/* "+title+" — scripts */\n"); zip.file(folder+"assets/.gitkeep",""); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\n## Open\nDouble-click \`index.html\` in your browser.\n\nOr serve locally:\n\`\`\`bash\nnpx serve .\n# or\npython3 -m http.server 3000\n\`\`\`\n"); zip.file(folder+".gitignore",".DS_Store\nnode_modules/\n.env\n"); } /* ===== 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(/\n{2,}/g,"

"); h+="

"+hc+"

Generated by PantheraHive BOS
"; zip.file(folder+app+".html",h); zip.file(folder+"README.md","# "+title+"\n\nGenerated by PantheraHive BOS.\n\nFiles:\n- "+app+".md (Markdown)\n- "+app+".html (styled HTML)\n"); } 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);}});}