Full Stack App Blueprint
Run ID: 69cadcf874bac0555ea30fd92026-03-30Development
PantheraHive BOS
BOS Dashboard

Full Stack Application Blueprint: Ready-to-Build Specification

This document provides a comprehensive, detailed, and actionable blueprint for a full-stack application. It covers frontend components, backend API, database design, authentication, deployment configuration, and test suites, complete with production-ready code examples and explanations.


1. Overview

This blueprint outlines a robust, scalable, and maintainable full-stack application leveraging modern web technologies. The chosen stack provides a strong foundation for rapid development and high performance.

Core Principles:


2. Core Technologies Stack

| Layer | Technology | Description |

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

| Frontend | React.js | A declarative, component-based JavaScript library for building user interfaces. |

| | React Router | Declarative routing for React. |

| | Axios | Promise-based HTTP client for the browser and Node.js. |

| | Tailwind CSS (Optional)| A utility-first CSS framework for rapidly building custom designs. |

| Backend | Node.js (Express) | A JavaScript runtime for building fast, scalable network applications. |

| | Express.js | A minimal and flexible Node.js web application framework. |

| | JSON Web Tokens (JWT) | A compact, URL-safe means of representing claims to be transferred between two parties. |

| | Sequelize ORM | An easy-to-use multi-dialect ORM for Node.js (PostgreSQL, MySQL, MariaDB, SQLite). |

| Database | PostgreSQL | A powerful, open-source object-relational database system. |

| Deployment | Docker | Containerization platform for consistent environments. |

| | GitHub Actions | CI/CD platform for automated build, test, and deployment. |

| Testing | Jest | A delightful JavaScript testing framework. |

| | React Testing Library | A set of utilities for testing React components. |

| | Supertest | A library for testing HTTP servers. |


3. Frontend Blueprint (React.js)

The frontend is built with React.js, emphasizing a component-driven architecture, efficient state management, and clear separation of concerns.

3.1. Project Structure

text • 1,214 chars
frontend/
├── public/
│   └── index.html
├── src/
│   ├── assets/             # Static assets (images, fonts)
│   ├── components/         # Reusable UI components (e.g., Button, Modal, Header)
│   │   ├── Button/
│   │   │   └── Button.js
│   │   │   └── Button.test.js
│   │   └── Header.js
│   ├── contexts/           # React Context for global state (e.g., AuthContext)
│   │   └── AuthContext.js
│   ├── hooks/              # Custom React Hooks for reusable logic
│   │   └── useAuth.js
│   ├── pages/              # Top-level components representing distinct views/routes
│   │   ├── HomePage.js
│   │   ├── LoginPage.js
│   │   ├── DashboardPage.js
│   │   └── NotFoundPage.js
│   ├── services/           # API interaction logic
│   │   └── api.js          # Axios instance
│   │   └── authService.js  # Authentication specific API calls
│   ├── utils/              # Utility functions (e.g., formatters, validators)
│   │   └── helpers.js
│   ├── App.js              # Main application component, handles routing
│   ├── index.js            # Entry point of the React application
│   └── index.css           # Global styles
├── .env                    # Environment variables
├── package.json
├── README.md
Sandboxed live preview

Full Stack Application Blueprint: Architectural Plan

Workflow Step: 1 of 3 - plan_architecture

Description: Complete application blueprint with frontend components, backend API, database design, authentication, deployment config, and test suites — ready to build.


1. Introduction & Application Vision

This document outlines a comprehensive architectural blueprint for a modern full-stack application. The goal is to establish a robust, scalable, secure, and maintainable foundation that enables efficient development and future growth. This plan provides a detailed overview of the chosen technologies, architectural patterns, and implementation strategies across the frontend, backend, database, authentication, deployment, and testing layers.

High-Level Goals:

  • Robustness: Handle anticipated user loads and data volumes reliably.

*

javascript

// frontend/src/App.js

import React from 'react';

import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';

import { AuthProvider, useAuth } from './contexts/AuthContext';

// Pages

import HomePage from './pages/HomePage';

import LoginPage from './pages/LoginPage';

