Disaster Recovery Plan
Run ID: 69cb5b3561b1021a29a884b52026-03-31Infrastructure
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: Comprehensive Strategy for Business Continuity

This document outlines a comprehensive Disaster Recovery Plan (DRP) designed to ensure the rapid recovery of critical IT systems, data, and business operations in the event of a disruptive incident. The plan establishes clear objectives, procedures, and responsibilities to minimize downtime, data loss, and overall business impact.


1. Executive Summary

This Disaster Recovery Plan (DRP) is a critical component of our overall business continuity strategy. Its primary purpose is to define the procedures and resources necessary to restore critical business functions following a disaster that impacts our IT infrastructure. The plan encompasses clear RTO (Recovery Time Objective) and RPO (Recovery Point Objective) targets, robust backup strategies, detailed failover and failback procedures, a comprehensive communication framework, and a structured testing and maintenance schedule. Adherence to this plan will ensure resilience, protect data integrity, and maintain operational continuity.

2. Introduction and Purpose

The purpose of this DRP is to provide a structured and actionable framework for responding to and recovering from various disaster scenarios, including natural disasters, cyberattacks, significant hardware failures, power outages, and other disruptive events. This plan aims to:

  • Minimize the duration of service disruption.
  • Prevent irreversible data loss.
  • Protect critical business assets.
  • Ensure the safety and well-being of personnel.
  • Maintain customer trust and regulatory compliance.
  • Facilitate an orderly and efficient recovery process.

3. Scope

This DRP covers all critical IT systems, applications, data, and associated infrastructure deemed essential for the continued operation of [Organization Name]. This includes, but is not limited to:

  • Core Business Applications: [List 3-5 critical applications, e.g., ERP, CRM, E-commerce platform, Financial Systems].
  • Database Systems: [List specific databases, e.g., SQL Server, PostgreSQL, MongoDB].
  • Network Infrastructure: Core routers, switches, firewalls, VPN services.
  • Server Infrastructure: Physical and virtual servers hosting critical services.
  • Data Storage: Primary data stores, file shares, cloud storage.
  • Communication Systems: Email, VoIP, collaboration platforms.
  • Key Dependencies: Cloud services, third-party APIs, vendor integrations.

Out-of-scope for this document are individual user workstation recovery (addressed by standard IT support procedures) and physical building recovery (addressed by a separate Business Continuity Plan).

4. Roles and Responsibilities

A clearly defined command structure is essential for effective disaster response.

  • Disaster Recovery Team Lead (DRTL): [Name/Role, e.g., CIO/IT Director]

* Overall command and control during a disaster.

* Authorizes DRP activation.

* Liaises with executive management.

* Oversees recovery efforts.

  • Technical Recovery Team: [Name/Role, e.g., Senior Network Engineer, Database Administrator]

* Executes technical recovery procedures (servers, networks, databases, applications).

* Restores data from backups.

* Performs system configuration and testing.

  • Communication Lead: [Name/Role, e.g., Head of Communications/HR Director]

* Manages internal and external communications.

* Disseminates status updates.

* Coordinates with media (if necessary).

  • Business Operations Lead: [Name/Role, e.g., COO/Department Head]

* Assesses business impact.

* Coordinates manual workarounds (if applicable).

* Ensures business processes are restored.

  • Security Lead: [Name/Role, e.g., CISO/Security Manager]

* Monitors for security breaches during and after the event.

* Ensures secure recovery and data integrity.

* Manages incident forensics.

Emergency Contact List: (To be maintained in Appendix A and an offsite, accessible location)

5. Business Impact Analysis (BIA) & Recovery Objectives (RTO/RPO)

A summary of the BIA identifies critical business functions and their dependencies on IT systems. Based on this, specific Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs) have been established.

  • Recovery Time Objective (RTO): The maximum tolerable duration of time that a business process or system can be down after an incident before significant harm is experienced.
  • Recovery Point Objective (RPO): The maximum tolerable amount of data that can be lost from an IT service due to a major incident.

| System/Application Group | Business Impact (High/Medium/Low) | RTO Target | RPO Target |

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

| Tier 0/1: Critical Systems | | | |

| [e.g., E-commerce Platform] | High | 1-2 hours | 0-15 minutes |

| [e.g., Core Database (ERP)] | High | 2-4 hours | 0-30 minutes |

