Financial Forecast Model
Run ID: 69b6fa0a896970b089464a2c2026-03-29Finance
PantheraHive BOS
BOS Dashboard

Build a financial forecast with revenue projections, expense modeling, cash flow analysis, break-even analysis, and investor-ready financial statements.

Financial Forecast Model: AI Technology (Test Run)

This document presents a comprehensive financial forecast model tailored for a business operating in the AI Technology sector. This "Test Run" provides a structured projection covering revenue, expenses, cash flow, break-even analysis, and investor-ready financial statements over a 3-year horizon. The aim is to offer a foundational understanding of the potential financial trajectory and key performance indicators.


1. Executive Summary

This financial forecast models a hypothetical AI technology company focusing on SaaS-based AI solutions and specialized AI consulting services. The projections indicate strong revenue growth driven by increasing market adoption of AI, coupled with strategic investments in R&D and marketing. While initial years show significant investment requirements, profitability is projected to improve steadily, leading to positive cash flow by Year 2. Key highlights include robust gross margins, a clear path to profitability, and a manageable break-even point. This model serves as a strategic tool for evaluating business viability, fundraising potential, and operational planning within the dynamic AI landscape.


2. Assumptions & Key Drivers (AI Technology Focus)

The following core assumptions underpin this financial forecast:

  • Market Growth: The AI market is projected to grow at a CAGR of 25% over the next three years, driven by digital transformation initiatives and demand for automation.
  • Product/Service Mix:

* AI SaaS Platform: Subscription-based model (e.g., AI-powered analytics, predictive maintenance, natural language processing tools). Accounts for 70% of revenue.

* AI Consulting & Implementation: Project-based services for custom AI solutions and integration. Accounts for 30% of revenue.

  • Pricing Strategy:

* SaaS: Tiered subscription model (Basic, Pro, Enterprise) with average monthly recurring revenue (AMRR) per customer increasing with feature adoption.

* Consulting: Hourly rates for specialists, project-based fees for larger implementations.

  • Customer Acquisition Cost (CAC): Initial higher CAC due to market entry and brand building, expected to decrease with established reputation and referral programs.
  • Churn Rate: Assumed 5% annual churn for SaaS clients, decreasing to 3% by Year 3.
  • Cost of Goods Sold (COGS) / Cost of Services (COS): Primarily cloud infrastructure costs, data acquisition, and direct labor for consulting. Scalable with revenue.
  • Operating Expenses:

* R&D: Significant investment in AI model development, data scientists, and engineers.

* Sales & Marketing: Focus on digital marketing, content creation, and sales team expansion.

* G&A: Administrative staff, legal, accounting, office overhead.

  • Capital Expenditures (CapEx): Minimal initial CapEx (laptops, software licenses); potential for server infrastructure upgrades in later years if on-premise solutions are pursued (not assumed here).
  • Funding: Initial seed/angel funding assumed to cover early operational costs and R&D.
  • Tax Rate: Assumed 25% effective tax rate once profitable.

3. Revenue Projections

Our revenue model is based on a blended approach of SaaS subscriptions and project-based consulting, reflecting typical AI company offerings.

Revenue Projection Summary (Illustrative Annual Figures)

| Metric | Year 1 (Projected) | Year 2 (Projected) | Year 3 (Projected) |

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

| SaaS Revenue | | | |

| Average Customers (SaaS) | 50 | 150 | 350 |

| Average MRR/Customer | $1,500 | $1,700 | $1,850 |

| Annual SaaS Revenue | $900,000 | $3,060,000 | $7,770,000 |

| Consulting Revenue | | | |

| Average Projects/Year | 15 | 35 | 60 |

| Average Project Value | $60,000 | $65,000 | $70,000 |

| Annual Consulting Revenue | $900,000 | $2,275,000 | $4,200,000 |

| Total Revenue | $1,800,000 | $5,335,000 | $11,970,000 |

| Growth Rate | N/A | 196.4% | 124.4% |

Actionable Insight: The substantial growth in Year 2 and 3 highlights the scalability of the SaaS model once customer acquisition efforts gain traction. Focus on reducing churn and upselling higher-tier SaaS packages.


4. Expense Modeling

Expenses are categorized into Cost of Revenue (variable) and Operating Expenses (fixed/semi-fixed).

Expense Projection Summary (Illustrative Annual Figures)

