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

This document provides two distinct, comprehensive deliverables: a Disaster Recovery Plan (DRP) and a Marketing Strategy. Each section is designed to be detailed, actionable, and professionally structured for immediate use.


1. Disaster Recovery Plan (DRP)

1.1 Introduction and Purpose

This Disaster Recovery Plan (DRP) outlines the procedures and strategies necessary to ensure the swift and effective recovery of critical IT systems, data, and business operations in the event of a disruptive incident. The primary goal is to minimize downtime, prevent significant data loss, and maintain business continuity, thereby protecting our assets, reputation, and customer trust. This plan is a living document, subject to regular review and updates.

1.2 Scope

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

  • Primary Data Center infrastructure (servers, storage, networking)
  • Cloud-based services and applications (SaaS, IaaS, PaaS)
  • Key business applications (e.g., CRM, ERP, financial systems, custom applications)
  • Critical data repositories (databases, file shares, document management systems)
  • Communication systems (email, VoIP, internal chat)
  • Remote access and VPN infrastructure
  • End-user computing devices (laptops, desktops) where critical data resides

Exclusions: This plan focuses on IT and data recovery. While it integrates with overall Business Continuity Planning (BCP), detailed non-IT operational recovery (e.g., physical facility restoration, supply chain disruption) is addressed in the broader BCP document.

1.3 Key Personnel and Roles

A dedicated Disaster Recovery Team (DRT) is established with clear roles and responsibilities.

  • DR Coordinator/Lead: Overall accountability for DRP activation, execution, and communication.
  • Infrastructure Lead: Responsible for server, network, and storage recovery.
  • Application Lead: Responsible for application-specific recovery and configuration.
  • Data Lead: Responsible for data restoration, integrity, and synchronization.
  • Communications Lead: Manages internal and external communications during and after an event.
  • Security Lead: Ensures security protocols are maintained throughout recovery.
  • Business Unit Representatives: Liaise with specific departments regarding business impact and testing.

Contact Information: (To be maintained in an accessible, off-site location, e.g., cloud-based emergency contact list, physical printouts)

1.4 Recovery Time Objectives (RTO) and Recovery Point Objectives (RPO)

RTO and RPO targets are defined based on Business Impact Analysis (BIA) to prioritize recovery efforts. These targets represent the maximum tolerable downtime (RTO) and maximum tolerable data loss (RPO) for critical systems.

| System/Application Category | Example Systems | RTO (Time to Recover) | RPO (Max Data Loss) | Recovery Tier |

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

| Tier 1: Mission-Critical | ERP, CRM, Core Databases, E-commerce Platform | 2-4 hours | 0-1 hour | Hot Standby/Active-Active |

| Tier 2: Business-Critical | Email, VoIP, Financial Reporting, HRIS | 4-8 hours | 1-4 hours | Warm Standby/Frequent Backups |

| Tier 3: Business-Important | Internal File Shares, Development Servers, Intranet | 12-24 hours | 4-24 hours | Cold Standby/Daily Backups |

| Tier 4: Non-Critical | Test Environments, Archival Systems | >24 hours | >24 hours | Standard Backups |

1.5 Backup and Data Recovery Strategies

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

  • Backup Types:

* Full Backups: Weekly, capturing all selected data.

* Incremental Backups: Daily, capturing only data changed since the last backup (full or incremental).

* Differential Backups: Daily, capturing data changed since the last full backup.

* Database Transaction Logs: Continuously backed up for critical databases to achieve near-zero RPO.

  • Backup Frequency and Retention:

* Tier 1 Data: Hourly snapshots/replication, 7-day retention, daily full backup for 30 days, monthly for 1 year, yearly for 7 years.

* Tier 2 Data: Daily incremental, weekly full. 30-day retention, monthly for 6 months, yearly for 3 years.

* Tier 3/4 Data: Daily full. 14-day retention, monthly for 3 months.

  • Storage Locations:

* On-site: Short-term recovery, fast access (e.g., NAS, SAN snapshots).

* Off-site (Physical): Secure, air-gapped storage for critical long-term archives (e.g., tape rotation).

* Cloud (Primary DR Site): Replicated to a geographically distinct cloud region or a dedicated DR cloud provider (e.g., AWS, Azure, Google Cloud). This is the primary DR target for most systems.

  • Data Encryption: All data at rest and in transit (for backups) is encrypted using AES-256 encryption. Encryption keys are securely managed and stored separately.
  • Backup Verification: Regular verification (monthly) of backup integrity, including test restores to ensure data recoverability.
  • Data Archiving: Long-term archival strategy for regulatory compliance and historical data, using cost-effective cloud storage tiers (e.g., Glacier, Archive Storage).