| [e.g., Financial Systems] | High | 2-4 hours | 0-30 minutes |

| Tier 2: Important Systems | | | |

| [e.g., Internal Email/VoIP] | Medium | 4-8 hours | 1-4 hours |

| [e.g., CRM System] | Medium | 4-8 hours | 1-4 hours |

| Tier 3: Non-Essential Systems | | | |

| [e.g., Internal Wiki] | Low | 24-48 hours | 24 hours |

Note: Specific RTO/RPO for each individual application will be detailed in Appendix B.

6. Backup and Recovery Strategies

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

6.1 Data Backup Strategy

  • Critical Data (Tier 0/1 Systems):

* Method: Real-time replication (e.g., database mirroring, log shipping, SAN replication) to a secondary data center/cloud region for RPO of <15 minutes.

* Frequency: Continuous for transactional data.

* Storage: Primary replication target, plus daily full backups to immutable object storage (AWS S3, Azure Blob) in a separate geographical region.

* Retention: 7 days daily, 4 weeks weekly, 12 months monthly, 7 years annually.

  • Important Data (Tier 2 Systems):

* Method: Incremental backups during business hours, full daily backups.

* Frequency: Every 4 hours incremental, daily full.

* Storage: Encrypted object storage in a separate geographical region.

* Retention: 7 days daily, 4 weeks weekly, 12 months monthly.

  • Non-Essential Data (Tier 3 Systems):

* Method: Weekly full backups.

* Frequency: Once per week.

* Storage: Encrypted object storage.

* Retention: 4 weeks.

6.2 System Backup/Image Strategy

  • Virtual Machines (VMs):

* Method: Snapshot-based backups of entire VMs (including OS, applications, and data).

* Frequency: Daily for critical VMs, weekly for others.

* Storage: Offsite encrypted storage, capable of quick restoration or spin-up in a recovery environment.

  • Physical Servers:

* Method: Bare-metal image backups.

* Frequency: Monthly, or after significant configuration changes.

* Storage: Offsite encrypted storage.

  • Configuration Backups:

* Network Devices: Automated configuration backups daily to a centralized repository (e.g., Git, TFTP server).

* Firewalls: Configuration backups daily.

* Application Configurations: Version-controlled in a secure repository.

6.3 Backup Verification and Encryption

  • Integrity Checks: All backups are regularly verified for integrity and recoverability through automated checks and periodic full restore tests.
  • Encryption: All data at rest and in transit (during backup transfer) is encrypted using industry-standard algorithms (e.g., AES-256).
  • Location: Backups are stored in at least two geographically distinct locations, with one being air-gapped or immutable where feasible, to protect against localized disasters and ransomware.

7. Failover and Failback Procedures

These procedures detail the steps to switch from primary systems to redundant or recovery systems and subsequently return to the primary environment once it's restored.

7.1 Disaster Declaration and Activation

  1. Detection: Incident detected via monitoring systems, user reports, or external alerts.
  2. Assessment: DRTL and Technical Recovery Team assess the incident's impact, scope, and potential duration.
  3. Declaration: If the incident meets the criteria for a disaster (e.g., primary data center offline, critical system RTO/RPO violation imminent), the DRTL declares a disaster.
  4. DRP Activation: DRTL formally activates the DRP, notifies the Emergency Response Team (ERT), and initiates communication protocols.

7.2 Failover Procedures (General Steps)

  • Step 1: Isolate Primary Environment (if applicable): Prevent further damage or data corruption by disconnecting the affected primary systems from the network.
  • Step 2: Activate Recovery Environment:

* Cloud-based Recovery: Initiate spin-up of pre-configured VMs/instances in the designated recovery region/zone.

* Secondary Data Center: Switch over to redundant systems in the secondary data center.

  • Step 3: Data Restoration/Synchronization:

* For replicated data, ensure consistency and cut over to the secondary replica.

* For backed-up data, restore the latest viable backup to the recovery environment.

  • Step 4: Network Configuration Update:

* Update DNS records (e.g., A records, CNAMEs) to point to the recovery site IP addresses or load balancers. TTLs should be low for critical systems.

* Update VPN configurations, firewall rules, and routing tables as necessary.

  • Step 5: Application Configuration and Testing:

* Verify application configurations (e.g., database connection strings, API endpoints).

* Perform smoke tests and functional testing of critical applications.

