Skip to content

hazemahmedx0/charts-temp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dashboard Template for Vibe Coding Platform

This is a template repository that dramatically speeds up dashboard generation by using pre-written HTML, CSS, and JavaScript. The AI only needs to generate a small data.js file with actual data.

πŸ“Š Performance Improvement

  • Before: 60-90 seconds (generating 3 large files with LLM)
  • After: 10-15 seconds (cloning template + generating small data file)
  • Speed: 5-6x faster! ⚑

πŸ—‚οΈ File Structure

dashboard-template/
β”œβ”€β”€ index.html          # Generic dashboard HTML structure (static)
β”œβ”€β”€ style.css           # All dashboard styles (static)
β”œβ”€β”€ dashboard.js        # Dashboard rendering logic (static)
β”œβ”€β”€ data-template.js    # Example data structure (reference only)
└── data.js             # Actual data (generated by LLM)

πŸš€ How It Works

1. Template Approach

The template contains all the static code (HTML structure, CSS styles, JavaScript logic). Only the data is dynamic.

2. Vercel Sandbox Clone

When creating a sandbox, clone this template:

const sandbox = await Sandbox.create({
  source: {
    url: 'https://github.com/YOUR-ORG/dashboard-template.git',
    type: 'git',
  },
  resources: { vcpus: 4 },
  timeout: 2700000,
  ports: [8000],
});

3. Generate Only Data

The LLM generates a single small file (data.js) with:

  • Tab configurations
  • KPI values
  • Chart data
  • Table data

πŸ“ Data Structure

The data.js file follows this structure:

const dashboardData = {
  title: "Dashboard Title",
  subtitle: "Dashboard Description",
  tabs: [
    {
      id: "tab-id",
      name: "Tab Name",
      icon: "πŸ“Š",
      kpis: [...],    // Summary cards
      charts: [...],  // Visualizations
      tables: [...]   // Data tables
    }
  ]
};

See data-template.js for a complete example with all supported features.

🎨 Features

Supported Components:

  • βœ… Multiple tabs
  • βœ… KPI/Summary cards with trends
  • βœ… Line charts
  • βœ… Bar charts
  • βœ… Doughnut/Pie charts
  • βœ… Area charts
  • βœ… Data tables
  • βœ… Responsive design
  • βœ… Beautiful animations
  • βœ… Hover effects

Chart Types:

  • line - Line charts (trends over time)
  • bar - Bar charts (comparisons)
  • doughnut - Doughnut charts (proportions)
  • pie - Pie charts (distributions)
  • radar - Radar charts (multi-dimensional)
  • polarArea - Polar area charts

πŸ”§ Setup Instructions

Option 1: Create a GitHub Repository (Recommended)

  1. Create a new GitHub repository named dashboard-template
  2. Upload these files to the repository
  3. Make the repository public (or provide authentication)
  4. Update the code to use your repository URL

Option 2: Use Vercel Blob Storage

Upload the template to Vercel Blob and reference it.

Option 3: Bundle in Project

Keep the template in your project and use writeFiles to copy it to the sandbox.

πŸ’» Usage in Code

Create Sandbox with Template:

const sandbox = await Sandbox.create({
  source: {
    url: 'https://github.com/YOUR-ORG/dashboard-template.git',
    type: 'git',
  },
  resources: { vcpus: 4 },
  timeout: 2700000,
  ports: [8000],
});

Generate data.js:

// LLM generates only this small file
const dataContent = `
const dashboardData = {
  title: "Sales Dashboard",
  tabs: [
    {
      id: "overview",
      name: "Overview",
      kpis: [
        { label: "Revenue", value: "$124K", trend: 12.5, icon: "πŸ’΅" }
      ],
      charts: [...],
      tables: [...]
    }
  ]
};
`;

await sandbox.writeFiles([{
  path: 'data.js',
  content: Buffer.from(dataContent, 'utf8')
}]);

Start Server:

await sandbox.runCommand({
  cmd: 'python3',
  args: ['-m', 'http.server', '8000'],
  detached: true
});

🎯 Benefits

  1. ⚑ Speed: 5-6x faster dashboard generation
  2. πŸ’° Cost: Less LLM token usage
  3. 🎨 Consistency: All dashboards use the same professional template
  4. πŸ› οΈ Maintainability: Update template once, affects all dashboards
  5. πŸ“Š Reliability: Pre-tested HTML/CSS/JS, fewer errors

πŸ”— Integration

This template is designed to work with the Vibe Coding Platform's:

  • Vercel Sandbox integration
  • AI-powered dashboard generation
  • Real-time data visualization

πŸ“š References

πŸ“ License

This template is part of the Vibe Coding Platform and follows the same license.

About

charts-temp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published