-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprompt-builder-SPA.html
More file actions
627 lines (572 loc) · 28 KB
/
Copy pathprompt-builder-SPA.html
File metadata and controls
627 lines (572 loc) · 28 KB
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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ASPPY SPA Prompt Builder - React Frontend + ASP API Prompts</title>
<meta name="description" content="Generate structured prompts for AI coding agents to build Single Page Applications with React frontend and ASPPY-powered ASP API endpoints.">
<link rel="canonical" href="https://pietercooreman.github.io/ASPPY/prompt-builder-SPA.html">
<!-- Open Graph -->
<meta property="og:title" content="ASPPY SPA Prompt Builder">
<meta property="og:description" content="Generate structured prompts for SPA projects: React frontend + ASPPY ASP API + SQLite.">
<meta property="og:type" content="website">
<!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><defs><linearGradient id='g' x1='0%25' y1='0%25' x2='100%25' y2='100%25'><stop offset='0%25' stop-color='%236366F1'/><stop offset='100%25' stop-color='%230D9488'/></linearGradient></defs><rect width='64' height='64' rx='14' fill='url(%23g)'/><text x='32' y='44' text-anchor='middle' font-family='monospace' font-size='24' font-weight='bold' fill='white'>SPA</text></svg>">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<style>
:root {
--bg-primary: #F8FAFC;
--bg-secondary: #F1F5F9;
--bg-card: #FFFFFF;
--bg-code: #0F172A;
--text-primary: #0F172A;
--text-secondary: #475569;
--text-muted: #94A3B8;
--text-heading: #0F172A;
--border-color: #E2E8F0;
--shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
--shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07);
--shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08);
--radius-sm: 8px;
--radius-md: 12px;
--radius-lg: 16px;
--transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="dark"] {
--bg-primary: #0B1120;
--bg-secondary: #0F172A;
--bg-card: #1E293B;
--bg-code: #0D1117;
--text-primary: #E2E8F0;
--text-secondary: #94A3B8;
--text-muted: #64748B;
--text-heading: #F1F5F9;
--border-color: #334155;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
background: var(--bg-primary);
color: var(--text-primary);
font-family: 'Inter', system-ui, -apple-system, sans-serif;
font-size: 1rem;
line-height: 1.6;
transition: background 0.35s ease, color 0.35s ease;
}
:focus-visible { outline: 2px solid #6366F1; outline-offset: 2px; }
.skip-link {
position: absolute; top: -100%; left: 50%; transform: translateX(-50%);
background: #6366F1; color: #fff; padding: 0.75rem 1.5rem;
border-radius: 8px; z-index: 10000; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
/* NAV */
.pb-nav {
position: sticky; top: 0; z-index: 100;
background: var(--bg-card);
border-bottom: 1px solid var(--border-color);
box-shadow: var(--shadow-sm);
}
.pb-nav-inner {
max-width: 900px; margin: 0 auto;
padding: 0.75rem 1.5rem;
display: flex; align-items: center; justify-content: space-between;
}
.pb-logo {
display: flex; align-items: center; gap: 0.5rem;
font-weight: 700; font-size: 1rem; color: var(--text-heading);
font-family: 'JetBrains Mono', monospace; text-decoration: none;
}
.pb-logo:hover { color: #6366F1; }
.pb-nav-actions { display: flex; align-items: center; gap: 0.75rem; }
.pb-nav-link {
font-size: 0.85rem; font-weight: 500; color: var(--text-secondary);
padding: 0.4rem 0.6rem; border-radius: 6px; transition: var(--transition);
text-decoration: none;
}
.pb-nav-link:hover { color: #6366F1; background: rgba(99,102,241,0.08); }
.pb-theme-btn {
width: 36px; height: 36px; border-radius: 50%;
background: var(--bg-secondary); border: 1px solid var(--border-color);
color: var(--text-primary); cursor: pointer;
display: flex; align-items: center; justify-content: center;
transition: var(--transition); font-size: 0.9rem;
}
.pb-theme-btn:hover { border-color: #6366F1; color: #6366F1; }
/* MAIN */
.pb-wrap { max-width: 820px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
h1 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.25rem; color: var(--text-heading); }
.pb-subtitle { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 2rem; }
/* EXPLAIN BOX */
.pb-explain {
background: rgba(99,102,241,0.06);
border-left: 3px solid #6366F1;
border-radius: 0 var(--radius-md) var(--radius-md) 0;
padding: 1.25rem;
margin-bottom: 1.5rem;
}
.pb-explain h2 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.5rem; color: #6366F1; }
.pb-explain p { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 0.5rem; line-height: 1.7; }
.pb-explain p:last-child { margin-bottom: 0; }
.pb-explain strong { color: var(--text-heading); }
/* ARCHITECTURE BOX */
.pb-arch {
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 1.5rem;
margin-bottom: 1.25rem;
}
.pb-arch h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text-heading); }
.pb-arch-tree {
font-family: 'JetBrains Mono', monospace;
font-size: 0.8rem;
line-height: 1.8;
white-space: pre;
background: var(--bg-code);
color: #C9D1D9;
padding: 1.25rem;
border-radius: var(--radius-sm);
overflow-x: auto;
}
.pb-arch-tree .dir { color: #79C0FF; }
.pb-arch-tree .file { color: #C9D1D9; }
.pb-arch-tree .comment { color: #6E7681; }
/* CARDS */
.pb-card {
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 1.5rem;
margin-bottom: 1.25rem;
transition: var(--transition);
}
.pb-card:hover { box-shadow: var(--shadow-md); }
.pb-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text-heading); }
.pb-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
.pb-tag {
display: inline-block; font-size: 0.7rem; font-weight: 600;
padding: 0.15rem 0.5rem; border-radius: 4px;
background: var(--bg-secondary); color: var(--text-muted);
margin-left: 0.5rem; vertical-align: middle;
}
/* FORM ELEMENTS */
.pb-label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text-secondary); }
.pb-textarea, .pb-input, .pb-select {
width: 100%;
border: 1px solid var(--border-color);
border-radius: var(--radius-sm);
padding: 0.65rem 0.85rem;
font-size: 0.9rem;
font-family: inherit;
background: var(--bg-card);
color: var(--text-primary);
transition: var(--transition);
}
.pb-textarea:focus, .pb-input:focus, .pb-select:focus {
outline: none;
border-color: #6366F1;
box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.pb-textarea { resize: vertical; min-height: 120px; }
/* RADIO GROUP */
.pb-radio-group { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.pb-radio-group input { display: none; }
.pb-radio-group label {
display: flex; align-items: center; gap: 0.4rem;
font-weight: 500; font-size: 0.88rem; cursor: pointer;
padding: 0.55rem 1.1rem;
border: 2px solid var(--border-color);
border-radius: var(--radius-sm);
transition: var(--transition);
color: var(--text-secondary);
}
.pb-radio-group input:checked + label {
border-color: #6366F1;
background: rgba(99,102,241,0.06);
color: #6366F1;
}
/* CHECKBOX */
.pb-check-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.pb-check-row input[type="checkbox"] {
width: 18px; height: 18px; accent-color: #6366F1; cursor: pointer;
}
.pb-check-row label { margin-bottom: 0; font-weight: 500; font-size: 0.88rem; cursor: pointer; color: var(--text-secondary); }
/* GRID */
.pb-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
/* BUTTONS */
.pb-btn {
display: inline-flex; align-items: center; gap: 0.4rem;
padding: 0.7rem 1.5rem; border: none; border-radius: var(--radius-sm);
font-size: 0.9rem; font-weight: 600; cursor: pointer;
transition: var(--transition); font-family: inherit;
}
.pb-btn-primary { background: #6366F1; color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,0.3); }
.pb-btn-primary:hover { background: #4F46E5; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }
.pb-btn-outline {
background: transparent; border: 2px solid var(--border-color); color: var(--text-secondary);
}
.pb-btn-outline:hover { border-color: var(--text-muted); color: var(--text-primary); }
.pb-btn-row { display: flex; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }
/* OUTPUT */
.pb-output-wrap { display: none; margin-top: 1.25rem; }
.pb-output-wrap.show { display: block; }
.pb-output-card {
background: var(--bg-card);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
overflow: hidden;
}
.pb-output {
width: 100%; min-height: 400px;
font-family: 'JetBrains Mono', monospace;
font-size: 0.8rem; line-height: 1.5;
background: var(--bg-code);
color: #E2E8F0;
border: none;
padding: 1.25rem;
resize: vertical;
}
/* TOAST */
.pb-toast {
position: fixed; top: 1rem; right: 1rem;
background: #10B981; color: #fff;
padding: 0.6rem 1.25rem; border-radius: var(--radius-sm);
font-size: 0.85rem; font-weight: 600;
opacity: 0; transition: opacity 0.3s;
pointer-events: none; z-index: 99;
}
.pb-toast.show { opacity: 1; }
/* FOOTER */
.pb-footer {
background: #0B1120; color: rgba(255,255,255,0.4);
padding: 1.5rem; text-align: center; font-size: 0.85rem;
}
.pb-footer a { color: rgba(255,255,255,0.5); text-decoration: none; }
.pb-footer a:hover { color: #fff; }
/* RESPONSIVE */
@media (max-width: 600px) {
.pb-row2 { grid-template-columns: 1fr; }
.pb-radio-group { flex-direction: column; }
.pb-wrap { padding: 1.5rem 1rem 3rem; }
.pb-nav-link { display: none; }
}
</style>
</head>
<body>
<a href="#main-content" class="skip-link">Skip to main content</a>
<!-- NAV -->
<nav class="pb-nav" role="navigation" aria-label="Prompt builder navigation">
<div class="pb-nav-inner">
<a href="index.html" class="pb-logo" aria-label="ASPPY Home">
<svg width="28" height="28" viewBox="0 0 64 64" fill="none"><defs><linearGradient id="lg" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="#6366F1"/><stop offset="100%" stop-color="#0D9488"/></linearGradient></defs><rect width="64" height="64" rx="16" fill="url(#lg)"/><text x="32" y="42" text-anchor="middle" font-family="monospace" font-size="28" font-weight="bold" fill="white"><%</text></svg>
<span>ASPPY</span>
</a>
<div class="pb-nav-actions">
<a href="index.html" class="pb-nav-link">Website</a>
<a href="prompt-builder.html" class="pb-nav-link">MVC Builder</a>
<a href="https://github.com/PieterCooreman/ASPPY" target="_blank" rel="noopener" class="pb-nav-link">GitHub</a>
<button id="theme-toggle" class="pb-theme-btn" aria-label="Toggle dark mode"><i class="bi bi-moon-stars-fill"></i></button>
</div>
</div>
</nav>
<main id="main-content" class="pb-wrap">
<h1>ASPPY SPA Prompt Builder</h1>
<p class="pb-subtitle">Generate a complete prompt for building a Single Page Application with React frontend and ASPPY-powered ASP API endpoints</p>
<!-- Explain -->
<div class="pb-explain">
<h2><i class="bi bi-lightbulb me-1"></i> What is this?</h2>
<p>This prompt builder is designed for <strong>Single Page Applications (SPAs)</strong> where the frontend and backend are fully decoupled. The frontend is a <strong>React</strong> app that communicates with <strong>ASPPY-powered Classic ASP API endpoints</strong> over JSON. The ASP layer serves as a pure REST API — no server-side HTML rendering.</p>
<p><strong>Architecture:</strong> React handles all routing and rendering in the browser. ASP files handle all data access, business logic, and JSON responses. SQLite is the database. Each project lives in a single flat folder containing four files.</p>
</div>
<!-- Architecture -->
<div class="pb-arch">
<h2><i class="bi bi-folder2-open me-1"></i> File Structure</h2>
<div class="pb-arch-tree">
<span class="dir">project/</span>
<span class="file">index.html</span> <span class="comment">← Entry point, loads React via CDN</span>
<span class="file">script.js</span> <span class="comment">← All React components and logic</span>
<span class="file">style.css</span> <span class="comment">← Application styles</span>
<span class="file">api.asp</span> <span class="comment">← ASPPY API endpoint (routes, JSON responses)</span>
</div>
</div>
<!-- App Topic -->
<div class="pb-card">
<h2><i class="bi bi-pencil-square me-1"></i> App Topic</h2>
<p>What should this application be about? Describe the domain, purpose, and who it is for.</p>
<textarea id="topic" class="pb-textarea" rows="3" placeholder="Example: A recipe management app for home cooks to save, search, and share cooking recipes." aria-label="Application topic"></textarea>
</div>
<!-- Project Description -->
<div class="pb-card">
<h2>Features & Requirements</h2>
<p>What should the app do? Be specific about screens, data, and interactions.</p>
<textarea id="description" class="pb-textarea" rows="8" placeholder="Example: Users can add recipes with title, ingredients, steps, and a photo URL. There is a list view with search and filter by category. Users can edit and delete their own recipes. Include a dashboard showing recent recipes and popular categories. Add a login page with sample users." aria-label="Features and requirements"></textarea>
</div>
<!-- App Name -->
<div class="pb-card">
<h2>App Name <span class="pb-tag">optional</span></h2>
<input type="text" id="appname" class="pb-input" placeholder="e.g. RecipeBox, TaskBoard, BudgetTracker" aria-label="Application name">
</div>
<!-- React Configuration -->
<div class="pb-card">
<h2><i class="bi bi-react me-1"></i> React Configuration</h2>
<p>Choose how React should be loaded and which libraries to include.</p>
<div class="pb-row2" style="margin-bottom:0.75rem">
<div>
<label class="pb-label">React loading method</label>
<div class="pb-radio-group" id="react-load-group" role="radiogroup" aria-label="React loading method">
<input type="radio" name="reactload" id="react-cdn" value="cdn" checked>
<label for="react-cdn">CDN (no build)</label>
<input type="radio" name="reactload" id="react-npm" value="npm">
<label for="react-npm">npm + Vite</label>
</div>
</div>
<div>
<label class="pb-label">CSS approach</label>
<div class="pb-radio-group" id="css-group" role="radiogroup" aria-label="CSS framework">
<input type="radio" name="css" id="css-bootstrap" value="bootstrap" checked>
<label for="css-bootstrap"><i class="bi bi-bootstrap"></i> Bootstrap 5</label>
<input type="radio" name="css" id="css-tailwind" value="tailwind">
<label for="css-tailwind"><i class="bi bi-wind"></i> Tailwind</label>
<input type="radio" name="css" id="css-mui" value="mui">
<label for="css-mui"><i class="bi bi-box-seam"></i> Material UI</label>
<input type="radio" name="css" id="css-plain" value="plain">
<label for="css-plain">Plain CSS</label>
</div>
</div>
</div>
</div>
<!-- Features -->
<div class="pb-card">
<h2>Features</h2>
<div class="pb-row2">
<div class="pb-check-row"><input type="checkbox" id="feat-auth" checked><label for="feat-auth">Login / authentication</label></div>
<div class="pb-check-row"><input type="checkbox" id="feat-sample" checked><label for="feat-sample">Sample / seed data</label></div>
<div class="pb-check-row"><input type="checkbox" id="feat-crud" checked><label for="feat-crud">Full CRUD operations</label></div>
<div class="pb-check-row"><input type="checkbox" id="feat-search"><label for="feat-search">Search / filtering</label></div>
<div class="pb-check-row"><input type="checkbox" id="feat-upload"><label for="feat-upload">File uploads</label></div>
<div class="pb-check-row"><input type="checkbox" id="feat-dash"><label for="feat-dash">Dashboard with stats</label></div>
<div class="pb-check-row"><input type="checkbox" id="feat-router"><label for="feat-router">Client-side routing (hash router)</label></div>
<div class="pb-check-row"><input type="checkbox" id="feat-loading"><label for="feat-loading">Loading states & spinners</label></div>
</div>
</div>
<!-- Additional Instructions -->
<div class="pb-card">
<h2>Additional Instructions <span class="pb-tag">optional</span></h2>
<p>Anything else the agent should know: color scheme, specific libraries, special requirements.</p>
<textarea id="extra" class="pb-textarea" rows="3" placeholder="e.g. Use a green color scheme. Include pagination on list pages. Use react-icons for icons." aria-label="Additional instructions"></textarea>
</div>
<!-- Buttons -->
<div class="pb-btn-row">
<button class="pb-btn pb-btn-primary" onclick="generate()" aria-label="Generate prompt JSON">
<i class="bi bi-magic"></i> Generate Prompt
</button>
<button class="pb-btn pb-btn-outline" onclick="copyOutput()" aria-label="Copy output to clipboard">
<i class="bi bi-clipboard"></i> Copy to Clipboard
</button>
</div>
<!-- Output -->
<div id="output-wrap" class="pb-output-wrap">
<div class="pb-output-card">
<textarea id="output" class="pb-output" readonly aria-label="Generated prompt JSON"></textarea>
</div>
</div>
</main>
<!-- Footer -->
<footer class="pb-footer">
<p>ASPPY SPA Prompt Builder · <a href="prompt-builder.html">MVC Builder</a> · <a href="index.html">Back to Website</a></p>
</footer>
<!-- Toast -->
<div class="pb-toast" id="copied-toast"><i class="bi bi-check-circle me-1"></i>Copied to clipboard</div>
<script>
// Theme toggle
(function() {
var saved = localStorage.getItem('asppy-theme');
var prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
var theme = saved || (prefersDark ? 'dark' : 'light');
document.documentElement.setAttribute('data-theme', theme);
updateIcon(theme);
})();
function updateIcon(t) {
var icon = document.querySelector('#theme-toggle i');
if (icon) icon.className = t === 'dark' ? 'bi bi-sun-fill' : 'bi bi-moon-stars-fill';
}
document.getElementById('theme-toggle').addEventListener('click', function() {
var current = document.documentElement.getAttribute('data-theme');
var next = current === 'dark' ? 'light' : 'dark';
document.documentElement.setAttribute('data-theme', next);
localStorage.setItem('asppy-theme', next);
updateIcon(next);
});
// Radio styling
document.querySelectorAll('.pb-radio-group').forEach(function(g) {
g.querySelectorAll('input[type=radio]').forEach(function(r) {
r.addEventListener('change', function() {
g.querySelectorAll('label').forEach(function(l) { l.style.borderColor = ''; l.style.background = ''; l.style.color = ''; });
if (r.checked) {
var lbl = r.nextElementSibling;
lbl.style.borderColor = '#6366F1';
lbl.style.background = 'rgba(99,102,241,0.06)';
lbl.style.color = '#6366F1';
}
});
if (r.checked) {
var lbl = r.nextElementSibling;
lbl.style.borderColor = '#6366F1';
lbl.style.background = 'rgba(99,102,241,0.06)';
lbl.style.color = '#6366F1';
}
});
});
function val(id) { return document.getElementById(id).value.trim(); }
function chk(id) { return document.getElementById(id).checked; }
function css() { return document.querySelector('input[name="css"]:checked').value; }
function reactLoad() { return document.querySelector('input[name="reactload"]:checked').value; }
function generate() {
var topic = val('topic');
var desc = val('description');
if (!topic) { document.getElementById('topic').focus(); return; }
if (!desc) { document.getElementById('description').focus(); return; }
var features = [];
if (chk('feat-auth')) features.push('Secure login with session-based authentication and bcrypt password hashing');
if (chk('feat-sample')) features.push('Sample seed data inserted via a /setup API call on first load');
if (chk('feat-crud')) features.push('Full CRUD (create, read, update, delete) for all entities via fetch() calls');
if (chk('feat-search')) features.push('Search and filtering with query parameters on API calls');
if (chk('feat-upload')) features.push('File upload support via multipart form data to the API');
if (chk('feat-dash')) features.push('Dashboard view with summary statistics fetched from the API');
if (chk('feat-router')) features.push('Client-side hash-based routing (e.g. #/home, #/list, #/detail/1)');
if (chk('feat-loading')) features.push('Loading states, spinners, and error handling for all API calls');
var cssVal = css();
var reactVal = reactLoad();
var prompt = {
"project_topic": topic,
"project_description": desc
};
if (val('appname')) prompt["app_name"] = val('appname');
prompt["architecture"] = {
"type": "Single Page Application (SPA)",
"frontend": "React (loaded via " + (reactVal === 'cdn' ? 'CDN, no build step' : 'npm with Vite bundler') + ")",
"backend": "Classic ASP powered by ASPPY, serving a pure REST JSON API",
"database": "SQLite via ADODB (ASP-side)",
"communication": "Frontend fetch() calls to api.asp endpoints, all data exchanged as JSON"
};
var indexDesc = reactVal === 'cdn'
? 'Entry point. Loads React via script CDN tags. Contains the root div mount point. Links to style.css and script.js.'
: 'Entry point. Uses npm import for React via Vite. Contains the root div mount point. Links to style.css and script.js.';
var styleDesc = cssVal === 'plain'
? 'All application styles. No CSS framework (plain CSS).'
: 'All application styles. Uses ' + (cssVal === 'bootstrap' ? 'Bootstrap 5 via CDN' : cssVal === 'tailwind' ? 'Tailwind CSS via CDN' : 'Material UI via npm (requires Vite build)') + '.';
prompt["file_structure"] = {
"folder": "All four files live in a single flat folder (no subdirectories)",
"files": {
"index.html": indexDesc,
"script.js": "All React components, state management, fetch() calls to api.asp, and client-side routing logic.",
"style.css": styleDesc,
"api.asp": "Single ASPPY-powered ASP file. Routes all API requests via query string or path info. Returns JSON responses. Handles database operations with SQLite via ADODB."
}
};
prompt["frontend_rules"] = [
"All UI rendering happens in the browser via React",
"Do NOT generate any server-side HTML from ASP",
"React components live in script.js",
"Use React.useState and React.useEffect for state and side effects",
"Use fetch() for all API communication with api.asp",
"Handle loading, error, and empty states for every API call",
"All routes are client-side hash routes (e.g. #/page)",
"No npm install required when using CDN mode"
];
prompt["backend_rules"] = [
"api.asp is the sole ASP file, handling all API routes",
"Route via query string parameter: api.asp?action=route_name",
"All responses must set Response.ContentType = 'application/json'",
"All responses must return valid JSON — always use ASPPY.JSON.Encode() to build JSON, never construct it manually (manual concatenation is error-prone with trailing commas and unescaped quotes)",
"Always use ASPPY.JSON.Encode() like this: 'Response.Write ASPPY.JSON.Encode(arrItems)' — it handles quoting, escaping, and array/object structure correctly. Pass True as second arg for pretty-printing: 'ASPPY.JSON.Encode(data, True)'",
"Never return HTML from the API",
"Session handling: use Session(key) for session state; supported on session routes only",
"Use ADODB for SQLite database access",
"Use SqlEscape() for all user-supplied values in SQL",
"Validate all input before database operations",
"Return proper HTTP status codes (200, 201, 400, 404, 500)"
];
prompt["hard_rules"] = [
"Build inside the www directory",
"Do not modify ASPPY/*.py runtime files",
"Use ASPPY only, do not add IIS requirements",
"Run dev server on port 5000",
"After editing api.asp, restart the ASPPY server to clear the compilation cache",
"All four project files (index.html, script.js, style.css, api.asp) must be in the same folder",
"The ASPPY server serves the www directory, place the project folder inside www"
];
prompt["api_asp_structure"] = {
"purpose": "Single-file REST API that the React frontend calls via fetch()",
"routing_pattern": "Use Request.QueryString(\"action\") or path parsing to route requests",
"response_format": "All responses are JSON with Content-Type: application/json",
"example_routes": [
"api.asp?action=login - POST, validates credentials, returns user data",
"api.asp?action=get_items - GET, returns list of items as JSON array",
"api.asp?action=get_item&id=1 - GET, returns single item as JSON object",
"api.asp?action=save_item - POST, creates or updates an item",
"api.asp?action=delete_item&id=1 - POST, deletes an item",
"api.asp?action=setup - POST, creates database tables and inserts seed data"
],
"database_setup": "Include a /setup action that creates SQLite tables and inserts sample data on first run"
};
prompt["critical_vbscript_pitfall"] = {
"error": "Subscript out of range",
"cause": "VBScript And does NOT short-circuit. All operands are evaluated even if the first is False.",
"workaround": "Use nested If blocks. Only access parts(N) inside an If partCount >= N guard."
};
prompt["common_mistakes_to_avoid"] = [
"Do not generate server-side HTML in ASP for the SPA pages",
"Do not write output before Response.ContentType or Response.Redirect",
"Do not concatenate raw request values into SQL, use SqlEscape()",
"Handle VBScript errors by checking return values and using If/Else guards — never rely on On Error Resume Next for control flow",
"Do not create tables on every request, use a dedicated /setup action",
"Validate numeric IDs with IsNumeric() and CInt()",
"Always set Response.ContentType = 'application/json' before writing JSON output",
"Ensure all JSON responses are properly closed (no trailing commas)"
];
prompt["development_workflow"] = [
"1. Create the project folder inside www/",
"2. Create api.asp with database setup action and core API routes",
"3. Create index.html with React mount point and CDN links (or Vite setup)",
"4. Create style.css with application styles",
"5. Create script.js with all React components and fetch() calls",
"6. Start server: python -m ASPPY.server 0.0.0.0 5000 www",
"7. Call the /setup action once to initialize the database",
"8. Open the app in browser and test all API endpoints",
"9. Verify React renders correctly and all fetch calls succeed"
];
prompt["final_checklist"] = [
"All four files exist in a single folder: index.html, script.js, style.css, api.asp",
"index.html loads React and mounts the app",
"script.js contains all React components with fetch() to api.asp",
"api.asp returns only JSON, no HTML rendering",
"SQLite database is created via a /setup action",
"All API calls include proper error handling on the React side",
"No ASPPY runtime files were modified",
"App loads and functions in the browser at localhost:5000"
];
var json = JSON.stringify(prompt, null, 2);
document.getElementById('output').value = json;
document.getElementById('output-wrap').classList.add('show');
document.getElementById('output').scrollIntoView({ behavior: 'smooth', block: 'start' });
}
function copyOutput() {
var el = document.getElementById('output');
if (!el.value) { generate(); }
if (!el.value) return;
navigator.clipboard.writeText(el.value).then(function() {
var t = document.getElementById('copied-toast');
t.classList.add('show');
setTimeout(function() { t.classList.remove('show'); }, 1800);
});
}
</script>
</body>
</html>