* Validate connectivity to internal and external dependencies.

  • Step 6: User Access Restoration:

* Restore user access to applications.

* Monitor system performance and stability.

Specific Failover Procedures (Examples - detailed in Appendix C):

  • Database Cluster Failover: Steps for promoting a replica, updating application connection strings.
  • Web Application Failover: Steps for DNS updates, load balancer configuration, deployment verification.
  • Network Services Failover: Steps for routing changes, VPN re-establishment.

7.3 Failback Procedures

Once the primary environment is restored and validated, a controlled failback process will be initiated.

  • Step 1: Primary Environment Restoration: Repair and validate the primary infrastructure, ensuring it is stable and ready to receive traffic.
  • Step 2: Data Synchronization:

* Synchronize any data changes from the recovery environment back to the primary environment. This is critical to prevent data loss incurred during the disaster.

* Establish replication from the recovery site to the primary site.

  • Step 3: Test Primary Environment: Perform thorough testing on the restored primary systems with simulated traffic.
  • Step 4: Scheduled Failback: Plan a maintenance window for the failback.
  • Step 5: Execute Failback:

* Temporarily halt writes to the recovery environment.

* Ensure all data is synchronized to the primary.

* Switch DNS records or load balancer configurations back to the primary environment.

* Verify all systems are operational in the primary environment.

  • Step 6: Deactivate Recovery Environment: Once the primary environment is fully operational and stable, decommission or de-provision the recovery resources to minimize costs.
  • Step 7: Post-Mortem and Documentation: Conduct a post-incident review to identify lessons learned and update documentation.

8. Communication Plan

Effective communication is paramount during a disaster.

8.1 Internal Communication

  • Initial Notification:

* Audience: ERT members, Executive Management.

* Method: Emergency notification system (e.g., PagerDuty, SMS, dedicated crisis line), email (secondary).

* Content: Disaster declared, DRP activated, initial assessment.

  • Status Updates:

* Audience: All employees.

* Method: Company-wide email, internal communication platform (e.g., Slack, Teams), dedicated status page.

* Frequency: Every [e.g., 2-4] hours during active recovery, daily thereafter until full resolution.

* Content: Current status, estimated time to recovery, instructions for staff (e.g., remote work, alternate locations).

  • Escalation: Clear escalation paths for critical issues within the ERT and to executive management.

8.2 External Communication

  • Customer Communication:

* Audience: Customers.

* Method: Public status page, email blast (for critical service outages), social media (if appropriate).

* Content: Acknowledge incident, apologize for disruption, provide estimated resolution time, direct to status page for updates.

* Approval: All customer communications must be approved by the Communication Lead and DRTL.

  • Vendor/Partner Communication:

* Audience: Key vendors, service providers, partners.

* Method: Direct email, phone calls.

* Content: Inform of incident, assess impact on shared services, coordinate recovery efforts.

  • Regulatory/Legal Communication:

* Audience: Relevant regulatory bodies (if data breach or compliance issue).

* Method: As required by law/regulation.

* Content: Factual information, actions taken, impact assessment.

* Approval: Legal counsel and DRTL.

  • Media Communication (if necessary):

* Audience: Press, public.

* Method: Press release, designated spokesperson.

* Content: Factual, controlled, and approved by executive management and legal.

9. Testing and Maintenance Schedule

Regular testing and maintenance are crucial to ensure the DRP remains

gemini Output

Disaster Recovery Plan

Document Version: 1.0

Date: October 26, 2023

Prepared For: [Customer Company Name]

Prepared By: PantheraHive


1. Executive Summary

This Disaster Recovery Plan (DRP) outlines the strategies, procedures, and responsibilities for [Customer Company Name] to recover from a disruptive event that impacts its critical IT infrastructure and business operations. The primary goal of this DRP is to minimize downtime, data loss, and operational disruption, ensuring business continuity and the timely restoration of essential services. This plan defines clear Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs), details backup and failover strategies, establishes communication protocols, and sets forth a rigorous testing and maintenance schedule to ensure its effectiveness.

2. Introduction

2.1. Purpose

The purpose of this Disaster Recovery Plan is to provide a structured and actionable framework for [Customer Company Name] to respond to, recover from, and resume operations after a disaster. It aims to protect the organization's critical assets, data, and reputation by outlining systematic procedures for recovery.

2.2. Scope

