File size: 21,736 Bytes
83cb890
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509

const express = require('express');
const path = require('path');
const cors = require('cors');

const app = express();
const PORT = process.env.PORT || 3000;

// Simple in-memory rate limit per IP (token bucket)
const buckets = new Map();
function rateLimit(req, res, next) {
  const ip = req.ip || req.connection.remoteAddress || 'unknown';
  const now = Date.now();
  const cap = 100; // tokens
  const refill = 50; // tokens per minute
  const b = buckets.get(ip) || { tokens: cap, last: now };
  const elapsed = (now - b.last) / 1000 / 60; // minutes
  b.tokens = Math.min(cap, b.tokens + elapsed * refill);
  b.last = now;
  if (b.tokens < 1) {
    return res.status(429).json({ error: 'Too many requests. Please slow down.' });
  }
  b.tokens -= 1;
  buckets.set(ip, b);
  next();
}

// Middleware
app.use(cors());
app.use(express.json({ limit: '2mb' }));

// Health check
app.get('/api/health', (req, res) => {
  res.json({ 
    ok: true, 
    time: Date.now(),
    service: 'VibeCode Local AI',
    version: '2.0.0'
  });
});

// Template generation endpoint
app.post('/api/generate', rateLimit, async (req, res) => {
  try {
    const { prompt, template, style } = req.body || {};
    
    if (!prompt || !template) {
      return res.status(400).json({ 
        error: 'Missing required parameters: prompt, template' 
      });
    }

    // Template configurations
    const templates = {
      vibecode: {
        name: "VibeCode App",
        description: "Modern web app with vibecoding aesthetics",
        structure: {
          html: `<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>VibeApp</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        .gradient-bg { 
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
        }
        .glass { 
            backdrop-filter: blur(16px) saturate(180%); 
            background-color: rgba(255, 255, 255, 0.75); 
            border: 1px solid rgba(255, 255, 255, 0.125);
        }
        .neon { 
            text-shadow: 0 0 10px currentColor; 
        }
        @keyframes float {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
        }
        .float { animation: float 6s ease-in-out infinite; }
    </style>
</head>
<body class="gradient-bg min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <header class="text-center mb-12">
            <h1 class="text-4xl font-bold text-white mb-4 neon float">${prompt}</h1>
            <p class="text-white/80">Modern vibes, clean code, smooth UX</p>
        </header>
        
        <div class="grid md:grid-cols-3 gap-6">
            <div class="glass rounded-lg p-6 shadow-lg hover:shadow-xl transition">
                <h3 class="text-lg font-semibold mb-3">Dashboard</h3>
                <p class="text-sm opacity-80">Clean overview of your data</p>
            </div>
            <div class="glass rounded-lg p-6 shadow-lg hover:shadow-xl transition">
                <h3 class="text-lg font-semibold mb-3">Analytics</h3>
                <p class="text-sm opacity-80">Real-time insights</p>
            </div>
            <div class="glass rounded-lg p-6 shadow-lg hover:shadow-xl transition">
                <h3 class="text-lg font-semibold mb-3">Settings</h3>
                <p class="text-sm opacity-80">Configure your vibe</p>
            </div>
        </div>
    </div>
</body>
</html>`,
          js: `// VibeApp JavaScript
console.log('${prompt} loaded!');
document.addEventListener('DOMContentLoaded', function() {
    // Add smooth animations
    const cards = document.querySelectorAll('.glass');
    cards.forEach((card, index) => {
        card.style.opacity = '0';
        card.style.transform = 'translateY(20px)';
        setTimeout(() => {
            card.style.transition = 'all 0.5s ease';
            card.style.opacity = '1';
            card.style.transform = 'translateY(0)';
        }, index * 100);
    });
    
    // Add hover effects
    const hero = document.querySelector('.neon');
    if (hero) {
        hero.addEventListener('mouseenter', function() {
            this.style.textShadow = '0 0 20px currentColor, 0 0 30px currentColor';
        });
        hero.addEventListener('mouseleave', function() {
            this.style.textShadow = '0 0 10px currentColor';
        });
    }
});`
        }
      },
      website: {
        name: "Clean Website",
        description: "Professional business website",
        structure: {
          html: `<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Professional Website - ${prompt}</title>
    <script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-white">
    <nav class="bg-white shadow-sm border-b">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <div class="flex items-center">
                    <h1 class="text-xl font-bold text-gray-900">YourBrand</h1>
                </div>
                <div class="hidden md:flex items-center space-x-8">
                    <a href="#" class="text-gray-600 hover:text-gray-900 transition">Home</a>
                    <a href="#" class="text-gray-600 hover:text-gray-900 transition">About</a>
                    <a href="#" class="text-gray-600 hover:text-gray-900 transition">Services</a>
                    <a href="#" class="text-gray-600 hover:text-gray-900 transition">Contact</a>
                </div>
            </div>
        </div>
    </nav>
    
    <main>
        <section class="bg-gradient-to-r from-blue-600 to-purple-600 text-white">
            <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-24">
                <div class="text-center">
                    <h1 class="text-5xl font-bold mb-6">${prompt}</h1>
                    <p class="text-xl mb-8">We create amazing digital experiences</p>
                    <button class="bg-white text-blue-600 px-8 py-3 rounded-lg font-semibold hover:bg-gray-100 transition">
                        Get Started
                    </button>
                </div>
            </div>
        </section>
        
        <section class="py-16">
            <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
                <div class="grid md:grid-cols-3 gap-8">
                    <div class="text-center">
                        <div class="w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4">
                            <svg class="w-8 h-8 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
                            </svg>
                        </div>
                        <h3 class="text-lg font-semibold mb-2">Fast & Efficient</h3>
                        <p class="text-gray-600">Lightning-fast performance and optimized workflows</p>
                    </div>
                    <div class="text-center">
                        <div class="w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4">
                            <svg class="w-8 h-8 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
                            </svg>
                        </div>
                        <h3 class="text-lg font-semibold mb-2">Quality Assured</h3>
                        <p class="text-gray-600">Every project meets our highest standards</p>
                    </div>
                    <div class="text-center">
                        <div class="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
                            <svg class="w-8 h-8 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192L5.636 18.364M12 2.25a9.75 9.75 0 109.75 9.75A9.75 9.75 0 0012 2.25z"></path>
                            </svg>
                        </div>
                        <h3 class="text-lg font-semibold mb-2">24/7 Support</h3>
                        <p class="text-gray-600">Round-the-clock assistance when you need it</p>
                    </div>
                </div>
            </div>
        </section>
    </main>
</body>
</html>`,
          js: `// Professional Website JavaScript
document.addEventListener('DOMContentLoaded', function() {
    console.log('Professional website loaded successfully');
    
    // Smooth scrolling for anchor links
    document.querySelectorAll('a[href^="#"]').forEach(anchor => {
        anchor.addEventListener('click', function (e) {
            e.preventDefault();
            document.querySelector(this.getAttribute('href')).scrollIntoView({
                behavior: 'smooth'
            });
        });
    });
    
    // Add intersection observer for animations
    const observerOptions = {
        threshold: 0.1,
        rootMargin: '0px 0px -50px 0px'
    };
    
    const observer = new IntersectionObserver(function(entries) {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.style.opacity = '1';
                entry.target.style.transform = 'translateY(0)';
            }
        });
    }, observerOptions);
    
    // Observe elements for animation
    document.querySelectorAll('.text-center').forEach(el => {
        el.style.opacity = '0';
        el.style.transform = 'translateY(20px)';
        el.style.transition = 'all 0.6s ease';
        observer.observe(el);
    });
});`
        }
      },
      saas: {
        name: "SaaS Dashboard",
        description: "Analytics & admin panel",
        structure: {
          html: `<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SaaS Dashboard - ${prompt}</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body class="bg-gray-50">
    <div class="min-h-screen flex">
        <!-- Sidebar -->
        <div class="w-64 bg-white shadow-sm">
            <div class="p-6">
                <h2 class="text-xl font-bold text-gray-800">Dashboard</h2>
            </div>
            <nav class="px-4 space-y-2">
                <a href="#" class="block px-3 py-2 text-gray-600 rounded-md bg-blue-50 border-r-2 border-blue-500">Overview</a>
                <a href="#" class="block px-3 py-2 text-gray-600 hover:bg-gray-50 rounded-md">Analytics</a>
                <a href="#" class="block px-3 py-2 text-gray-600 hover:bg-gray-50 rounded-md">Users</a>
                <a href="#" class="block px-3 py-2 text-gray-600 hover:bg-gray-50 rounded-md">Settings</a>
            </nav>
        </div>
        
        <!-- Main Content -->
        <div class="flex-1">
            <header class="bg-white shadow-sm border-b px-6 py-4">
                <h1 class="text-2xl font-semibold text-gray-900">${prompt}</h1>
                <p class="text-gray-600">Welcome back! Here's what's happening with your business.</p>
            </header>
            
            <main class="p-6">
                <div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
                    <div class="bg-white p-6 rounded-lg shadow-sm hover:shadow-md transition">
                        <div class="flex items-center justify-between">
                            <div>
                                <h3 class="text-sm font-medium text-gray-500">Total Users</h3>
                                <p class="text-2xl font-semibold text-gray-900">1,234</p>
                                <span class="text-sm text-green-600">+12%</span>
                            </div>
                            <div class="w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center">
                                <svg class="w-6 h-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m13.5-9a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z"></path>
                                </svg>
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-white p-6 rounded-lg shadow-sm hover:shadow-md transition">
                        <div class="flex items-center justify-between">
                            <div>
                                <h3 class="text-sm font-medium text-gray-500">Revenue</h3>
                                <p class="text-2xl font-semibold text-gray-900">$12,345</p>
                                <span class="text-sm text-green-600">+8.2%</span>
                            </div>
                            <div class="w-12 h-12 bg-green-100 rounded-full flex items-center justify-center">
                                <svg class="w-6 h-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1"></path>
                                </svg>
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-white p-6 rounded-lg shadow-sm hover:shadow-md transition">
                        <div class="flex items-center justify-between">
                            <div>
                                <h3 class="text-sm font-medium text-gray-500">Growth</h3>
                                <p class="text-2xl font-semibold text-gray-900">+23%</p>
                                <span class="text-sm text-green-600">+4.1%</span>
                            </div>
                            <div class="w-12 h-12 bg-purple-100 rounded-full flex items-center justify-center">
                                <svg class="w-6 h-6 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path>
                                </svg>
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-white p-6 rounded-lg shadow-sm hover:shadow-md transition">
                        <div class="flex items-center justify-between">
                            <div>
                                <h3 class="text-sm font-medium text-gray-500">Active Users</h3>
                                <p class="text-2xl font-semibold text-gray-900">856</p>
                                <span class="text-sm text-red-600">-2.1%</span>
                            </div>
                            <div class="w-12 h-12 bg-yellow-100 rounded-full flex items-center justify-center">
                                <svg class="w-6 h-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path>
                                </svg>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
                    <div class="bg-white rounded-lg shadow-sm p-6">
                        <h3 class="text-lg font-medium text-gray-900 mb-4">Revenue Chart</h3>
                        <canvas id="revenueChart" width="400" height="200"></canvas>
                    </div>
                    
                    <div class="bg-white rounded-lg shadow-sm p-6">
                        <h3 class="text-lg font-medium text-gray-900 mb-4">User Activity</h3>
                        <canvas id="activityChart" width="400" height="200"></canvas>
                    </div>
                </div>
            </main>
        </div>
    </div>
</body>
</html>`,
          js: `// SaaS Dashboard JavaScript
document.addEventListener('DOMContentLoaded', function() {
    // Initialize revenue chart
    const ctx1 = document.getElementById('revenueChart').getContext('2d');
    new Chart(ctx1, {
        type: 'line',
        data: {
            labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
            datasets: [{
                label: 'Revenue',
                data: [12000, 19000, 15000, 25000, 22000, 30000],
                borderColor: 'rgb(59, 130, 246)',
                backgroundColor: 'rgba(59, 130, 246, 0.1)',
                tension: 0.4,
                fill: true
            }]
        },
        options: {
            responsive: true,
            plugins: {
                legend: {
                    display: false
                }
            },
            scales: {
                y: {
                    beginAtZero: true,
                    ticks: {
                        callback: function(value) {
                            return ' + value.toLocaleString();
                        }
                    }
                }
            }
        }
    });
    
    // Initialize activity chart
    const ctx2 = document.getElementById('activityChart').getContext('2d');
    new Chart(ctx2, {
        type: 'doughnut',
        data: {
            labels: ['Desktop', 'Mobile', 'Tablet'],
            datasets: [{
                data: [45, 35, 20],
                backgroundColor: [
                    'rgba(59, 130, 246, 0.8)',
                    'rgba(16, 185, 129, 0.8)',
                    'rgba(245, 158, 11, 0.8)'
                ]
            }]
        },
        options: {
            responsive: true,
            plugins: {
                legend: {
                    position: 'bottom'
                }
            }
        }
    });
    
    // Add real-time updates simulation
    function updateMetrics() {
        const metrics = document.querySelectorAll('.bg-white.p-6');
        metrics.forEach(metric => {
            const value = metric.querySelector('.text-2xl');
            if (value && Math.random() > 0.7) {
                // Simulate small changes
                const currentValue = parseFloat(value.textContent.replace(/[^0-9.]/g, ''));
                const change = (Math.random() - 0.5) * 0.1;
                const newValue = currentValue * (1 + change);
                value.textContent = value.textContent.replace(/\d+/, Math.round(newValue));
            }
        });
    }
    
    // Update metrics every 5 seconds
    setInterval(updateMetrics, 5000);
});`
        }
      }
    };

    const selectedTemplate = templates[template] || templates.vibecode;
    
    // Enhance based on style preferences
    let generatedHTML = selectedTemplate.structure.html;
    let generatedJS = selectedTemplate.structure.js;
    
    // Apply style modifications
    if (style) {
      if (style.includes('dark')) {
        generatedHTML = generatedHTML
          .replace(/bg-white/g, 'bg-gray-900')
          .replace(/text-gray-900/g, 'text-white')
          .replace(/text-gray-600/g, 'text-gray-300')
          .replace(/text-gray-500/g, 'text-gray-400')
          .replace(/bg-gray-50/g, 'bg-gray-800')
          .replace(/border-gray-200/g, 'border-gray-700')
          .replace(/shadow-sm/g, 'shadow-lg');
      }
      
      if (style.includes('colorful') || style.includes('rainbow')) {
        generatedHTML = generatedHTML.replace(
          'background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
          'background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57)'
        ).replace(
          'from-blue-600 to-purple-600',
          'from-red-500 via-yellow-500 to-green-500'
        );
      }
    }

    const fullHTML = generatedHTML.replace('</body>', `<script>${generatedJS}</script></body>`);
    
    res.json({
      success: true,
      template: selectedTemplate.name,
      html: generatedHTML,
      js: generatedJS,
      preview: fullHTML,
      description: selectedTemplate.description
    });
    
  } catch (err) {
    console.error('Template generation error:', err);
    res.status(500).json({ error: 'Internal server error' });
  }
});

// Serve static files AFTER API routes to ensure API routes take precedence
app.use(express.static(path.join(__dirname)));

app.listen(PORT, () => {
  console.log(`VibeCode Local AI server running at http://localhost:${PORT}`);
  console.log('API routes registered:');
  console.log('  GET  /api/health');
  console.log('  POST /api/generate');
});