Skip to content

This is an electron build for a proof of concept for a desktop app that builds itself out based on your requirements of it

License

Notifications You must be signed in to change notification settings

spark-engine-opensource-projects/Self-Building-Desktop-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dynamic App Builder

An AI-powered Electron desktop application that generates and executes interactive web components using Claude (Anthropic's AI).

Features

  • πŸ€– AI Code Generation - Generate complete UI components from natural language prompts
  • πŸ”’ Secure Execution - Sandboxed code execution with resource limits
  • ⚑ Smart Caching - Similarity-based caching for faster responses
  • πŸ›‘οΈ Enhanced Security - No eval(), CSP enforcement, input validation
  • πŸ“Š Production Ready - Comprehensive logging, monitoring, and error recovery
  • 🎨 Real-time UI Generation - Build dashboards, forms, calculators instantly
  • πŸŒ™ Dark Mode - Toggle between light and dark themes
  • πŸ”§ TypeScript Support - Full TypeScript definitions and compilation
  • πŸ§ͺ Testing Framework - Jest test suite with mocked Electron environment
  • πŸ’Ύ Encrypted Storage - Secure API key storage with Electron safeStorage
  • ⚑ Circuit Breaker - Fault tolerance with automatic failure recovery
  • πŸ“ˆ Performance Monitoring - Real-time metrics collection and analysis
  • πŸ”„ Request Interceptors - Advanced request/response handling
  • πŸ“… Auto Scheduler - Background cleanup and maintenance tasks
  • πŸ—„οΈ Dynamic Database - AI-powered SQLite database creation and management
  • πŸ“Š Data Visualization - Built-in charts, graphs, and data analysis tools
  • πŸ” Visual Query Builder - No-SQL-knowledge-required database queries
  • πŸ“ˆ Database Analytics - Automatic statistics and insights generation

Prerequisites

  • Node.js 14.0.0 or higher
  • npm or yarn
  • Anthropic API key (get from Anthropic Console)

Installation

# Clone the repository
git clone <repository-url>
cd Self-Building-Desktop-App

# Install dependencies
npm install

# Start the application
npm start

Development

# Run in development mode with DevTools
npm run dev

# Build for production
npm run build

# Rebuild native modules
npm run rebuild

# TypeScript compilation
npm run compile

# Watch TypeScript files
npm run watch

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Type checking
npm run type-check

Configuration

The application can be configured via src/config/default.json:

  • Execution limits - Memory, timeout, concurrent executions
  • Security settings - Package blocking, prompt validation
  • AI parameters - Model, temperature, token limits
  • Caching - TTL, similarity thresholds

Usage

  1. Launch the application

    npm start
  2. Configure API Key

    • Enter your Anthropic API key in the UI
    • Or load from a text file
  3. Generate Components

    • Describe what you want to build in natural language
    • Examples:
      • "Create a todo list with add/remove functionality"
      • "Build a calculator with modern UI"
      • "Make an interactive dashboard with charts"
  4. Execute Code

    • Review the generated code
    • Click Execute to run in sandboxed environment
    • See results in real-time
  5. Database Management

    • Click the "πŸ—„οΈ Database" button to access database features
    • Use AI Schema Generator to create databases from natural language:
      • "Create a blog system with users, posts, and comments"
      • "Build an inventory system for a retail store"
    • Manage data through the visual interface
    • Create charts and visualizations from your data
  6. Advanced Features

    • Use the Visual Query Builder for complex database queries
    • Export databases as JSON for backup or sharing
    • Generate code that works with your database structure
    • View automatic statistics and insights

Architecture

src/
β”œβ”€β”€ main.js              # Main Electron process
β”œβ”€β”€ preload.js           # Secure IPC bridge
β”œβ”€β”€ renderer/            # UI components
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ renderer.js
β”‚   └── styles.css
β”œβ”€β”€ utils/               # Core utilities
β”‚   β”œβ”€β”€ logger.js        # Winston logging
β”‚   β”œβ”€β”€ securitySandbox.js # Code sandboxing
β”‚   β”œβ”€β”€ cacheManager.js  # Smart caching
β”‚   β”œβ”€β”€ circuitBreaker.js # Fault tolerance
β”‚   β”œβ”€β”€ ipcValidator.js  # Input validation
β”‚   β”œβ”€β”€ secureStorage.js # Encrypted storage
β”‚   β”œβ”€β”€ performanceMonitor.js # Metrics tracking
β”‚   β”œβ”€β”€ requestInterceptor.js # Request handling
β”‚   β”œβ”€β”€ scheduler.js     # Background tasks
β”‚   β”œβ”€β”€ envConfig.js     # Environment config
β”‚   └── secureDOMExecutor.js # Safe DOM operations
└── config/
    └── default.json     # Default settings

Security Features

  • Sandboxed Execution - Code runs in isolated environments
  • Resource Limits - CPU, memory, and timeout constraints
  • Package Filtering - Blocks dangerous Node.js modules
  • Input Validation - All user inputs sanitized
  • CSP Enforcement - Content Security Policy in all contexts
  • No eval() - Uses Function constructor with sanitized scope

API Integration

The application uses the Anthropic Claude API for code generation:

  • Model: Claude 3.5 Sonnet
  • Configurable temperature and token limits
  • Automatic retry with exponential backoff
  • Smart prompt enhancement for better results

Monitoring

Built-in monitoring includes:

  • System resource tracking (CPU, memory, disk)
  • Execution statistics and success rates
  • Session history and persistence
  • Cache performance metrics
  • Security event logging

Troubleshooting

Application won't start

  • Check Node.js version: node --version (must be >= 14.0.0)
  • Rebuild native modules: npm run rebuild
  • Check logs in logs/ directory

Code generation fails

  • Verify API key is valid
  • Check internet connection
  • Review error messages for specific issues
  • Try simpler prompts

Execution errors

  • Check browser console for DOM errors
  • Review security sandbox logs
  • Ensure code doesn't use blocked APIs

Contributing

Please read CONTRIBUTING.md for contribution guidelines.

Security

For security concerns, please see SECURITY.md.

License

MIT License - see LICENSE for details.

Acknowledgments

About

This is an electron build for a proof of concept for a desktop app that builds itself out based on your requirements of it

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •