Disaster Recovery Plan
Run ID: 69caeab8c8ebe3066ba6f6f02026-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) - Comprehensive Outline

This document outlines a comprehensive Disaster Recovery Plan (DRP) designed to ensure business continuity and minimize downtime in the event of a disruptive incident. It covers critical components including RTO/RPO targets, backup strategies, failover procedures, communication protocols, and testing schedules.


1. Introduction and Purpose

The purpose of this Disaster Recovery Plan (DRP) is to provide a structured, actionable framework for responding to and recovering from disruptive events that could impact critical IT systems, data, and business operations. This plan aims to minimize the duration of service interruptions, protect data integrity, and ensure the timely restoration of essential business functions, thereby safeguarding organizational assets and reputation.


2. Scope

This DRP covers all critical IT infrastructure, applications, and data essential for core business operations. This includes, but is not limited to:

  • Core business applications (e.g., CRM, ERP, Financial Systems)
  • Database servers and associated data
  • Web servers and public-facing applications
  • Network infrastructure (firewalls, routers, switches)
  • Virtualization platforms
  • Email and communication systems
  • File servers and shared storage
  • User workstations and mobile devices (recovery of data/configuration)
  • Cloud-based services and integrations

3. Disaster Declaration Criteria

A disaster will be declared when any of the following events significantly disrupt critical business operations or IT services, making normal operations impossible:

  • Major data center outage (power, cooling, network connectivity)
  • Catastrophic hardware failure impacting critical systems
  • Major cyber-attack (ransomware, data breach, DoS attack)
  • Natural disaster (fire, flood, earthquake) affecting primary facilities
  • Widespread software corruption or system failure
  • Loss of critical personnel impacting IT operations for an extended period

Declaration authority resides with the Incident Response Team Lead, IT Director, or designated senior management.


4. Recovery Objectives

Defining clear Recovery Time Objectives (RTO) and Recovery Point Objectives (RPO) is crucial for prioritizing recovery efforts and allocating resources effectively.

4.1. Recovery Time Objectives (RTO)

The maximum tolerable duration of downtime for a specific application or system after a disaster.

  • Tier 0: Critical Systems (e.g., Core Transaction Processing, Customer-Facing Web Services)

* RTO: 1-4 hours

* Description: Systems that are absolutely essential for immediate business operations and direct customer interaction. Extended downtime results in significant financial loss and reputational damage.

  • Tier 1: Essential Systems (e.g., ERP, CRM, Email, Internal Communication)

* RTO: 4-8 hours

* Description: Systems vital for daily operations, internal productivity, and ongoing business processes.

  • Tier 2: Important Systems (e.g., File Servers, Departmental Applications, Development Environments)

* RTO: 8-24 hours

* Description: Systems that support business functions but can tolerate short periods of unavailability without immediate catastrophic impact.

  • Tier 3: Non-Critical Systems (e.g., Test Environments, Archive Systems)

* RTO: 24-48+ hours

* Description: Systems that can be restored with lower priority, with minimal impact on immediate business operations.

4.2. Recovery Point Objectives (RPO)

The maximum amount of data that can be lost from a system due to an incident. This is directly tied to backup and replication strategies.

  • Tier 0: Critical Systems (e.g., Core Transaction Processing, Customer-Facing Web Services)

* RPO: 0-15 minutes

* Description: Data loss must be minimal. Requires continuous replication or very frequent snapshots.

  • Tier 1: Essential Systems (e.g., ERP, CRM, Email, Internal Communication)

* RPO: 15 minutes - 1 hour

* Description: Acceptable to lose a small amount of recent data. Requires frequent replication or hourly backups.

  • Tier 2: Important Systems (e.g., File Servers, Departmental Applications, Development Environments)

* RPO: 1-4 hours

* Description: Daily backups with incremental or differential backups throughout the day.

  • Tier 3: Non-Critical Systems (e.g., Test Environments, Archive Systems)

* RPO: 4-24 hours

* Description: Daily backups are sufficient.


5. Backup and Data Recovery Strategies

A multi-layered backup strategy ensures data protection and efficient recovery.

5.1. Backup Types and Frequency

  • Full Backups:

* Frequency: Weekly (e.g., every Sunday) for all critical systems.

* Method: Full image-level backups for virtual machines; full database backups for all production databases.

  • Differential Backups:

* Frequency: Daily (Monday-Saturday) for all critical systems.

* Method: Capture changes since the last full backup.

  • Incremental Backups:

* Frequency: Hourly or every 4 hours for Tier 0/1 systems; daily for Tier 2/3 systems.

* Method: Capture changes since the last backup (full, differential, or incremental).

  • Database Transaction Logs:

* Frequency: Continuous or every 15 minutes for Tier 0/1 databases.

* Method: Ensure point-in-time recovery capabilities.

  • Cloud-Native Backups/Snapshots:

* Frequency: Automated snapshots for cloud instances (e.g., AWS EBS snapshots, Azure Managed Disk snapshots) as per RPO targets.

5.2. Backup Storage Locations

  • On-Premise (Primary):

* Location: Dedicated NAS/SAN storage within the primary data center.

* Purpose: Fast recovery for common incidents (e.g., accidental deletion, single server failure).

  • Off-Site (Secondary):

* Location: Secure, geographically separate data center or cloud storage (e.g., AWS S3, Azure Blob Storage).

* Purpose: Protection against site-wide disasters. Data transfer via secure VPN/direct connect.

  • Cloud Archival (Tertiary):

* Location: Long-term, cost-effective cloud storage (e.g., AWS Glacier, Azure Archive Storage).

* Purpose: Compliance, long-term retention, historical data.

5.3. Backup Retention Policies

  • Daily Backups: Retain for 7-14 days.
  • Weekly Backups: Retain for 4-8 weeks.
  • Monthly Backups: Retain for 12 months.
  • Annual Backups: Retain for 7 years (or as per regulatory compliance).
  • Database Transaction Logs: Retain for 24 hours (for point-in-time recovery), then archive as part of daily backups.

5.4. Data Encryption

All backups, both in transit and at rest, must be encrypted using industry-standard encryption protocols (e.g., AES-256).

5.5. Data Integrity Checks

Regular automated checks (e.g., checksum verification) and periodic manual restore tests are performed to ensure backup integrity and recoverability.


6. Failover Procedures

Detailed, step-by-step procedures for switching from primary systems to redundant or recovery systems.

6.1. Network Failover

  • DNS Updates: Update public and internal DNS records to point to recovery site IPs. TTLs set to low values (e.g., 5 minutes) to expedite propagation.
  • Load Balancer Configuration: Reconfigure or failover load balancers to direct traffic to the recovery environment.
  • VPN/Network Connectivity: Establish or verify VPN tunnels/direct connect links to the recovery site.
  • Firewall Rules: Ensure necessary firewall rules are active at the recovery site to allow application traffic.

6.2. Application and Database Failover

  • Virtual Machine Replication Failover:

1. Initiate failover process in hypervisor management console (e.g., VMware Site Recovery Manager, Azure Site Recovery).

2. Power on replicated VMs at the recovery site.

3. Verify network connectivity and IP addressing.

4. Perform boot order sequencing for dependent applications (e.g., database before application servers).

  • Database Cluster Failover (e.g., AlwaysOn Availability Groups, PostgreSQL Streaming Replication):

1. Initiate manual or automated failover to the designated secondary replica at the recovery site.

2. Verify database status, data synchronization, and listener connectivity.

3. Update application connection strings if not using a listener.

  • Cloud-Native Application Failover:

1. Leverage cloud provider's disaster recovery services (e.g., AWS Multi-AZ deployments, Azure Zone Redundancy, cross-region replication).

2. Activate standby environments or deploy applications from templates/images in the recovery region.

3. Update Route 53 or Azure DNS to point to the new endpoints.

6.3. User Access and Authentication

  • Directory Services: Ensure Active Directory/LDAP replication is functional or that a read-only domain controller (RODC) is available at the recovery site.
  • SSO/Identity Providers: Verify connectivity and functionality of SSO providers to the recovered applications.
  • Remote Access: Provide instructions for users to connect to the recovery environment (e.g., VPN client configuration, new URLs).

6.4. Data Recovery from Backups (if replication is not viable)

  1. Identify the latest clean backup set (full + differentials/incrementals) based on RPO.
  2. Restore the backup to designated recovery infrastructure (VMs, physical servers, cloud instances).
  3. Perform data integrity checks post-restoration.
  4. Re-point applications to the newly restored data.

7. Communication Plan

Effective communication is critical during a disaster to manage expectations, coordinate efforts, and minimize panic.

7.1. Internal Communication

  • Incident Response Team (IRT):

* Primary Channel: Dedicated incident management platform (e.g., Slack channel, Microsoft Teams, PagerDuty).

* Backup Channel: Conference bridge, emergency SMS group.