This DRP covers all critical IT systems, applications, data, and associated infrastructure deemed essential for the continued operation of [Customer Company Name]'s core business functions. It includes on-premises infrastructure, cloud-based services, and data storage. The plan encompasses the entire recovery lifecycle, from incident detection to full operational restoration and failback.

2.3. Objectives

  • Minimize Downtime: Achieve defined Recovery Time Objectives (RTOs) for critical systems and applications.
  • Minimize Data Loss: Achieve defined Recovery Point Objectives (RPOs) for critical data.
  • Ensure Data Integrity: Protect the integrity and confidentiality of all organizational data during and after a disaster.
  • Restore Critical Business Functions: Systematically restore essential business operations in a prioritized manner.
  • Facilitate Communication: Establish clear and effective communication channels with internal stakeholders, customers, vendors, and regulatory bodies.
  • Provide a Framework for Response: Equip the Disaster Recovery Team with clear roles, responsibilities, and procedures.
  • Compliance: Support regulatory and contractual obligations related to business continuity and data protection.

3. Key Definitions

  • Disaster Recovery (DR): The process of restoring data, hardware, and applications after a catastrophic event.
  • Business Continuity Plan (BCP): A comprehensive plan to ensure that business functions continue during and after a disaster. DR is a component of BCP.
  • Recovery Time Objective (RTO): The maximum tolerable duration of time that a computer, system, network, or application can be down after a disaster or disruption.
  • Recovery Point Objective (RPO): The maximum tolerable amount of data (measured in time) that can be lost after a disaster.
  • 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 their original primary operational state after recovery operations have concluded at the disaster recovery site.
  • Critical Systems: Systems and applications whose unavailability would have a significant negative impact on business operations, revenue, or compliance.
  • Warm Site: A recovery site that has hardware and connectivity but requires manual setup and data restoration.
  • Hot Site: A fully equipped, mirrored recovery site with near real-time data replication, ready for immediate failover.

4. Disaster Recovery Team

The Disaster Recovery Team (DRT) is responsible for executing this plan. Roles and responsibilities are assigned to ensure a coordinated and effective response.

4.1. DR Team Roles and Responsibilities

| Role | Primary Responsibility | Backup/Alternate | Contact Info (Primary) | Contact Info (Backup) |

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

| DR Coordinator | Overall management of DR efforts, plan activation, communication with leadership, decision-making. | [Backup DR Coordinator] | [Phone/Email] | [Phone/Email] |

| IT Recovery Lead | Oversees technical recovery of all IT systems, coordinates with technical teams. | [Backup IT Recovery Lead] | [Phone/Email] | [Phone/Email] |

| Network Lead | Manages network infrastructure recovery, connectivity, VPNs, firewalls. | [Backup Network Lead] | [Phone/Email] | [Phone/Email] |

| Server/Compute Lead | Manages server and virtual machine recovery, OS configuration, hardware provisioning. | [Backup Server/Compute Lead] | [Phone/Email] | [Phone/Email] |

| Database Lead | Responsible for database restoration, integrity checks, and replication setup. | [Backup Database Lead] | [Phone/Email] | [Phone/Email] |

| Application Lead(s) | Coordinates recovery and testing of specific critical applications (e.g., ERP, CRM, Web Applications). | [Backup Application Lead(s)] | [Phone/Email] | [Phone/Email] |

| Data Recovery Lead | Oversees data restoration from backups, ensuring data integrity and availability. | [Backup Data Recovery Lead] | [Phone/Email] | [Phone/Email] |

| Communications Lead | Manages internal and external communications, public relations, and stakeholder updates. | [Backup Communications Lead] | [Phone/Email] | [Phone/Email] |

| Business Operations Lead | Coordinates with business units for operational recovery, verifies business function restoration. | [Backup Business Operations Lead] | [Phone/Email] | [Phone/Email] |

Note: A detailed contact list for all team members and key stakeholders is provided in Appendix A.

5. Recovery Objectives (RTO/RPO)

Recovery objectives are defined based on Business Impact Analysis (BIA) findings, prioritizing systems critical to core business functions.

5.1. Criticality Tiers

| Tier | Description | RTO Target | RPO Target |

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

| Tier 0 | Mission-Critical: Immediate and severe impact on core business, legal, or safety. Cannot operate without. | < 1 hour | < 15 minutes |

| Tier 1 | Business-Critical: Significant operational or financial impact. Cannot operate for extended periods. | 1-4 hours | < 1 hour |