import RegisterPage from './pages/RegisterPage';

import DashboardPage from './pages/DashboardPage';

import NotFoundPage from './pages/NotFoundPage';

// Private Route Component

const PrivateRoute = ({ children }) => {

const { isAuthenticated, loading } = useAuth();

if (loading) {

return <div>Loading authentication...</div>; // Or a nice spinner

}

return isAuthenticated ? children : <Navigate to="/login" />;

};

function App() {

return (

<Router>

<AuthProvider>

<Routes>

<Route path="/" element={<HomePage />} />

<Route path="/login"

gemini Output

Full Stack Application Blueprint: Comprehensive Deliverable

This document provides a comprehensive blueprint for your full-stack application, outlining the foundational architecture, technology stack, detailed component designs for both frontend and backend, database schema, authentication mechanisms, deployment strategies, and a robust testing framework. This blueprint is designed to be a ready-to-build guide, ensuring clarity, consistency, and efficiency throughout the development process.


1. Executive Summary

This blueprint defines the complete technical architecture for a modern, scalable, and secure full-stack application. It covers all essential layers from user interface to data persistence, incorporating best practices for development, deployment, and maintenance. The chosen technology stack prioritizes performance, developer experience, and long-term maintainability. This document serves as the foundational guide for the development team to commence building the application with a clear and unified vision.


2. Application Overview

Application Name: [Placeholder: e.g., "PantheraConnect Platform"]

Core Purpose: [Placeholder: e.g., "To facilitate seamless project management and collaboration for distributed teams."]

Key Modules/Features:

  • User Management: Registration, Login, Profile Management, Role-Based Access Control.
  • [Specific Feature 1]: [Placeholder: e.g., Project Creation and Management]
  • [Specific Feature 2]: [Placeholder: e.g., Task Assignment and Tracking]
  • [Specific Feature 3]: [Placeholder: e.g., Real-time Notifications]
  • [Specific Feature 4]: [Placeholder: e.g., Reporting and Analytics]

3. Core Technology Stack

This section outlines the primary technologies selected for each layer of the application.

  • Frontend:

* Framework: React (with Next.js for SSR/SSG capabilities and optimized routing)

* Language: TypeScript

* Styling: Tailwind CSS (for utility-first styling) & Styled Components (for component-specific styling where needed)

* State Management: React Query (for server state management) & Zustand/Jotai (for client state management)

* Build Tool: Webpack (via Next.js)

  • Backend:

* Framework: Node.js with Express.js (for RESTful API development)

* Language: TypeScript

* Database ORM/ODM: Prisma ORM (for PostgreSQL/MySQL) or Mongoose (for MongoDB)

* API Style: RESTful API

  • Database:

* Type: Relational Database

* Specific DB: PostgreSQL

  • Authentication & Authorization:

* Method: JWT (JSON Web Tokens) for API authentication

* Providers: Local Email/Password, Google OAuth (for social login)

  • Deployment & Infrastructure:

* Cloud Provider: AWS (Amazon Web Services)

* Frontend Hosting: AWS S3 + CloudFront (for static assets) or Vercel/Netlify (for Next.js deployments)

* Backend Hosting: AWS EC2 + Docker (for containerized applications) or AWS Lambda (for serverless functions)

* Database Hosting: AWS RDS (Managed PostgreSQL)

  • Testing:

* Frontend: Jest, React Testing Library, Cypress (for E2E)

* Backend: Jest, Supertest

  • Version Control: Git (GitHub/GitLab/Bitbucket)

4. Frontend Blueprint

The frontend will be built using React with Next.js, focusing on a modular and maintainable component architecture.

4.1. Component Architecture

  • Atomic Design Principles: Components will be organized into Atoms, Molecules, Organisms, Templates, and Pages.

* Atoms: Basic HTML elements (buttons, inputs, typography).

* Molecules: Groups of atoms functioning together (e.g., search bar, navigation link group).

* Organisms: Complex UI components composed of molecules and atoms (e.g., header, sidebar, form).

* Templates: Page-level layouts without specific content (e.g., dashboard layout, authentication layout).

* Pages: Instances of templates with specific content, connecting to data.

  • Directory Structure:

    src/
    ├── pages/          // Next.js pages (routes)
    ├── components/
    │   ├── atoms/
    │   ├── molecules/
    │   ├── organisms/
    │   ├── templates/
    │   └── common/     // Reusable components across multiple organisms
    ├── hooks/          // Custom React hooks
    ├── contexts/       // React Context API for global state (if needed)
    ├── lib/            // Utility functions, API clients
    ├── styles/         // Tailwind config, global styles
    ├── types/          // TypeScript type definitions
    └── assets/         // Images, icons, fonts

4.2. Key Pages/Views

  • Authentication:

* /login: User login form.

* /register: New user registration form.

* /forgot-password: Password reset request.

* /reset-password/[token]: Password reset form.

  • Dashboard:

* /dashboard: Overview of key metrics and recent activity.

  • User Management:

* /profile: User profile viewing and editing.

* /settings: Application-specific user settings.

  • [Specific Feature 1] Pages:

* /[feature-1]: List view of all [Feature 1] items.

* /[feature-1]/create: Form for creating a new [Feature 1] item.

* /[feature-1]/[id]: Detail view for a specific [Feature 1] item.

* /[feature-1]/[id]/edit: Form for editing a specific [Feature 1] item.

  • Error Pages:

* /404: Not Found page.

* /500: Server Error page.

4.3. State Management Strategy

  • Server State (Data Fetching): React Query will be used for managing all asynchronous data fetching, caching, synchronization, and error handling with the backend API.
  • Client State (UI State): Zustand or Jotai will manage local UI state (e.g., modal visibility, form input values, theme preferences). React's useState and useReducer will be used for component-local state.
  • Global Context (Limited): React Context API will be used sparingly for truly global, rarely changing data (e.g., authentication status, user preferences).

4.4. Styling Strategy

  • Tailwind CSS: Primary styling framework for rapid UI development, responsive design, and consistent theming. Custom theme configuration will be used to define brand colors, typography, and spacing.
  • Styled Components (Conditional): Used for complex, highly dynamic components that require specific CSS-in-JS logic, or for encapsulating styles that are tightly coupled to a component's internal logic.
  • CSS Modules (Conditional): For rare cases where component-level CSS encapsulation is strictly required without the overhead of JS-in-CSS.

4.5. Performance Considerations

  • Next.js Optimizations: Server-Side Rendering (SSR) or Static Site Generation (SSG) for improved initial load times and SEO. Image optimization via next/image.
  • Code Splitting: Automatic by Next.js, ensuring only necessary code is loaded for each route.
  • Lazy Loading: Components and routes will be lazy-loaded where appropriate to reduce initial bundle size.
  • Data Fetching Optimization: Efficient use of React Query's caching and background re-fetching mechanisms.
  • Bundle Analysis: Tools like @next/bundle-analyzer will be used to monitor and optimize bundle size.

5. Backend API Blueprint

The backend will be built using Node.js with Express.js, providing a robust and scalable RESTful API.

5.1. API Endpoints (Examples)

  • Authentication:

* POST /api/auth/register: Register a new user.

* POST /api/auth/login: Authenticate user, return JWT.

* POST /api/auth/refresh-token: Refresh expired JWT.

* POST /api/auth/forgot-password: Request password reset.

* POST /api/auth/reset-password: Reset password with token.

  • Users:

* GET /api/users/me: Get current authenticated user's profile. (Protected)

* PUT /api/users/me: Update current authenticated user's profile. (Protected)

* GET /api/users/:id: Get user by ID. (Admin/Protected)

* GET /api/users: Get list of all users (with pagination/filters). (Admin/Protected)

  • [Specific Resource 1] (e.g., Projects):

* GET /api/projects: Get list of projects (with filters, pagination).

* GET /api/projects/:id: Get a specific project by ID.

* POST /api/projects: Create a new project.

* PUT /api/projects/:id: Update a project.

* DELETE /api/projects/:id: Delete a project.

  • [Specific Resource 2] (e.g., Tasks):

* GET /api/projects/:projectId/tasks: Get tasks for a specific project.

* POST /api/projects/:projectId/tasks: Create a task within a project.

* GET /api/tasks/:id: Get a specific task by ID.

* PUT /api/tasks/:id: Update a task.

* DELETE /api/tasks/:id: Delete a task.

5.2. Data Models (Examples using TypeScript/Prisma)

  • User Model:

    // User
    interface User {
        id: string; // UUID
        email: string; // Unique
        passwordHash: string;
        firstName: string;
        lastName: string;
        role: 'ADMIN' | 'USER'; // Enum
        createdAt: Date;
        updatedAt: Date;
        // Relationships: projects: Project[]
    }
  • Project Model:

    // Project
    interface Project {
        id: string; // UUID
        name: string;
        description: string | null;
        status: 'ACTIVE' | 'COMPLETED' | 'ARCHIVED'; // Enum
        ownerId: string; // Foreign Key to User
        createdAt: Date;
        updatedAt: Date;
        // Relationships: owner: User, tasks: Task[]
    }
  • Task Model:

    // Task
    interface Task {
        id: string; // UUID
        title: string;
        description: string | null;
        status: 'TODO' | 'IN_PROGRESS' | 'DONE'; // Enum
        priority: 'LOW' | 'MEDIUM' | 'HIGH'; // Enum
        dueDate: Date | null;
        projectId: string; // Foreign Key to Project
        assignedToId: string | null; // Foreign Key to User
        createdAt: Date;
        updatedAt: Date;
        // Relationships: project: Project, assignedTo: User
    }

5.3. Authentication & Authorization Flows

  • Authentication:

* Users register with email/password. Password is BCRYPT hashed.

* Upon login, a short-lived Access Token (JWT) and a long-lived Refresh Token (JWT) are issued.

* Access Token is sent with every subsequent request in the Authorization: Bearer <token> header.

* If Access Token expires, Refresh Token is used to obtain new tokens.

  • Authorization:

* Role-Based Access Control (RBAC): Users will have assigned roles (e.g., ADMIN, USER).

* Middleware will verify user roles and permissions for specific routes/actions (e.g., only ADMIN can view all users, only owner or ADMIN can update a project).

* Resource-specific authorization (e.g., a user can only edit their own profile, or projects they are part of).

5.4. Error Handling Strategy

  • Centralized Error Middleware: A global error handling middleware in Express will catch all unhandled errors.
  • Custom Error Classes: Define custom error classes (e.g., APIError, NotFoundError, UnauthorizedError) to provide structured error messages.
  • Standardized Error Responses: API will return consistent JSON error objects:

    {
        "success": false,
        "message": "Error description",
        "code": "ERROR_CODE_ENUM", // e.g., "NOT_FOUND", "VALIDATION_FAILED"
        "details": { /* optional specific error details, e.g., field validation errors */ }
    }
  • Logging: All errors will be logged to a centralized logging service (e.g., AWS CloudWatch, Sentry).

5.5. Rate Limiting & Security Considerations

  • Rate Limiting: express-rate-limit middleware will be used to prevent brute-force attacks and abuse on critical endpoints (login, registration, password reset).
  • Input Validation: Joi or Zod will be used for robust schema validation on all incoming API requests.
  • CORS: Properly configured cors middleware to allow requests only from authorized frontend origins.
  • Helmet.js: Used for setting various HTTP headers to improve security (XSS, CSRF protection, etc.).
  • Environment Variables: Sensitive information (database credentials, API keys) will be stored in environment variables, not hardcoded.
  • HTTPS: All communication will be enforced over HTTPS.

5.6. Background Tasks / Job Queues (Optional but Recommended)

For long-running or asynchronous operations (e.g., sending email notifications, generating reports, image processing):

  • Technology: Redis (for queue) + BullMQ or Agenda.js (for job processing).
  • Examples: Email sending, data import/export, scheduled tasks.

6. Database Design (PostgreSQL)

6.1. Schema (Entities and Relationships)

  • users Table:

* id (UUID, Primary Key)

* email (VARCHAR(255),

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