* Frequency: Continuous updates, regular scheduled briefings (e.g., every 30-60 minutes).

  • Employees:

* Initial Notification: Via emergency notification system (e.g., Everbridge, email, intranet banner, SMS).

* Updates: Regular updates on status, expected recovery times, and impact on services via email, intranet portal, or dedicated status page.

* Instructions: Guidance on remote work, alternative communication methods, or service availability.

  • Management/Stakeholders:

* Initial Notification: Via email and direct call from Incident Commander.

* Updates: Executive summaries provided at agreed intervals (e.g., hourly, every 4 hours) by the Incident Commander or designated communications lead. Focus on business impact, recovery progress, and estimated restoration times.

7.2. External Communication

  • Customers:

* Initial Notification: Public status page, social media (if applicable), email to key accounts.

* Content: Acknowledge the issue, state that teams are working on it, avoid technical jargon, provide an estimated time to resolution if available.

* Updates: Regular updates on status page and social media. Direct email to affected customers if possible.

  • Vendors/Partners:

* Notification: Direct email/phone call to relevant contacts.

* Purpose: Inform them of potential impacts to shared services or dependencies, coordinate support efforts.

  • Media/Public Relations:

* Policy: All media inquiries directed to a designated spokesperson (e.g., PR Manager, CEO).

* Guidance: No unauthorized statements to the media. Pre-approved statements only.

  • Regulatory Bodies (if applicable):

* Notification: As per regulatory requirements (e.g., data breach notifications, financial service disruptions).

* Timeline: Adhere to strict reporting timelines.

7.3. Communication Tools

  • Primary: Email, Microsoft Teams/Slack, Internal Status Page.
  • Secondary/Emergency: SMS gateway, dedicated conference bridge, external status page (e.g., Atlassian Statuspage).
  • Contact Lists: Up-to-date contact lists for all internal teams, management, external vendors, and key customers, stored both digitally and in hard copy off-site.

8. Roles and Responsibilities

A clear chain of command and defined roles ensure an organized and efficient response.

  • Incident Commander (IC): Overall lead for disaster recovery efforts. Declares disaster, authorizes actions, manages communication with senior management.
  • IT Director/Manager: Oversees IT recovery operations, resource allocation, and technical strategy.
  • Network Team Lead: Restores network connectivity, configures firewalls, DNS.
  • Server/Infrastructure Team Lead: Recovers servers, virtual machines, storage.
  • Application Team Lead: Restores and validates application functionality, data integrity.
  • Database Administrator (DBA): Recovers and validates databases.
  • Security Team Lead: Monitors for security threats, ensures security posture of recovered systems.
  • Communications Lead: Manages all internal and external communications.
  • Business Unit Representatives: Provide business impact assessments, prioritize application recovery, perform user acceptance testing.

9. Testing and Maintenance Schedule

Regular testing and maintenance are crucial to ensure the DRP remains effective and current.

9.1. Testing Types

  • Tabletop Exercises (Annual):

* Purpose: Walkthrough of the plan with key stakeholders to identify gaps in procedures, roles, and communication. No actual systems are failed over.

* Participants: Incident Response Team, Business Unit Leads, Senior Management.

  • Component-Level Testing (Quarterly):

* Purpose: Test specific components like backup restoration, individual server failover, or network path changes.

* Participants: Relevant IT teams.

  • Full Failover Simulation (Bi-Annual or Annually):

* Purpose: Simulate a full disaster by performing a complete failover of critical systems to the recovery site.

* Participants: All Incident Response Team members, Business Unit Testers.

* Outcome: Measure RTO/RPO adherence, identify bottlenecks, validate procedures.

  • Failback Testing (Post-Full Failover Test):

* Purpose: Test the process of returning operations from the recovery site back to the primary data center (or a rebuilt primary). Essential to ensure data synchronization and minimize downtime during the return.

9.2. Testing Schedule

  • Tabletop Exercises: Annually (e.g., Q1).
  • Backup Restoration Tests: Quarterly (e.g., Q2, Q4). Randomly select critical systems and restore data to a test environment.
  • Full Failover Simulation: Annually (e.g., Q3). Conduct during off-peak hours or a maintenance window.
  • Failback Testing: Immediately following a full failover simulation.
  • Security Vulnerability Scans & Penetration Testing: Annually on recovery environment infrastructure.