| Tier 2 | Business-Important: Moderate operational impact. Can tolerate short-term disruption. | 4-24 hours | < 4 hours |

| Tier 3 | Non-Critical: Minimal operational impact. Can tolerate longer disruption. | > 24 hours | > 24 hours |

5.2. System-Specific RTO/RPO Targets

| System/Application | Criticality Tier | Primary Owner | RTO Target | RPO Target | Recovery Method |

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

| ERP System | Tier 0 | [Dept. Owner] | 2 hours | 30 minutes | Active-Passive DR site with database replication |

| CRM System | Tier 1 | [Dept. Owner] | 4 hours | 1 hour | Cloud-based DR, VM snapshots, data backups |

| E-commerce Platform | Tier 0 | [Dept. Owner] | 1 hour | 15 minutes | Active-Active or Active-Passive with DNS failover |

| Financial System | Tier 1 | [Dept. Owner] | 3 hours | 1 hour | Dedicated DR VMs, daily backups, transaction logs |

| Email System | Tier 2 | [Dept. Owner] | 6 hours | 4 hours | Cloud provider DR capabilities (e.g., M365 resilience) |

| File Servers | Tier 2 | [Dept. Owner] | 8 hours | 4 hours | Off-site backups, cloud sync |

| Internal Wiki/Intranet | Tier 3 | [Dept. Owner] | 24 hours | 12 hours | Off-site backups, manual restoration |

| [Add other critical systems] | | | | | |

6. Backup and Data Recovery Strategy

This section details the strategies for backing up critical data and systems to meet defined RPOs and facilitate recovery.

6.1. Data Classification

Data is classified based on its criticality, sensitivity, and regulatory requirements. This classification dictates backup frequency, retention, and storage location.

  • Critical Data (Tier 0/1): Customer data, financial records, intellectual property, core application databases.
  • Important Data (Tier 2): Employee data, internal documents, non-critical application data.
  • Non-Critical Data (Tier 3): Temporary files, public information.

6.2. Backup Types and Frequencies

| System/Data Type | Backup Type | Frequency | Retention Policy | Encryption | Storage Location |

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

| ERP Database | Full (Weekly), Incremental (Daily), Transaction Logs (Hourly) | Daily/Hourly | 7 daily, 4 weekly, 12 monthly, 7 yearly | AES-256 | Primary: On-site SAN; DR: Cloud/Off-site |

| CRM Database | Full (Weekly), Differential (Daily) | Daily | 7 daily, 4 weekly, 6 monthly | AES-256 | Primary: On-site NAS; DR: Cloud |

| E-commerce Data | Full (Daily), Transaction Logs (Real-time) | Daily/Real-time | 7 daily, 4 weekly, 3 monthly | AES-256 | Primary: Cloud; DR: Geo-redundant Cloud |

| Virtual Machines (Critical) | Snapshot (Daily), Full (Weekly) | Daily | 7 daily, 4 weekly, 2 monthly | AES-256 | Primary: On-site Hypervisor; DR: Cloud/Off-site VM Store |

| File Servers | Full (Weekly), Incremental (Daily) | Daily | 30 daily, 12 monthly | AES-256 | Primary: On-site NAS; DR: Cloud Sync |

| User Workstations | Full (Monthly), Incremental (Daily) | Daily | 30 daily | AES-256 | Cloud Backup Service |

| [Add other data types] | | | | | |

6.3. Backup Storage

  • On-site Storage: Used for immediate recovery of recent data, typically for Tier 2/3 systems.
  • Off-site Storage: All critical backups are replicated or moved to a secure off-site location at least [e.g., 50 miles away] to protect against site-wide disasters. This includes:

* Cloud Storage: [e.g., AWS S3, Azure Blob Storage, Google Cloud Storage] with appropriate redundancy and regional separation.

* Physical Media: Encrypted tapes or external drives transported to a secure, climate-controlled off-site facility (if applicable for long-term archives).

  • Geo-Redundancy: For Tier 0/1 systems, data is replicated across multiple geographically distinct data centers or cloud regions.

6.4. Data Restoration Procedures