| Expense Category | Year 1 (Projected) | Year 2 (Projected) | Year 3 (Projected) |

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

| Cost of Revenue | | | |

| Cloud Infrastructure & Data | $180,000 | $450,000 | $950,000 |

| Direct Labor (Consulting) | $360,000 | $750,000 | $1,300,000 |

| Total COGS/COS | $540,000 | $1,200,000 | $2,250,000 |

| % of Revenue | 30.0% | 22.5% | 18.8% |

| Operating Expenses | | | |

| Research & Development (R&D) | $750,000 | $1,200,000 | $1,800,000 |

| Sales & Marketing | $400,000 | $800,000 | $1,300,000 |

| General & Administrative | $300,000 | $450,000 | $600,000 |

| Total Operating Expenses | $1,450,000 | $2,450,000 | $3,700,000 |

| Total Expenses | $1,990,000 | $3,650,000 | $5,950,000 |

Actionable Insight: The declining percentage of COGS/COS relative to revenue indicates improving operational efficiency and scalability. Continued investment in R&D is crucial for maintaining a competitive edge in AI technology. Monitor Sales & Marketing ROI closely.


5. Cash Flow Analysis

This section projects the movement of cash, crucial for understanding liquidity and funding needs.

Cash Flow Summary (Illustrative Annual Figures)

| Cash Flow Category | Year 1 (Projected) | Year 2 (Projected) | Year 3 (Projected) |

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

| Cash Flow from Operations (CFO) | | | |

| Net Income (Loss) | -$190,000 | $1,473,750 | $4,515,000 |

| Add back Depreciation/Amort. | $20,000 | $30,000 | $40,000 |

| Changes in Working Capital | -$50,000 | $150,000 | $300,000 |

| Net Cash from Operations | -$220,000 | $1,653,750 | $4,855,000 |

| Cash Flow from Investing (CFI) | | | |

| Purchase of Equipment | -$50,000 | -$75,000 | -$100,000 |

| Net Cash from Investing | -$50,000 | -$75,000 | -$100,000 |

| Cash Flow from Financing (CFF) | | | |

| Equity Issuance (Funding) | $500,000 | $0 | $0 |

| Net Cash from Financing | $500,000 | $0 | $0 |

| Net Increase (Decrease) in Cash | $230,000 | $1,578,750 | $4,755,000 |

| Beginning Cash Balance | $0 | $230,000 | $1,808,750 |

| Ending Cash Balance | $230,000 | $1,808,750 | $6,563,750 |

Actionable Insight: The forecast shows a strong positive cash flow from operations beginning in Year 2, indicating self-sufficiency. Initial funding is critical to bridge the negative cash flow in Year 1. Maintain a healthy cash reserve to mitigate unforeseen operational challenges.


6. Break-Even Analysis

Understanding the break-even point is crucial for determining the sales volume needed to cover all costs.

Break-Even Analysis (Illustrative - Based on Year 2 Data)

  • Total Fixed Costs (Year 2): (R&D + S&M + G&A) = $1,200,000 + $800,000 + $450,000 = $2,450,000
  • Total Variable Costs (Year 2): (COGS/COS) = $1,200,000
  • Total Revenue (Year 2): $5,335,000
  • Contribution Margin (CM) per unit: (Revenue - Variable Costs) / Revenue

* CM Ratio = ($5,335,000 - $1,200,000) / $5,335,000 = $4,135,000 / $5,335,000 = 77.5%

  • Break-Even Revenue: Fixed Costs / Contribution Margin Ratio

* Break-Even Revenue = $2,450,000 / 0.775 = $3,161,290

Actionable Insight: Based on Year 2 projections, the company needs to generate approximately $3.16 million in revenue to cover all its costs. This is achievable given the projected $5.335 million revenue for Year 2. Focus on maintaining or improving the contribution margin ratio through efficient cost management and optimized pricing.


7. Investor-Ready Financial Statements

Below are simplified, investor-ready projected financial statements for a 3-year horizon.

7.1. Projected Income Statement

| Metric | Year 1 (Projected) | Year 2 (Projected) | Year 3 (Projected) |

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

| Total Revenue | $1,800,000 | $5,335,000 | $11,970,000 |

| Cost of Revenue | $540,000 | $1,200,000 | $2,250,000 |

| Gross Profit | $1,260,000 | $4,135,000 | $9,720,000 |