1.6 Failover and System Restoration Procedures

Detailed, step-by-step procedures for activating the DR site and restoring operations.

1.6.1 Activation Criteria & Declaration

  • Criteria: Prolonged outage of critical systems, primary data center unavailability, major data corruption, or regional disaster impacting primary site.
  • Declaration: DR Coordinator, in consultation with senior management, declares a disaster and initiates the DRP.

1.6.2 Failover Process (General Steps)

  1. Initiate DR Team Notification: Activate DR communication plan.
  2. Assess Damage and Confirm Scope: Verify primary site status and impact.
  3. Activate DR Site/Cloud Environment:

* Initiate automated failover scripts or manual provisioning of DR resources (VMs, networks) in the cloud DR region/site.

* Restore network connectivity and VPNs to the DR environment.

  1. Restore Critical Data:

* Prioritize data restoration based on RPO and system dependencies.

* Restore databases from latest available backups/replication.

* Restore file shares and critical application data.

  1. Restore Critical Applications:

* Install/configure applications on restored infrastructure in the DR environment.

* Perform configuration checks and dependency validation.

* Integrate with restored databases.

  1. Perform System and Application Testing:

* Execute predefined test cases to validate functionality and data integrity.

* Involve business users for User Acceptance Testing (UAT) for critical applications.

  1. Switch User Traffic:

* Update DNS records to point to DR site IP addresses/URLs.

* Reconfigure load balancers to direct traffic to the DR environment.

* Notify users of the switch and provide access instructions.

  1. Monitor Performance and Stability: Continuously monitor systems in the DR environment.

1.6.3 Specific Failover Procedures (Examples)

  • Database Failover (e.g., SQL Server AlwaysOn/PostgreSQL Streaming Replication):

1. Verify primary database is down/inaccessible.

2. Initiate manual failover to the designated secondary replica in the DR site.

3. Confirm replication status and data synchronization.

4. Update application connection strings to point to the new primary.

  • Virtual Machine Failover (e.g., VMware Site Recovery Manager/Azure Site Recovery):

1. Execute predefined recovery plan within the DR orchestration tool.

2. Monitor VM boot-up and IP address assignment in the DR environment.

3. Verify network connectivity and application services on recovered VMs.

  • Cloud Application Failover:

1. If using active-passive, activate the passive environment in the DR region.

2. Update DNS (e.g., Route 53, Azure DNS) to redirect traffic.

3. If using active-active, verify load balancer health checks are directing traffic away from the failed primary region.

1.6.4 Rollback and Reversion Procedures

  • Once the primary site is fully restored and validated, a controlled reversion process will be executed.
  • This typically involves synchronizing data from the DR site back to the primary site (reverse replication), followed by a planned failback of services.
  • A "failback window" will be communicated, and necessary precautions (e.g., application freeze) will be taken to ensure data consistency.

1.7 Communication Plan

Effective communication is crucial during a disaster.

1.7.1 Internal Communication

  • DR Team: Dedicated chat channel (e.g., Slack, Teams), conference bridge, emergency SMS/call tree. Daily stand-ups.
  • Employees:

* Initial Notification: Email, SMS, Intranet banner, dedicated status page link.

* Updates: Regular updates via email, status page, and team leads.

* Instructions: Guidance on remote work, access to DR systems, expected service availability.

  • Management/Stakeholders: Executive briefings, regular status reports from DR Coordinator.

1.7.2 External Communication

  • Customers:

* Initial Notification: Public status page (e.g., Atlassian Statuspage), social media, email (for critical service outages).

* Updates: Regular updates via status page and social media.

* Support Channels: Clearly communicate alternative support channels if primary ones are affected.

  • Partners/Vendors: Direct email or phone calls from procurement/operations.
  • Media: All media inquiries directed to the Communications Lead/PR department. Pre-approved statements will be used.
  • Regulators: Notify relevant regulatory bodies as required by law or industry standards within specified timeframes.

1.7.3 Communication Tools

  • Emergency notification system (e.g., Everbridge, OnSolve)
  • Dedicated status page (cloud-hosted, independent of primary infrastructure)
  • Pre-drafted communication templates for various scenarios

1.8 Testing and Maintenance Schedule

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

  • Types of Tests:

* Tabletop Exercises (Annual): Review DRP with key personnel, discuss scenarios, identify gaps.

* Simulated Failover Tests (Bi-Annually): Isolate a non-production environment or subset of production, perform a full failover to the DR site, and test functionality. No impact on live production.

* Full Failover Tests (Annual): A planned, controlled failover of critical production systems to the DR site, with actual user traffic redirection. Requires careful planning and communication.

* Backup Restoration Tests (Quarterly): Randomly select backups and perform full data restores to verify integrity and recoverability.

  • Testing Schedule:

* Q1: Tabletop Exercise & Backup Restoration Test

* Q2: Simulated Failover Test & Backup Restoration Test

* Q3: Tabletop Exercise & Backup Restoration Test

* Q4: Full Failover Test (Production) & Backup Restoration Test

  • Documentation: All test results, lessons learned, and identified deficiencies are documented.
  • Review and Update Process: The DRP is formally reviewed and updated at least annually, or immediately after any significant infrastructure changes, application deployments, or lessons learned from incidents/tests.

1.9 Training

All DRT members and relevant personnel receive annual training on their roles and responsibilities within the DRP. New hires in critical roles are trained upon onboarding.

1.10 Appendices (Placeholder)

  • Emergency Contact List (External & Internal)
  • Vendor Contact List (Critical Suppliers)
  • Network Diagrams (Primary & DR Site)
  • Application Dependency Maps
  • Pre-approved Communication Templates
  • DR Site Access Procedures

2. Marketing Strategy

2.1 Executive Summary

This marketing strategy outlines a comprehensive approach to enhance brand awareness, generate qualified leads, and drive customer acquisition for [Your Organization Name]'s [Product/Service Name]. By focusing on a clearly defined target audience, leveraging a multi-channel digital approach, and delivering consistent, value-driven messaging, we aim to achieve significant market penetration and sustainable growth within the next 12-18 months. Key performance indicators (KPIs) will be rigorously tracked to ensure continuous optimization and demonstrable return on investment (ROI).

2.2 Business Objectives & Marketing Goals

Business Objectives:

  • Increase market share by 15% in the next 18 months.
  • Achieve a 20% year-over-year revenue growth.
  • Improve customer lifetime value (CLTV) by 10%.

Marketing Goals (Supporting Business Objectives):

  • Brand Awareness: Increase brand recognition and recall by 25% within 12 months.
  • Lead Generation: Generate 500 qualified leads per quarter.
  • **Customer Acquisition
gemini Output

Disaster Recovery Plan

Document Version: 1.0

Date: October 26, 2023

Prepared By: [Your Company Name/Department]

Approved By: [Approving Authority Name/Title]

Status: DRAFT


1. Introduction

This Disaster Recovery Plan (DRP) outlines the procedures and strategies for restoring critical business functions and IT systems in the event of a disruptive incident or disaster. The primary goal is to minimize downtime, data loss, and operational impact, ensuring business continuity and the timely recovery of essential services.

1.1. Purpose

The purpose of this DRP is to:

  • Provide a structured framework for responding to various disaster scenarios.
  • Define roles, responsibilities, and communication protocols during a disaster.
  • Establish clear Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs) for critical systems.
  • Detail strategies for data backup, system recovery, and failover.
  • Outline procedures for regular testing, review, and maintenance of the plan.

1.2. Scope

This DRP covers all critical IT infrastructure, applications, data, and associated business processes essential for the [Your Company Name] operations. It applies to all personnel involved in IT operations, business units, and management during a declared disaster event.

1.3. Assumptions

  • Key personnel are available and contactable during a disaster.
  • Recovery site infrastructure (if applicable) is provisioned and ready for activation.
  • Backup data is available, uncorrupted, and restorable.
  • Necessary hardware, software licenses, and third-party support are accessible.
  • The disaster event is localized or has a defined impact, allowing for recovery efforts.

2. Disaster Recovery Team

The Disaster Recovery Team is responsible for executing this plan. Each member has specific roles and responsibilities during a disaster declaration.

2.1. Team Structure and Responsibilities

| Role | Primary Responsibility

gemini Output

Disaster Recovery Plan for [Your Organization Name]

Document Version: 1.0

Date: October 26, 2023

Prepared By: [Your Name/Department]


1. Executive Summary