Detailed restoration runbooks are maintained for each critical system in Appendix D. General steps include:

  1. Identify the required backup set and restoration point (based on RPO).
  2. Retrieve backup from primary or secondary storage location.
  3. Verify integrity of the backup data.
  4. Restore data to the designated recovery environment (DR site, new hardware, etc.).
  5. Perform post-restoration checks and validate data consistency.
  6. Ensure security configurations are applied to restored data.

7. Failover and Recovery Procedures

This section outlines the step-by-step process for declaring a disaster, activating the DR plan, and recovering critical systems.

7.1. Disaster Declaration Criteria

A disaster is declared when a critical event renders primary systems or facilities unavailable, and normal operations cannot be restored within an acceptable timeframe (exceeding RTOs).

  • Examples: Major power outage, natural disaster (fire, flood, earthquake), cyberattack (ransomware, major data breach), significant hardware failure affecting core infrastructure.
  • Declaration Authority: The DR Coordinator, in consultation with the IT Recovery Lead and senior management.

7.2. Incident Detection and Assessment

  1. Detection: Monitoring systems (e.g., network, server, application performance monitoring) trigger alerts.
  2. Initial Assessment: IT Operations team evaluates the incident severity, scope, and potential impact on RTO/RPO targets.
  3. Escalation: If the incident is deemed a disaster, the DR Coordinator is notified immediately.

7.3. Disaster Recovery Plan Activation

  1. DR Team Notification: DR Coordinator activates the DR team via emergency contact tree (Appendix A), email, and SMS.
  2. Relocation (if necessary): DR team members relocate to the designated command center or alternate work location.
  3. DR Site Activation: Begin activation of the designated disaster recovery site ([e.g., Cloud region, Co-location facility, Warm Site]).
  4. Communication: Initial internal and external communications are issued (see Section 8).

7.4. Step-by-Step Recovery Procedures (General)

Detailed runbooks for each critical system are maintained in Appendix D: System-Specific Recovery Runbooks. The general sequence is:

  1. Network Infrastructure Recovery:

* Activate DR network components (firewalls, routers, switches) at the recovery site.

* Establish VPN tunnels or direct links to primary site if partially available.

* Update DNS records to point to DR site IP addresses (if applicable).

* Verify external and internal connectivity.

  1. Base Infrastructure (Virtualization/Compute) Recovery:

* Provision/activate compute resources (VMs, containers) at the DR site.

* Restore base operating system images or configurations.

* Apply necessary security patches and hardening.

  1. Database Recovery:

* Restore the most recent valid database backups to DR database servers.

* Apply transaction logs to achieve the targeted RPO.

* Perform database integrity checks.

* Configure database replication for ongoing operations.

  1. Application Recovery:
gemini Output

Disaster Recovery Plan

Document Version: 1.0

Date: October 26, 2023

Prepared For: [Customer Name/Organization]

Prepared By: PantheraHive


1. Executive Summary

This document outlines a comprehensive Disaster Recovery Plan (DRP) designed to ensure the continuity of critical business operations and minimize the impact of unforeseen catastrophic events on [Customer Name/Organization]'s IT infrastructure and data. It establishes clear objectives, defines recovery targets (RTO/RPO), details backup strategies, outlines failover procedures, provides a communication framework, and mandates a rigorous testing schedule. The successful implementation and regular maintenance of this DRP are paramount to safeguarding business resilience and maintaining stakeholder trust.

2. Introduction

A Disaster Recovery Plan (DRP) is a documented, structured approach with instructions for responding to unplanned incidents that threaten an organization's IT infrastructure and operations. The primary goal of this DRP is to enable [Customer Name/Organization] to recover critical systems and data within acceptable timeframes, thereby minimizing downtime, data loss, and financial repercussions. This plan addresses potential disruptions ranging from natural disasters and cyberattacks to major system failures and human error.

3. Disaster Recovery Plan Objectives

The core objectives of this Disaster Recovery Plan are to:

  • Minimize Downtime: Reduce the duration of service interruptions to critical systems and applications.
  • Prevent Data Loss: Safeguard critical data and information assets from corruption or loss.
  • Ensure Business Continuity: Facilitate the rapid restoration of essential business functions.
  • Protect Assets: Secure IT infrastructure, facilities, and personnel.
  • Maintain Compliance: Adhere to regulatory and industry standards for data protection and business resilience.
  • Facilitate Informed Decision-Making: Provide a clear framework for response and recovery during a disaster.
  • Safeguard Reputation: Preserve stakeholder confidence and the organization's public image.