| Gross Margin % | 70.0% | 77.5% | 81.2% |

| Research & Development | $750,000 | $1,200,000 | $1,800,000 |

| Sales & Marketing | $400,000 | $800,000 | $1,300,000 |

| General & Administrative | $300,000 | $450,000 | $600,000 |

| Depreciation & Amortization | $20,000 | $30,000 | $40,000 |

| Total Operating Expenses | $1,470,000 | $2,480,000 | $3,740,000 |

| Operating Income (Loss) | -$210,000 | $1,655,000 | $5,980,000 |

| Interest Expense (Income) | $0 | $0 | $0 |

| Earnings Before Tax (EBT) | -$210,000 | $1,655,000 | $5,980,000 |

| Income Tax Expense | $0 | $181,250 | $1,465,000 |

| Net Income (Loss) | -$210,000 | $1,473,750 | $4,515,000 |

7.2. Projected Balance Sheet

| Assets | Year 0 (Current) | Year 1 (Projected) | Year 2 (Projected) | Year 3 (Projected) |

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

| Current Assets | | | | |

| Cash & Cash Equivalents | $0 | $230,000 | $1,808,750 | $6,563,750 |

| Accounts Receivable | $0 | $150,000 | $400,000 | $900,000 |

| Prepaid Expenses | $0 | $20,000 | $30,000 | $50,000 |

| Total Current Assets | $0 | $400,000 | $2,238,750 | $7,513,750 |

| Non-Current Assets | | | | |

| Property & Equipment (Gross)| $0 | $50,000 | $125,000 | $225,000 |

| Accumulated Depreciation | $0 | -$20,000 | -$50,000 | -$90,000 |

| Net Property & Equipment| $0 | $30,000 | $75,000 | $135,000 |

| Total Assets | $0 | $430,000 | $2,313,750 | $7,648,750 |

| | | | | |

| Liabilities & Equity | | | | |

| Current Liabilities | | | | |

| Accounts Payable | $0 | $80,000 | $200,000 | $450,000 |

| Accrued Expenses | $0 | $40,000 | $80,000 | $150,000 |

| Deferred Revenue | $0 | $80,000 | $250,000 | $600,000 |

| Total Current Liabilities | $0 | $200,000 | $530,000 | $1,200,000 |

| Long-Term Liabilities | | | | |

| Long-Term Debt | $0 | $0 | $0 | $0 |

| Total Liabilities | $0 | $200,000 | $530,000 | $1,200,000 |

| Equity | | | | |

| Common Stock | $0 | $500,000 | $500,000 | $500,000 |

| Retained Earnings | $0 | -$270,000 | $1,283,750 | $5,948,750 |

| Total Equity | $0 | $230,000 | $1,783,750 | $6,448,750 |

| Total Liabilities & Equity| $0 | $430,000 | $2,313,750 | $7,648,750 |

7.3. Projected Cash Flow Statement

(This was already provided in Section 5 for clarity, but is reiterated here as part of the investor-ready statements package)

| Cash Flow Category | Year 1 (Projected) | Year 2 (Projected) | Year 3 (Projected) |

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

| Cash Flow from Operations (CFO) | | | |

| Net Income (Loss) | -$210,000 | $1,473,750 | $4,515,000 |

| Adjustments for non-cash items:| | | |

| Depreciation & Amortization | $20,000 | $30,000 | $40,000 |

| Changes in Working Capital: | | | |

| (Increase) Decrease in A/R | -$150,000 | -$250,000 | -$500,000 |

| (Increase) Decrease in Prepaid | -$20,000 | -$10,000 | -$20,000 |

| Increase (Decrease) in A/P | $80,000 | $120,000 | $250,000 |

| Increase (Decrease) in Accrued | $40,000 | $40,000 | $70,000 |

| Increase (Decrease) in Deferred Rev| $80,000 | $170,000 | $350,000 |

| Net Cash from Operations | -$160,000 | $1,773,750 | $4,605,000 |

| Cash Flow from Investing (CFI) | | | |

| Purchase of Equipment | -$50,000 | -$75,000 | -$100,000 |

| Net Cash from Investing | -$50,000 | -$75,000 | -$100,000 |

| Cash Flow from Financing (CFF) | | | |

| Equity Issuance (Funding) | $500,000 | $0 | $0 |

| Net Cash from Financing | $500,000 | $0 | $0 |