This Disaster Recovery Plan (DRP) outlines the strategies, procedures, and resources required to restore [Your Organization Name]'s critical IT systems and data in the event of a disaster. The primary objective is to minimize downtime, prevent data loss, and ensure the rapid resumption of essential business operations, thereby protecting the organization's assets, reputation, and ability to serve its customers. This plan defines clear Recovery Time Objectives (RTOs) and Recovery Point Objectives (RPOs) for key systems, details backup and recovery strategies, outlines failover and failback procedures, establishes a robust communication framework, and mandates a regular testing and maintenance schedule.

2. Introduction and Purpose

The purpose of this Disaster Recovery Plan is to provide a structured, actionable framework for responding to unforeseen events that could disrupt [Your Organization Name]'s information technology infrastructure and services. Such events may include natural disasters, cyber-attacks, major equipment failures, or human errors.

Key Objectives:

  • Minimize Downtime: Restore critical systems and services within predefined RTOs.
  • Prevent Data Loss: Ensure data integrity and recoverability within predefined RPOs.
  • Ensure Business Continuity: Facilitate the rapid resumption of business-critical functions.
  • Protect Assets: Safeguard IT infrastructure, data, and intellectual property.
  • Maintain Compliance: Adhere to regulatory and industry standards for data protection and business resilience.
  • Provide Clear Guidance: Equip the DR team with a clear, step-by-step guide for disaster response and recovery.

3. Scope

This DRP covers all IT infrastructure, applications, and data deemed critical for the continued operation of [Your Organization Name].

In-Scope Systems & Services:

  • Primary Data Center infrastructure (servers, storage, networking)
  • Key business applications (e.g., ERP, CRM, E-commerce platform, Financial Systems)
  • Core network services (e.g., DNS, DHCP, Active Directory)
  • Communication systems (e.g., Email, VoIP)
  • Database systems
  • Virtualization platforms
  • Cloud-based services integrated with on-premise infrastructure
  • End-user computing environments (as they relate to critical business functions)

Out-of-Scope Systems & Services:

  • Non-production environments (e.g., development, staging, test environments) unless directly impacting critical production systems.
  • Non-essential internal applications or services that do not directly contribute to core business functions.

4. Key Definitions

  • Disaster Recovery (DR): The process of restoring data, hardware, and software following a disaster.
  • Business Continuity Plan (BCP): A comprehensive plan for continuing business operations before, during, and after a disaster. The DRP is a component of the BCP.
  • Recovery Time Objective (RTO): The maximum tolerable duration of time a system or application can be down after a disaster before unacceptable consequences occur.
  • Recovery Point Objective (RPO): The maximum tolerable amount of data that can be lost from an IT service due to a major incident. It represents the point in time to which systems and data must be recovered.
  • Failover: The process of switching over to a redundant or standby system upon the failure or abnormal termination of the previously active system.
  • Failback: The process of restoring operations to the primary data center after a disaster has been resolved and operations have been running from the disaster recovery site.
  • Critical System: An IT system or service whose unavailability would cause significant business impact, financial loss, or regulatory non-compliance.
  • Disaster Recovery Site: A secondary location equipped with the necessary infrastructure to host critical systems and data during a disaster.

5. Critical Systems and Services

The following table identifies [Your Organization Name]'s critical systems, their business owners, and their assigned criticality tiers, which directly correlate to RTO and RPO targets.

| System/Service Name | Business Owner/Department | Criticality Tier | Description |

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

| ERP System | Finance, Operations | Tier 0 | Core enterprise resource planning, financial management. |

| CRM System | Sales, Marketing | Tier 1 | Customer relationship management, sales pipeline. |

| E-commerce Platform | Sales, Marketing | Tier 0 | Online storefront, order processing. |

| Primary Database Server| IT Operations | Tier 0 | Hosts critical application databases. |

| Email Services | All Departments | Tier 1 | Internal and external communication. |

| Active Directory | IT Operations | Tier 1 | User authentication, network services. |

| File Servers (Shared) | All Departments | Tier 2 | Centralized document storage. |

| VoIP System | Operations | Tier 2 | Internal and external voice communication. |

| Website (Public) | Marketing | Tier 1 | Public-facing information, branding. |

| HRIS System | Human Resources | Tier 2 | Human resource information system. |

6. Recovery Objectives (RTO/RPO)

Recovery objectives are defined based on the criticality of each system, determined through a Business Impact Analysis (BIA). These targets guide the selection of backup strategies and recovery procedures.

| Criticality Tier | Description | Recovery Time Objective (RTO) | Recovery Point Objective (RPO) |

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

| Tier 0 | Mission Critical | < 1 Hour | < 15 Minutes |