4. Key Definitions and Recovery Targets (RTO/RPO)

Understanding and setting clear Recovery Time Objectives (RTO) and Recovery Point Objectives (RPO) is fundamental to an effective DRP. These targets define the acceptable limits for downtime and data loss for various systems.

  • Recovery Time Objective (RTO): The maximum acceptable duration of time that a critical application or service can be unavailable after a disaster without causing unacceptable consequences for the business. It answers: "How quickly must we recover?"
  • Recovery Point Objective (RPO): The maximum tolerable amount of data loss measured in time (e.g., 1 hour, 4 hours, 24 hours) that can occur before the business experiences significant harm. It answers: "How much data can we afford to lose?"

Example RTO/RPO Targets (To be customized by [Customer Name/Organization]):

| System Criticality Level | Description | Example Systems | Target RTO | Target RPO |

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

| Mission-Critical | Absolutely essential for core business operations. | E-commerce platforms, core financial systems, primary databases | 0 - 4 hours | 0 - 1 hour |

| Business-Critical | Important for daily operations; can tolerate limited downtime. | ERP systems, CRM, email servers, internal communication platforms | 4 - 24 hours | 1 - 4 hours |

| Business-Supportive | Necessary but can tolerate extended downtime. | Development environments, non-essential internal applications, file shares | 24 - 48 hours | 4 - 24 hours |

| Non-Critical | Minimal impact if unavailable for extended periods. | Test environments, archival systems, some intranet sites | 48+ hours | 24+ hours |

Action: [Customer Name/Organization] must conduct a Business Impact Analysis (BIA) to accurately classify all systems and define precise RTO/RPO targets.

5. Disaster Scenario Planning

This plan considers a range of potential disaster scenarios, including but not limited to:

  • Natural Disasters: Fires, floods, earthquakes, severe storms.
  • Cyber Attacks: Ransomware, data breaches, denial-of-service (DoS) attacks.
  • Infrastructure Failures: Power outages, network failures, hardware malfunctions.
  • Human Error: Accidental data deletion, misconfigurations.
  • Malicious Acts: Sabotage, theft.
  • Pandemics/Public Health Crises: Affecting workforce availability.

6. Backup and Data Recovery Strategies

A robust backup strategy is the cornerstone of any effective DRP. This section outlines the approach to data protection and recovery.

6.1. Backup Types and Frequency

  • Full Backups: A complete copy of all selected data.

* Frequency: Weekly (e.g., every Sunday).

  • Incremental Backups: Copies only the data that has changed since the last full or incremental backup.

* Frequency: Daily (Monday-Saturday).

  • Differential Backups: Copies all data that has changed since the last full backup.

Frequency: Daily (Monday-Saturday) - Alternative to Incremental, depending on strategy.*

  • Real-time Replication / Continuous Data Protection (CDP): For mission-critical databases and applications requiring near-zero RPO.

* Frequency: Continuous.

6.2. Backup Storage Locations and Retention Policies

  • On-site Storage: Short-term retention for quick recovery of minor incidents.

* Retention: 7 days (daily backups).

  • Off-site Storage: For disaster recovery in case of site-wide disaster. Encrypted and geographically separated.

* Method: Encrypted cloud storage (e.g., AWS S3, Azure Blob Storage, Google Cloud Storage) or secure off-site tape/disk vaulting.

* Retention:

* Daily backups: 30 days

* Weekly full backups: 90 days

* Monthly full backups: 1 year

* Yearly full backups: 7 years (or as required by compliance)

  • Immutability: Implement immutable backups where supported by storage providers to protect against ransomware and accidental deletion.

6.3. Data Encryption

  • All data, whether at rest (in backup storage) or in transit (during backup transfer), must be encrypted using industry-standard encryption protocols (e.g., AES-256).

6.4. Backup Verification and Testing

  • Regular Verification: Periodically perform test restores of random files and databases to ensure backup integrity and recoverability.

* Frequency: Monthly.

  • Validation: Document successful verification tests.

7. Failover and System Recovery Procedures

This section details the steps to transition operations to a secondary (Disaster Recovery) site or environment and subsequently recover primary systems.

7.1. Disaster Declaration and Activation Criteria

A disaster is declared when:

  • Primary data center/office is inaccessible or compromised.
  • Critical systems are down and cannot be restored within RTO.
  • Significant data loss or corruption.
  • Threat to personnel safety.