9.3. Documentation Review and Updates

  • Annual Review: The entire DRP document will be reviewed annually by the Incident Response Team and relevant stakeholders.
  • Event-Driven Updates: The plan will be updated immediately following any disaster event, significant infrastructure change, or failed test to incorporate lessons learned.
  • Contact Information: All contact lists
gemini Output

Disaster Recovery Plan (DRP)


Document Version: 1.0

Date: October 26, 2023

Author: PantheraHive AI

Approved By: [Client Stakeholder Name/Role]


1. Introduction

This Disaster Recovery Plan (DRP) outlines the procedures, strategies, and resources required to respond to a disruptive event, restore critical IT systems and infrastructure, and recover data to ensure business continuity. The primary goal is to minimize the impact of a disaster, reduce recovery time, and mitigate potential losses.

1.1. Purpose

To provide a structured and actionable framework for the recovery of critical IT infrastructure, applications, and data following a disaster or significant service interruption.

1.2. Scope

This DRP covers the recovery of all identified critical IT systems, applications, and data hosted within [Specify Primary Data Center/Cloud Region] and essential for the continued operation of [Client Company Name]'s core business functions. It includes procedures for data backup, system restoration, network connectivity, and communication during and after a disaster.

1.3. Objectives

  • Ensure the safety and well-being of personnel.
  • Minimize the duration of service interruption.
  • Restore critical business functions within defined Recovery Time Objectives (RTOs).
  • Recover data with minimal loss, adhering to defined Recovery Point Objectives (RPOs).
  • Provide clear communication channels for internal and external stakeholders.
  • Maintain compliance with regulatory requirements.
  • Protect the organization's reputation and financial stability.

2. Key Definitions

  • Disaster Recovery (DR): The process of resuming access to data, applications, and IT resources after a disaster.
  • Business Continuity Plan (BCP): A comprehensive plan that ensures the continued operation of critical business functions during and after a disaster. DR is a subset of BCP.
  • Recovery Time Objective (RTO): The maximum tolerable duration of time that a computer, system, application, or network can be down after a disaster or outage.
  • Recovery Point Objective (RPO): The maximum tolerable amount of data (measured in time) that can be lost from an IT service due to a major incident.
  • Failover: The process of automatically or manually switching to a redundant or standby system or network upon the failure or abnormal termination of the previously active system.
  • Failback: The process of restoring systems to their primary operational state after a failover event and successful recovery.
  • Critical Systems: Systems and applications whose unavailability would have a significant negative impact on business operations.

3. Disaster Recovery Team and Responsibilities

A dedicated Disaster Recovery Team (DRT) is essential for effective plan execution.

| Role | Primary Responsibility

The user is asking for a comprehensive Disaster Recovery Plan. I need to generate a very detailed and professional document covering all the specified sections and more to make it a complete plan.

Here's a breakdown of what needs to be included:

  1. Document Control: Standard section for any official document.
  2. Introduction: Purpose, Scope, Objectives.
  3. Key Definitions: Clarify terms like RTO, RPO.
  4. DR Team and Responsibilities: Define roles and responsibilities.
  5. Risk Assessment & BIA Summary: Briefly touch upon the basis for the plan, especially RTO/RPO.
  6. Recovery Objectives (RTO/RPO): This is a core requirement. Needs to be specific, ideally with examples for different system tiers.
  7. Disaster Detection & Declaration: How is a disaster identified and declared?
  8. Backup and Data Recovery Strategy: Another core requirement. Types, frequency, retention, storage, restoration process.
  9. Failover Procedures: Detailed steps for bringing up services at the DR site. This needs to be generic but imply specific actions.
  10. Failback Procedures: How do we return to the primary site after recovery?
  11. Communication Plan: Who communicates what, when, and how, internally and externally. This is a core requirement.
  12. Testing and Maintenance Schedule: Another core requirement. How often, what types of tests, and how the plan is updated.
  13. Training and Awareness: How personnel are kept informed.
  14. Appendices: Essential supporting information.

I will ensure to use clear, actionable language and provide structured details within each section.

gemini Output

This document outlines the Disaster Recovery Plan (DRP) for [Organization Name], designed to ensure the swift and effective recovery of critical IT systems and data in the event of a disaster. This plan provides a structured approach to minimize downtime, data loss, and operational disruption, safeguarding business continuity and stakeholder trust.


1. Executive Summary

This Disaster Recovery Plan (DRP) for [Organization Name] details the strategies, procedures, and responsibilities required to restore critical business operations following a disruptive event. It establishes clear Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs) for key systems, outlines comprehensive backup and failover mechanisms, defines a robust communication strategy, and mandates a rigorous testing schedule to ensure readiness. The primary goal is to minimize the impact of disasters, protect vital assets, and maintain essential services.