| Tier 1 | Business Critical | 1 - 4 Hours | < 1 Hour |

| Tier 2 | Important | 4 - 24 Hours | < 4 Hours |

| Tier 3 | Non-Critical / Standard| 24 - 72 Hours | < 24 Hours |

Note: Specific RTO/RPO targets for each system are detailed in the "System Recovery Matrix" (Appendix A).

7. Backup Strategy

A multi-layered backup strategy is employed to ensure data integrity, availability, and recoverability across different scenarios.

7.1. Data Types Covered:

  • Application Data (Databases, Configuration Files)
  • Operating System Images and Configurations
  • Virtual Machine Snapshots/Images
  • User Files and Shared Drives
  • Network Device Configurations

7.2. Backup Methods & Frequency:

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

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

| Tier 0 Systems| Continuous Data Protection (CDP) / Near-CDP via replication | Real-time / Every 15 mins | 7 days (hourly), 4 weeks (daily), 12 months (monthly) | Primary DC, DR Site (synchronous/asynchronous replication) |

| Tier 1 Systems| Incremental/Differential with periodic Fulls | Daily (Incremental/Diff), Weekly (Full) | 7 days (daily), 4 weeks (weekly), 12 months (monthly) | Primary DC (local disk), Off-site Cloud Storage (encrypted) |

| Tier 2 Systems| Incremental/Differential with periodic Fulls | Daily (Incremental/Diff), Monthly (Full) | 30 days (daily), 6 months (monthly) | Primary DC (local disk), Off-site Cloud Storage (encrypted) |

| Tier 3 Systems| Full Backups | Weekly | 30 days | Primary DC (local disk), Off-site Cloud Storage (encrypted) |

7.3. Backup Storage & Security:

  • On-site Storage: Used for immediate recovery, located in the primary data center.
  • Off-site Storage: All critical backups are replicated or transferred to a geographically separate cloud storage provider ([Cloud Provider Name]) for disaster resilience.
  • Encryption: All data at rest in backup repositories and in transit to off-site locations is encrypted using AES-256 or higher.
  • Access Control: Access to backup systems and repositories is strictly controlled via Role-Based Access Control (RBAC) and Multi-Factor Authentication (MFA).
  • Backup Verification: Regular automated and manual checks are performed to verify the integrity and restorability of backups. This includes periodic test restores of critical data.

8. Recovery Sites & Infrastructure

[Your Organization Name] maintains a dedicated disaster recovery site to ensure business continuity.

8.1. Primary Data Center:

  • Location: [Primary Data Center Address/Location, e.g., 123 Main St, Anytown, USA]
  • Infrastructure: Enterprise-grade servers, storage area networks (SAN), high-speed networking, redundant power, cooling, and security systems.

8.2. Disaster Recovery Site:

  • Location: [DR Site Address/Location, e.g., 456 Recovery Blvd, Othertown, USA]
  • Type: Warm Site - This site has essential hardware and networking infrastructure in place, with some critical data replicated or backed up regularly. It requires some configuration and data restoration efforts to become fully operational.
  • Infrastructure:

* Hardware: Virtualization hosts, storage, and networking equipment mirroring the primary environment's capacity for critical systems.

* Network: Dedicated VPN tunnels and/or private network links to the primary data center and cloud resources. Redundant internet connectivity.

* Software: Core operating systems, hypervisors, and essential management tools pre-installed.

* Replication: Continuous (for Tier 0) or near-continuous (for Tier 1) replication of critical data and virtual machines from the primary data center.

9. Failover Procedures

These procedures describe the steps to activate the DR site and restore services during a disaster.

9.1. Disaster Declaration & Initial Assessment:

  1. Incident Detection: Monitoring systems, user reports, or external notifications indicate a major incident affecting the primary data center.
  2. DR Team Notification: The DR Coordinator (or designated alternate) is notified immediately.
  3. Impact Assessment: The DR Team assesses the scope and severity of the incident to determine if a disaster declaration is warranted based on predefined criteria (e.g., prolonged outage of Tier 0 systems, physical destruction of primary DC).
  4. Disaster Declaration: The DR Coordinator, in consultation with senior management, formally declares a disaster and activates the DRP.

9.2. DR Site Activation & System Recovery (General Steps):

  1. Establish Communications: Activate emergency communication channels (refer to Section 11).
  2. Activate DR Site Network: Bring up core network services (DNS, DHCP) at the DR site.
  3. Power On/Verify DR Infrastructure: Ensure all DR site hardware (servers,
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);}});}