Upon declaration, the DR Coordinator initiates the DR plan and assembles the DR Team.

7.2. Disaster Recovery Team Roles and Responsibilities

| Role | Responsibilities |

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

| DR Coordinator | Overall command, decision-making, communication with senior management, external parties. |

| IT Infrastructure Lead| Manages server, storage, network recovery; coordinates with vendors. |

| Application Lead | Manages application recovery, configuration, testing; coordinates with business units. |

| Network Lead | Restores network connectivity, DNS, VPNs, firewall rules at DR site. |

| Database Administrator| Recovers and synchronizes databases, ensures data integrity. |

| Communications Lead | Manages internal and external communications as per the communication plan. |

| Business Unit Liaisons| Provide business context, validate recovered applications, manage user acceptance testing. |

7.3. High-Level Failover Process

  1. Assess and Declare: DR Coordinator assesses the incident, declares a disaster, and activates the DR plan.
  2. Isolate Primary Site (if compromised): Disconnect affected systems from the network to prevent further damage or spread (e.g., malware).
  3. Activate DR Site/Environment:

* Bring up core infrastructure services (network, domain controllers, DNS) at the DR site.

* Provision or activate virtual machines/containers from templates or replicated images.

  1. Restore/Replicate Data:

* For systems with replication, verify synchronization and initiate failover.

* For systems relying on backups, restore the latest viable backups to the DR environment.

  1. Application Recovery:

* Install and configure applications on recovered infrastructure.

* Restore application-specific data.

* Perform smoke tests and initial functionality checks.

  1. Network Redirection: Update DNS records, load balancer configurations, and VPNs to direct user traffic to the DR site.
  2. User Acceptance Testing (UAT): Business users validate critical application functionality and data integrity.
  3. Go-Live: Announce successful failover and resume operations from the DR site.

7.4. Specific System Recovery Steps (Examples)

  • Database Recovery:

1. Ensure DR database instances are running.

2. Restore the latest RPO-compliant backup (or failover replication).

3. Apply transaction logs to minimize data loss.

4. Verify database integrity and consistency.

  • Application Server Recovery:

1. Deploy VM images or install OS on DR servers.

2. Install application prerequisites and software.

3. Configure application settings and connect to recovered databases.

4. Perform application health checks.

  • Network Recovery:

1. Verify DR site network connectivity (internet, VPNs).

2. Configure routing and firewall rules.

3. Update DNS to point to DR site IPs.

  • Virtualization/Cloud Infrastructure:

1. Utilize cloud provider DR services (e.g., AWS CloudEndure, Azure Site Recovery) to orchestrate VM/instance failover.

2. Verify resource provisioning and network configurations.

7.5. Failback Procedures (Restoration to Primary Site)

Once the primary site is restored and deemed stable:

  1. Synchronize Data: Replicate data changes from the DR site back to the primary site. This is a critical step to ensure no data loss during failback.
  2. Verify Primary Site Readiness: Conduct comprehensive testing of all systems and applications at the primary site.
  3. Schedule Failback: Plan a controlled switch-back during a low-impact window.
  4. Execute Failback: Redirect traffic back to the primary site (DNS updates, load balancer changes).
  5. Decommission DR Resources: Power down or de-provision DR resources to minimize costs.
  6. Post-Failback Review: Conduct a thorough review of the entire recovery process.

8. Communication Plan

Effective communication is crucial during a disaster to manage expectations, provide updates, and coordinate efforts among stakeholders.

8.1. Stakeholder Identification

  • Internal: Executive Leadership, DR Team, IT Staff, Department Heads, All Employees.
  • External: Customers, Vendors/Suppliers, Business Partners, Regulatory Bodies, Media/Public Relations.

8.2. Communication Channels

  • Internal: Dedicated conference bridge, emergency notification system (SMS/email), internal chat platforms, status dashboard.
  • External: Public status page (pre-established URL), email, official press releases, social media (managed by PR).

8.3. Communication Templates

Pre-approved communication templates for various stages of a disaster:

  • Initial Notification: "Incident Detected - Investigating."
  • Status Update: "Recovery in Progress - Estimated Time to Restore."
  • Resolution/Recovery Complete: "Services Restored - Monitoring."
  • Post-Mortem/Lessons Learned: Detailed report after full recovery.

8.4. Communication Escalation Matrix

|

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