2. Introduction

2.1. Purpose

The purpose of this Disaster Recovery Plan is to provide a structured, actionable framework for responding to and recovering from disruptive events that impact [Organization Name]'s IT infrastructure and critical business functions. This plan aims to:

  • Minimize the duration of service interruptions.
  • Limit the extent of data loss.
  • Ensure the rapid restoration of critical systems and data.
  • Protect personnel, assets, and reputation.
  • Comply with regulatory requirements and industry best practices.

2.2. Scope

This DRP covers all critical IT systems, applications, data, and associated infrastructure necessary for [Organization Name]'s core business operations. This includes, but is not limited to:

  • Primary data centers and cloud environments.
  • Production servers (physical and virtual).
  • Databases.
  • Network infrastructure (LAN, WAN, VPN).
  • Key business applications (e.g., ERP, CRM, financial systems, customer-facing portals).
  • End-user computing environments relevant to critical functions.
  • Data storage and backup systems.

It excludes the broader Business Continuity Plan (BCP) which addresses non-IT-related business processes, although this DRP is a critical component of the overall BCP.

2.3. Objectives

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

  • Rapid Recovery: Restore critical IT services within their defined Recovery Time Objectives (RTOs).
  • Data Integrity: Ensure data loss does not exceed the defined Recovery Point Objectives (RPOs).
  • Operational Continuity: Enable essential business functions to resume quickly and effectively.
  • Communication: Establish clear, timely, and accurate communication with all relevant stakeholders.
  • Compliance: Adhere to all applicable legal, regulatory, and contractual obligations.
  • Safety: Prioritize the safety and well-being of all personnel.

3. Key Definitions

  • Disaster Recovery (DR): The process of restoring data, hardware, and software in the event of a natural or human-induced catastrophe.
  • Business Continuity Plan (BCP): A comprehensive plan to ensure that business operations can continue during and after a disaster or disruption. The DRP is a component of the BCP.
  • Recovery Time Objective (RTO): The maximum tolerable duration of time that a computer, system, application, or network can be down after an incident or disaster.
  • Recovery Point Objective (RPO): The maximum tolerable amount of data (measured in time) that can be lost from a system due to a major incident.
  • 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 systems to the primary site once it has been repaired and verified, after a failover event.
  • Critical System: Any system, application, or data resource whose unavailability would severely impact [Organization Name]'s ability to conduct essential business operations.

4. Disaster Recovery Team

The DR Team is responsible for executing this plan. Roles are assigned to individuals based on their expertise and responsibilities.

4.1. DR Team Roles and Responsibilities

| Role | Primary Individual/Department | Backup Individual/Department | Key Responsibilities |

| --- | --- | --- | --- |

| DR | Team | Manager | IT Operations | IT Operations | Oversees DR plan activation, leads recovery efforts, and coordinates with leadership. |

| Recovery Operations Lead | IT Operations | IT Operations | Directs technical recovery teams, manages system restoration, and verifies functionality. |

| Network & Security Lead | Network Team | Network Team | Restores network connectivity, configures security devices, and monitors network health. |

| Systems & Database Lead | Systems Team | Systems Team | Recovers servers, databases, and critical applications; manages data restoration. |

| Applications Lead | Application Team | Application Team | Validates application functionality post-recovery, coordinates user acceptance testing. |

| Communications Lead | Marketing/Comms | HR | Manages internal and external communications, drafts official statements, and updates stakeholders. |

| Logistics & Support Lead | Facilities/Admin | Procurement | Arranges for necessary equipment, supplies, and alternative workspaces if required. |

4.2. Contact Information

A detailed contact list for all DR Team members, key vendors, emergency services, and external contacts will be maintained in Appendix A and an off-site, accessible location.

5. Critical Systems and Applications

Identifying and prioritizing critical systems is fundamental for effective disaster recovery.

5.1. Critical Systems Inventory

A comprehensive inventory of critical systems, applications, and associated dependencies is maintained and reviewed quarterly. This includes:

  • System Name: [e.g., ERP System (SAP/Oracle)]
  • Description: [e.g., Core financial, inventory, and supply chain management]
  • Owner: [e.g., Finance Department]
  • Dependencies: [e.g., Database Server, Active Directory, Network Storage]
  • Primary Location: [e.g., Primary Data Center / AWS us-east-1]
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);}});}