API Documentation Generator
Run ID: 69c94ab3fee1f7eb4a81028b2026-03-29Development
PantheraHive BOS
BOS Dashboard

PantheraHive Product Catalog API Documentation

Seamlessly Integrate and Manage Your Product Data

Welcome to the comprehensive documentation for the PantheraHive Product Catalog API! This API provides a robust and flexible interface for managing your product data, allowing you to seamlessly integrate product listings, details, and inventory into your applications. Whether you're building an e-commerce platform, an inventory management system, or a data analytics tool, our API empowers you to interact with your product catalog efficiently and securely.

This document serves as your definitive guide to understanding the API's capabilities, authentication methods, available endpoints, and best practices for integration.


Table of Contents

  1. [Introduction](#introduction)
  2. [Getting Started](#getting-started)
  3. [Authentication](#authentication)
  4. [Endpoints](#endpoints)

* [Products](#products)

* [Retrieve a Specific Product](#retrieve-a-specific-product)

* [Create a New Product](#create-a-new-product)

* [Update an Existing Product](#update-an-existing-product)

* [Delete a Product](#delete-a-product)

  1. [Data Models](#data-models)
  2. [Error Handling](#error-handling)
  3. [Rate Limiting](#rate-limiting)
  4. [SDK Usage Examples](#sdk-usage-examples)
  5. [Support & Feedback](#support--feedback)
  6. [Start Building Today!](#start-building-today)

1. Introduction

The PantheraHive Product Catalog API is designed to provide programmatic access to your product inventory. It allows you to:

Our API is built on REST principles, uses standard HTTP methods, and returns JSON-encoded responses, making it easy to consume from any programming language or environment.

2. Getting Started

To begin integrating with the PantheraHive Product Catalog API, you'll need two key pieces of information:

https://api.pantherahive.com/v1

3. Authentication

All requests to the PantheraHive Product Catalog API must be authenticated using an API Key. This key ensures that your requests are authorized and secure.

Obtaining Your API Key

  1. Log in to your PantheraHive developer dashboard.
  2. Navigate to the "API Keys" section.
  3. Generate a new API Key if you don't already have one.
  4. Keep your API Key secure and do not share it publicly.

Using Your API Key

Your API Key must be included in the Authorization header of every request, using the Bearer token scheme.

Header Example:

text • 1,180 chars
### 4. Endpoints

This section details all available endpoints, their methods, parameters, and example requests/responses.

---

#### Products

**GET `/products`**

Retrieves a list of products from your catalog. Supports filtering, pagination, and sorting.

*   **Method:** `GET`
*   **URL:** `https://api.pantherahive.com/v1/products`
*   **Description:** Returns an array of product objects.
*   **Query Parameters:**
    *   `limit` (Optional, Integer): Maximum number of products to return. Default is `10`, Max is `100`.
    *   `offset` (Optional, Integer): Number of products to skip for pagination. Default is `0`.
    *   `category` (Optional, String): Filter products by category. E.g., `electronics`.
    *   `min_price` (Optional, Number): Filter products with a price greater than or equal to this value.
    *   `max_price` (Optional, Number): Filter products with a price less than or equal to this value.
    *   `sort_by` (Optional, String): Field to sort by. E.g., `price`, `name`, `created_at`. Default is `created_at`.
    *   `sort_order` (Optional, String): Sort order. `asc` for ascending, `desc` for descending. Default is `desc`.

**Example Request:**

Sandboxed live preview

API Documentation Generator: Step 1 of 4 - Analysis Report (Test Run)

Workflow: API Documentation Generator

Step: collab → analyze

User Input: Test run for api_docs_generator


1. Executive Summary: Initial Analysis for API Documentation Generation

This report details the initial analysis phase for your API Documentation Generator workflow, executed as a "Test Run." The primary objective of this collab → analyze step is to lay the groundwork for effective API documentation generation by understanding requirements, identifying necessary inputs, and outlining best practices.

Given that this is a test run, our analysis focuses on defining the scope, identifying critical data points needed, and providing actionable recommendations for a successful full-scale documentation generation. We've assessed the typical components of professional API documentation and the inputs required to achieve them, ensuring a robust foundation for the subsequent steps of the workflow.


2. Purpose of the collab → analyze Step

The collab → analyze step is crucial for establishing a shared understanding of the API documentation requirements and for preparing the necessary data for generation. Specifically, this step aims to:

  • Define Scope: Clarify which APIs, endpoints, and functionalities need to be documented.
  • Identify Data Requirements: Pinpoint the specific information (e.g., API specifications, authentication methods, use cases) required from the user.
  • Assess Complexity: Understand the structure and interdependencies of the API to inform the documentation approach.
  • Recommend Best Practices: Guide the user on optimal input formats and content for the highest quality output.
  • Plan for Customization: Identify areas where custom descriptions, examples, or SDK usage might be needed beyond automated generation.

3. Initial Assessment & Scope Definition (Based on "Test Run")

Since this is a test run without specific API data, our assessment focuses on the ideal inputs and the expected outputs.

Key Components of Professional API Documentation (Target Output):

  • Endpoint Descriptions: Clear, concise explanations for each API endpoint, including its purpose, method (GET, POST, PUT, DELETE), and URL structure.
  • Request Examples: Detailed examples of request bodies and parameters for various scenarios, often in multiple languages (e.g., cURL, Python, Node.js).
  • Response Examples: Illustrative examples of successful and error responses, including status codes and data structures.
  • Authentication & Authorization Guides: Comprehensive instructions on how to authenticate with the API (e.g., API Keys, OAuth 2.0, JWT), including token acquisition and usage.
  • Error Handling: A complete list of potential error codes, their meanings, and suggested recovery steps.
  • SDK Usage Examples: Code snippets and guides demonstrating how to interact with the API using various Software Development Kits (SDKs), if applicable.
  • Glossary/Concepts: Definitions of key terms and concepts relevant to the API.
  • Rate Limiting & Throttling: Information on usage limits and how to manage them.

Expected Input Requirements for a Real Run:

For a successful, comprehensive documentation generation, the following inputs are typically required:

  • API Specification File:

* Recommended: OpenAPI Specification (OAS/Swagger) in YAML or JSON format. This is the most efficient and accurate input.

* Alternative: Postman Collection export (JSON).

  • Authentication Details:

* Type of authentication (e.g., API Key, OAuth 2.0, Basic Auth, Bearer Token).

* Flows for obtaining tokens/credentials.

* Example credentials (for demonstration purposes, not live keys).

  • Custom Descriptions/Context:

* High-level overview of the API's purpose and key features.

* Specific business logic or use cases that are not evident from the API spec alone.

* Any disclaimers, warnings, or special considerations.

  • SDK Information (if applicable):

* Links to existing SDK repositories.

* Preferred languages for SDK examples (e.g., Python, Java, Node.js, Ruby, Go).

  • Branding/Styling Guidelines:

* Logo, brand colors, specific fonts, or custom CSS for the generated documentation portal.


4. Data Insights (Hypothetical & Requirements-Based)

In a live run, this step would involve analyzing the provided API data. For this test run, we outline the types of insights we would derive:

  • Endpoint Analysis:

* Trend: Identification of common patterns in endpoint naming, versioning, and resource hierarchies.

* Insight: Helps ensure consistency in documentation structure and navigation.

  • Parameter & Schema Validation:

* Trend: Detection of frequently used data types, required vs. optional fields, and potential inconsistencies in data models across endpoints.

* Insight: Ensures accurate representation of request/response bodies and assists in generating precise validation rules.

  • Authentication Method Identification:

* Trend: Recognition of the primary security schemes employed (e.g., apiKey, oauth2, http bearer).

* Insight: Directly informs the structure and content of the authentication guide, ensuring developers can correctly access the API.

  • Error Code Patterns:

* Trend: Grouping of common HTTP status codes (4xx, 5xx) and associated error response structures.

* Insight: Enables the generation of a comprehensive and user-friendly error handling section.

  • SDK Availability & Language Popularity:

* Trend: If SDKs are provided, analysis of their structure and the most common programming languages used by the target developer audience.

* Insight: Guides the generation of relevant and practical SDK usage examples.


5. Trends in API Documentation & Best Practices

Modern API documentation emphasizes clarity, interactivity, and developer experience. Our generator incorporates these trends:

  • OpenAPI Specification (OAS) Adoption: OAS has become the industry standard for describing RESTful APIs, enabling automated generation of documentation, client SDKs, and server stubs. We strongly recommend providing an OAS file for optimal results.
  • Interactive Documentation: Tools like Swagger UI or Redoc provide interactive documentation where developers can try out API calls directly from the browser. Our generated output will support this interactivity.
  • Clear, Actionable Examples: Beyond schema definitions, concrete request and response examples are critical. They help developers quickly understand how to use the API and debug issues.
  • Comprehensive Authentication Guides: Security is paramount. Detailed, step-by-step instructions for authentication are essential for developer onboarding.
  • SDK-First Approach: For many developers, using an SDK is the preferred way to interact with an API. Providing SDK usage examples significantly lowers the barrier to entry.
  • Versioning & Changelogs: Clear documentation on API versions and changes helps developers manage upgrades and deprecations.

6. Recommendations for the Next Steps (Actionable)

To proceed with a full-scale API documentation generation, we recommend the following:

  1. Prioritize OpenAPI Specification (OAS): If available, provide your API's OpenAPI Specification (version 3.x preferred) in YAML or JSON format. This is the most efficient and accurate input for our generator.

Action:* Prepare and provide the openapi.yaml or openapi.json file.

  1. Gather Authentication Details: Clearly outline your API's authentication mechanism(s).

Action:* Document the authentication type (e.g., API Key in header, OAuth 2.0 client credentials flow) and provide example usage steps.

  1. Prepare Custom Descriptions & Context: Supplement the technical specification with human-readable descriptions.

Action:* Provide a high-level API overview, endpoint-specific business context, and any unique use cases in a separate document (e.g., Markdown, Word, or directly input in the next step).

  1. Identify SDK Requirements: Specify which programming languages you'd like SDK usage examples for.

Action:* List preferred languages (e.g., Python, Node.js, Java, Go, PHP, Ruby, C#). If existing SDKs are available, provide links.

  1. Branding & Styling (Optional but Recommended): To align the documentation with your brand.

Action:* Provide your company logo, primary brand colors (hex codes), and any specific font preferences.


7. Potential Challenges & Considerations

  • Incomplete/Outdated API Specifications: If the provided OpenAPI spec is not fully aligned with the live API, manual corrections or updates will be necessary.
  • Ambiguous Descriptions: Lack of clear, human-friendly descriptions can result in technically accurate but difficult-to-understand documentation.
  • Complex Authentication Flows: Non-standard or highly complex authentication mechanisms may require additional manual guidance.
  • Missing SDKs: If no SDKs are provided, generic code examples will be generated, which may not be as idiomatic as dedicated SDK examples.
  • Large API Surface: Very large APIs might require more processing time and careful structuring to ensure navigability.

8. Expected Output of the Workflow

Upon successful completion of all steps, the API Documentation Generator workflow will produce a professional, interactive API documentation portal, typically in HTML format, ready for deployment. This will include:

  • A navigable interface listing all API endpoints.
  • Detailed descriptions for each endpoint, parameters, and response schemas.
  • Interactive "Try It Out" functionality (if supported by the chosen output format).
  • Request and response examples in multiple formats/languages.
  • A dedicated section for authentication and authorization.
  • An error handling guide.
  • SDK usage examples (if specified and feasible).
  • Search functionality for easy navigation.

9. Next Steps

This analysis concludes Step 1. Your input is now required to provide the necessary API data and contextual information.

Next Action: Please prepare and submit the requested inputs (ideally an OpenAPI Specification file, authentication details, and any custom descriptions).

Proceed to Step 2: data_ingestion → process will commence once the required inputs are provided, focusing on ingesting and processing your API data for documentation generation.


Delete a Product

DELETE /products/{id}

Deletes a product from your catalog. This action is irreversible.

*

collab Output

This output is for Step 3 of 4: collab → generate_code for the "API Documentation Generator" workflow.

Step 3: Generate Code - Test Run Acknowledged

You've initiated a "Test run for api_docs_generator". In this crucial generate_code step, we produce the actual scripts and templates that will process your API specification and render the comprehensive documentation.

Since this is a test run and no specific API specification (like an OpenAPI/Swagger JSON or YAML file) was provided in the user input, we will proceed by:

  1. Creating a robust, hypothetical OpenAPI 3.0 YAML specification for a "User Management API." This spec will serve as a realistic example, demonstrating various features like multiple
collab Output

As requested, here is the professional, detailed API documentation generated for your "Test run for api_docs_generator". This comprehensive guide provides everything developers need to integrate with the Acme User API, including endpoint descriptions, request/response examples, authentication details, and SDK usage.


Welcome to the Acme User API Documentation

Empower your applications with seamless user management capabilities using the Acme User API. This documentation provides a comprehensive guide to integrating our robust and secure API, allowing you to create, retrieve, update, and delete user records programmatically.

Whether you're building a new service, extending an existing platform, or automating administrative tasks, the Acme User API offers a flexible and reliable solution for managing your user base.

Key Features:

  • Secure Access: Authenticate effortlessly with API keys.
  • RESTful Design: Intuitive and predictable resource-oriented URLs.
  • Comprehensive Operations: Full CRUD (Create, Read, Update, Delete) functionality for users.
  • Detailed Responses: Clear success and error messages for easy debugging.
  • SDK Support: Simplified integration with client libraries for popular languages.

Let's get started and unlock the power of efficient user management!


Getting Started

This section will guide you through the initial steps to connect to and authenticate with the Acme User API.

Base URL

All requests to the Acme User API should be prefixed with the following base URL:

https://api.acmesolutions.com/v1

Authentication

The Acme User API uses API Key authentication to secure access to its endpoints. You must include your unique API key in the X-API-Key HTTP header for every request.

How to Obtain Your API Key:

  1. Log in to your Acme Solutions Developer Dashboard.
  2. Navigate to the "API Keys" section.
  3. Generate a new API key or use an existing one.
  4. Keep your API key secure and do not expose it in client-side code or public repositories.

Using Your API Key:

Include your API key as an X-API-Key header in all your requests:


GET /v1/users HTTP/1.1
Host: api.acmesolutions.com
X-API-Key: YOUR_ACME_API_KEY_HERE

Example (cURL):


curl -X GET \
  https://api.acmesolutions.com/v1/users \
  -H 'X-API-Key: YOUR_ACME_API_KEY_HERE'

If the API key is missing or invalid, the API will return a 401 Unauthorized error.

Rate Limits

To ensure fair usage and maintain API stability, the Acme User API enforces rate limits.

By default, you are limited to 100 requests per minute per API key.

If you exceed this limit, you will receive a 429 Too Many Requests response.

Please contact support if you require higher rate limits for your application.


API Endpoints

This section details all available endpoints for managing users, including their descriptions, request methods, parameters, and examples.

User Management

1. List All Users

Retrieve a list of all users registered in the system.

  • HTTP Method: GET
  • Path: /users
  • Description: Returns an array of user objects.
  • Query Parameters:

* limit (optional): integer – Maximum number of users to return. Default is 20, maximum is 100.

* offset (optional): integer – Number of users to skip before starting to return results. Default is 0.

Request Example (cURL):


curl -X GET \
  'https://api.acmesolutions.com/v1/users?limit=5&offset=0' \
  -H 'X-API-Key: YOUR_ACME_API_KEY_HERE'

Request Example (Python using requests):


import requests

api_key = "YOUR_ACME_API_KEY_HERE"
base_url = "https://api.acmesolutions.com/v1"

headers = {
    "X-API-Key": api_key,
    "Content-Type": "application/json"
}
params = {
    "limit": 5,
    "offset": 0
}

response = requests.get(f"{base_url}/users", headers=headers, params=params)

if response.status_code == 200:
    print("Users retrieved successfully:")
    print(response.json())
else:
    print(f"Error: {response.status_code} - {response.json()}")

Request Example (Node.js using fetch):


const apiKey = "YOUR_ACME_API_KEY_HERE";
const baseUrl = "https://api.acmesolutions.com/v1";

fetch(`${baseUrl}/users?limit=5&offset=0`, {
  method: 'GET',
  headers: {
    'X-API-Key': apiKey,
    'Content-Type': 'application/json'
  }
})
.then(response => response.json())
.then(data => {
  if (data.error) {
    console.error(`Error: ${data.statusCode} - ${data.message}`);
  } else {
    console.log("Users retrieved successfully:");
    console.log(data);
  }
})
.catch(error => console.error('Error:', error));

Successful Response (200 OK):


{
  "data": [
    {
      "id": "user_abc123",
      "firstName": "Alice",
      "lastName": "Smith",
      "email": "alice.smith@example.com",
      "createdAt": "2023-01-15T10:00:00Z",
      "updatedAt": "2023-01-15T10:00:00Z"
    },
    {
      "id": "user_def456",
      "firstName": "Bob",
      "lastName": "Johnson",
      "email": "bob.johnson@example.com",
      "createdAt": "2023-01-16T11:30:00Z",
      "updatedAt": "2023-01-16T11:30:00Z"
    }
  ],
  "metadata": {
    "total": 2,
    "limit": 5,
    "offset": 0
  }
}

Error Response (401 Unauthorized):


{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Invalid or missing API Key."
}

2. Create a New User

Create a new user record in the system.

  • HTTP Method: POST
  • Path: /users
  • Description: Creates a new user with the provided details and returns the newly created user object.
  • Body Parameters (JSON):

* firstName (required): string – The user's first name.

* lastName (required): string – The user's last name.

* email (required): string – The user's unique email address. Must be a valid email format.

* password (required): string �� The user's password. Must be at least 8 characters long.

Request Example (cURL):


curl -X POST \
  https://api.acmesolutions.com/v1/users \
  -H 'X-API-Key: YOUR_ACME_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
        "firstName": "Charlie",
        "lastName": "Brown",
        "email": "charlie.brown@example.com",
        "password": "SecurePassword123!"
      }'

Request Example (Python using requests):


import requests

api_key = "YOUR_ACME_API_KEY_HERE"
base_url = "https://api.acmesolutions.com/v1"

headers = {
    "X-API-Key": api_key,
    "Content-Type": "application/json"
}
data = {
    "firstName": "Charlie",
    "lastName": "Brown",
    "email": "charlie.brown@example.com",
    "password": "SecurePassword123!"
}

response = requests.post(f"{base_url}/users", headers=headers, json=data)

if response.status_code == 201:
    print("User created successfully:")
    print(response.json())
else:
    print(f"Error: {response.status_code} - {response.json()}")

Request Example (Node.js using fetch):


const apiKey = "YOUR_ACME_API_KEY_HERE";
const baseUrl = "https://api.acmesolutions.com/v1";

const userData = {
  firstName: "Charlie",
  lastName: "Brown",
  email: "charlie.brown@example.com",
  password: "SecurePassword123!"
};

fetch(`${baseUrl}/users`, {
  method: 'POST',
  headers: {
    'X-API-Key': apiKey,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(userData)
})
.then(response => response.json())
.then(data => {
  if (data.error) {
    console.error(`Error: ${data.statusCode} - ${data.message}`);
  } else {
    console.log("User created successfully:");
    console.log(data);
  }
})
.catch(error => console.error('Error:', error));

Successful Response (201 Created):


{
  "id": "user_ghi789",
  "firstName": "Charlie",
  "lastName": "Brown",
  "email": "charlie.brown@example.com",
  "createdAt": "2023-07-20T14:30:00Z",
  "updatedAt": "2023-07-20T14:30:00Z"
}

Error Response (400 Bad Request - e.g., invalid email):


{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "Invalid email format.",
  "details": [
    {
      "field": "email",
      "value": "charlie.brown",
      "issue": "must be a valid email"
    }
  ]
}

3. Retrieve a Specific User

Retrieve details for a single user by their unique ID.

  • HTTP Method: GET
  • Path: /users/{id}
  • Description: Returns a single user object matching the provided ID.
  • Path Parameters:

* id (required): string – The unique identifier of the user (e.g., user_abc123).

Request Example (cURL):


curl -X GET \
  https://api.acmesolutions.com/v1/users/user_abc123 \
  -H 'X-API-Key: YOUR_ACME_API_KEY_HERE'

Request Example (Python using requests):


import requests

api_key = "YOUR_ACME_API_KEY_HERE"
base_url = "https://api.acmesolutions.com/v1"
user_id = "user_abc123"

headers = {
    "X-API-Key": api_key,
    "Content-Type": "application/json"
}

response = requests.get(f"{base_url}/users/{user_id}", headers=headers)

if response.status_code == 200:
    print(
api_documentation_generator.txt
Download source file
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);}});}