| Net Increase (Decrease) in Cash | $290,000 | $1,698,750 | $4,505,000 |

| Beginning Cash Balance | $0 | $290,000 | $1,988,750 |

| Ending Cash Balance | $290,000 | $1,988,750 | $6,493,750 |


8. Key Financial Metrics & KPIs

| Metric | Year 1 (Projected) | Year 2 (Projected) | Year 3 (Projected) |

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

| Profitability | | | |

| Gross Margin | 70.0% | 77.5% | 81.2% |

| Operating Margin | -11.7% | 31.0% | 50.0% |

| Net Profit Margin | -11.7% | 27.6% | 37.7% |

| Liquidity | | | |

| Current Ratio | 2.00 | 4.22 | 6.26 |

| Efficiency | | | |

| Revenue Growth | N/A | 196.4% | 124.4% |

| R&D as % of Revenue | 41.7% | 22.5% | 15.0% |

| S&M as % of Revenue | 22.2% | 15.0% | 10.9% |

Actionable Insight: The improving operating and net profit margins demonstrate the company's path to sustainable profitability. The high current ratio indicates strong liquidity. The decreasing percentage of R&D and S&M relative to revenue suggests increasing efficiency in scaling operations.


9. Risk Factors & Sensitivity Analysis

Key Risk Factors:

  • Talent Acquisition & Retention: High demand for skilled AI professionals could lead to increased labor costs or difficulty in hiring.
  • Technological Obsolescence: Rapid advancements in AI require continuous R&D investment to stay competitive.
  • Data Privacy & Regulations: Evolving regulations (e.g., GDPR, CCPA) could impact data acquisition and processing, increasing compliance costs.
  • Market Competition: Intense competition from established tech giants and emerging startups.
  • Customer Adoption: Slower-than-expected enterprise adoption of new AI solutions.

Sensitivity Analysis Recommendations:

To stress-test the model, perform sensitivity analysis on the following variables:

  1. Revenue Growth Rate:

* Scenario 1 (Conservative): Reduce annual revenue growth by 10-15% (e.g., 170% in Y2, 100% in Y3).

* Scenario 2 (Aggressive): Increase annual revenue growth by 10-15%.

  1. Customer Churn Rate (SaaS):

* Scenario 1 (Conservative): Increase churn by 2-3 percentage points.

* Scenario 2 (Aggressive): Decrease churn by 1-2 percentage points.

  1. Cost of Revenue (COGS/COS):

* Scenario 1 (Conservative): Increase cloud infrastructure costs by 10-15% (e.g., due to higher data processing needs or vendor price increases).

* Scenario 2 (Aggressive): Decrease COGS/COS by 5-10% (e.g., due to optimized infrastructure).

  1. R&D Investment:

* Scenario 1 (Conservative): Model higher R&D spend required to keep pace with innovation.

* Scenario 2 (Aggressive): Model lower R&D spend if strategic partnerships or open-source components reduce internal development needs.

Actionable Insight: Regularly review these risk factors and conduct sensitivity analysis to prepare for various market conditions. This proactive approach allows for agile strategic adjustments.


10. Recommendations & Next Steps

Based on this financial forecast, the following recommendations are provided:

  1. Strategic Investment in R&D: Continue to prioritize R&D to maintain a technological edge. Explore partnerships or acquisitions that could accelerate product development and market entry for new AI features.
  2. Optimize Customer Acquisition and Retention: With the high growth projections, focus on scaling sales and marketing efforts efficiently. Implement robust CRM and customer success strategies to minimize churn, especially for the SaaS platform.
  3. Cash Flow Management: While the forecast shows positive cash flow by Year 2, maintain a vigilant approach to cash management, especially in the initial growth phase. Secure a sufficient initial funding round to comfortably navigate Year 1's negative operational cash flow.
  4. Explore Diversification/Niche Opportunities: As the company grows, evaluate opportunities to expand into related AI niches or vertical-specific solutions to further differentiate and capture market share.
  5. Regular Financial Review: Conduct quarterly reviews of actual performance against this forecast, making necessary adjustments to assumptions and operational plans. This iterative process is vital in a fast-evolving sector like AI.
  6. Develop a Detailed Funding Pitch: Utilize this investor-ready forecast to articulate the company's financial potential and growth strategy when engaging with potential investors. Highlight the strong gross margins and positive cash flow trajectory.

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