-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject-description.html
More file actions
610 lines (533 loc) · 20 KB
/
Copy pathproject-description.html
File metadata and controls
610 lines (533 loc) · 20 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PrepStudio — Project Description</title>
<style>
:root {
--bg: #080c14;
--surface: #0f1623;
--surface2: #161e2e;
--border: #1e2d45;
--indigo: #6366f1;
--violet: #7c3aed;
--indigo-dim: rgba(99,102,241,0.12);
--text: #e2e8f0;
--muted: #64748b;
--muted2: #94a3b8;
--green: #34d399;
--amber: #fbbf24;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
background: var(--bg);
color: var(--text);
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
font-size: 15px;
line-height: 1.75;
min-height: 100vh;
}
/* ── Header ── */
header {
border-bottom: 1px solid var(--border);
padding: 28px 0 24px;
text-align: center;
background: linear-gradient(180deg, rgba(99,102,241,0.06) 0%, transparent 100%);
}
.logo-wrap {
display: inline-flex;
align-items: center;
gap: 14px;
margin-bottom: 14px;
}
.logo-svg rect[rx="22"] { fill: url(#logoGrad); }
header h1 {
font-size: 2.6rem;
font-weight: 900;
letter-spacing: -0.03em;
background: linear-gradient(135deg, #e2e8f0 0%, #a5b4fc 60%, #818cf8 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
header .tagline {
color: var(--muted2);
font-size: 1rem;
margin-top: 6px;
max-width: 560px;
margin-left: auto;
margin-right: auto;
}
.badge-row {
display: flex;
justify-content: center;
gap: 10px;
flex-wrap: wrap;
margin-top: 18px;
}
.badge {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 12px;
border-radius: 999px;
font-size: 0.72rem;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.badge-indigo { background: var(--indigo-dim); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.25); }
.badge-violet { background: rgba(124,58,237,0.12); color: #c4b5fd; border: 1px solid rgba(124,58,237,0.25); }
.badge-emerald { background: rgba(52,211,153,0.08); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.2); }
/* ── Layout ── */
main {
max-width: 860px;
margin: 0 auto;
padding: 52px 24px 80px;
}
/* ── Section headings ── */
h2 {
font-size: 1.35rem;
font-weight: 800;
color: #e2e8f0;
margin: 52px 0 20px;
display: flex;
align-items: center;
gap: 10px;
}
h2::before {
content: '';
display: block;
width: 3px;
height: 22px;
border-radius: 2px;
background: linear-gradient(180deg, var(--indigo), var(--violet));
flex-shrink: 0;
}
h3 {
font-size: 1.02rem;
font-weight: 700;
color: #a5b4fc;
margin: 28px 0 10px;
}
p { color: var(--muted2); margin-bottom: 14px; }
strong { color: #e2e8f0; font-weight: 700; }
em { color: #c4b5fd; font-style: italic; }
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
font-size: 0.82em;
background: rgba(99,102,241,0.1);
color: #a5b4fc;
padding: 2px 6px;
border-radius: 5px;
border: 1px solid rgba(99,102,241,0.18);
}
hr {
border: none;
border-top: 1px solid var(--border);
margin: 40px 0;
}
/* ── Intro card ── */
.intro-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 16px;
padding: 28px 32px;
margin-bottom: 8px;
position: relative;
overflow: hidden;
}
.intro-card::before {
content: '';
position: absolute;
inset: 0;
background: radial-gradient(ellipse at top left, rgba(99,102,241,0.07) 0%, transparent 60%);
pointer-events: none;
}
.intro-card p { margin: 0; font-size: 1.01rem; line-height: 1.8; }
/* ── Journey steps ── */
.steps { display: flex; flex-direction: column; gap: 4px; }
.step {
display: grid;
grid-template-columns: 44px 1fr;
gap: 0 18px;
position: relative;
}
.step:not(:last-child) .step-line {
position: absolute;
left: 21px;
top: 44px;
bottom: -4px;
width: 2px;
background: linear-gradient(180deg, var(--border) 0%, transparent 100%);
}
.step-num {
width: 44px;
height: 44px;
border-radius: 50%;
background: var(--surface2);
border: 1px solid var(--border);
display: flex;
align-items: center;
justify-content: center;
font-size: 0.78rem;
font-weight: 800;
color: #a5b4fc;
flex-shrink: 0;
margin-top: 2px;
position: relative;
z-index: 1;
}
.step-body { padding: 2px 0 28px; }
.step-body h3 { margin-top: 8px; margin-bottom: 8px; font-size: 0.97rem; }
.step-body p { margin-bottom: 0; }
/* ── Architecture table ── */
.arch-table {
width: 100%;
border-collapse: collapse;
margin: 8px 0 20px;
font-size: 0.875rem;
}
.arch-table thead th {
text-align: left;
padding: 10px 16px;
background: var(--surface2);
color: var(--muted2);
font-size: 0.72rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
border-bottom: 1px solid var(--border);
}
.arch-table thead th:first-child { border-radius: 10px 0 0 0; }
.arch-table thead th:last-child { border-radius: 0 10px 0 0; }
.arch-table tbody tr {
border-bottom: 1px solid var(--border);
transition: background 0.15s;
}
.arch-table tbody tr:last-child { border-bottom: none; }
.arch-table tbody tr:hover { background: rgba(99,102,241,0.04); }
.arch-table tbody td {
padding: 11px 16px;
vertical-align: top;
}
.arch-table tbody td:first-child {
color: #a5b4fc;
font-weight: 700;
white-space: nowrap;
width: 160px;
}
.arch-table tbody td:last-child { color: var(--muted2); }
.table-wrap {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
overflow: hidden;
}
/* ── Notes (callouts) ── */
.note {
background: var(--surface);
border: 1px solid var(--border);
border-left: 3px solid var(--indigo);
border-radius: 0 10px 10px 0;
padding: 14px 18px;
margin: 14px 0;
font-size: 0.9rem;
color: var(--muted2);
}
.note strong { color: #a5b4fc; }
/* ── Data model block ── */
.data-model {
background: #0a0e18;
border: 1px solid var(--border);
border-radius: 12px;
padding: 22px 26px;
font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
font-size: 0.82rem;
line-height: 1.9;
color: var(--muted2);
overflow-x: auto;
}
.data-model .dm-entity { color: #a5b4fc; font-weight: 700; }
.data-model .dm-field { color: #7dd3fc; }
.data-model .dm-note { color: var(--muted); }
.data-model .dm-arrow { color: var(--indigo); }
/* ── Design section ── */
.design-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
gap: 14px;
margin-top: 16px;
}
.design-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
padding: 18px 20px;
}
.design-card .swatch {
width: 36px;
height: 36px;
border-radius: 8px;
margin-bottom: 12px;
}
.design-card h4 { font-size: 0.82rem; font-weight: 700; color: #e2e8f0; margin-bottom: 5px; }
.design-card p { font-size: 0.8rem; color: var(--muted); margin: 0; line-height: 1.55; }
/* ── Footer ── */
footer {
border-top: 1px solid var(--border);
text-align: center;
padding: 28px 24px;
color: var(--muted);
font-size: 0.8rem;
}
footer span { color: var(--indigo); }
/* ── Responsive ── */
@media (max-width: 600px) {
header h1 { font-size: 2rem; }
main { padding: 36px 16px 60px; }
.arch-table tbody td:first-child { width: auto; white-space: normal; }
}
</style>
</head>
<body>
<!-- ── HEADER ── -->
<header>
<div class="logo-wrap">
<svg width="52" height="52" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="logoGrad" x1="0" y1="0" x2="100" y2="100" gradientUnits="userSpaceOnUse">
<stop offset="0%" stop-color="#4f46e5"/>
<stop offset="100%" stop-color="#7c3aed"/>
</linearGradient>
</defs>
<rect width="100" height="100" rx="22" fill="url(#logoGrad)"/>
<rect x="0.5" y="0.5" width="99" height="99" rx="21.5" fill="none" stroke="rgba(255,255,255,0.12)" stroke-width="1"/>
<path fill-rule="evenodd" fill="white"
d="M14 14 L14 86 L26 86 L26 50 Q66 50 66 32 Q66 14 26 14Z M26 22 Q58 22 58 32 Q58 42 26 42Z"/>
<rect x="72" y="26" width="6" height="12" rx="3" fill="white" fill-opacity="0.45"/>
<rect x="80" y="22" width="6" height="20" rx="3" fill="white" fill-opacity="0.70"/>
<rect x="88" y="18" width="6" height="28" rx="3" fill="white" fill-opacity="1"/>
</svg>
<h1>PrepStudio</h1>
</div>
<p class="tagline">AI-powered study platform with voice-based curriculum delivery and live mock interviews</p>
<div class="badge-row">
<span class="badge badge-violet">Gemini 2.5 Flash</span>
<span class="badge badge-emerald">Next.js 14 + FastAPI</span>
<span class="badge badge-indigo">ElevenLabs Conversational AI</span>
</div>
</header>
<main>
<!-- ── CORE CONCEPT ── -->
<h2>Core Concept</h2>
<div class="intro-card">
<p>
Most learners know <em>what</em> they want to study but have no structured path, no one to explain concepts
interactively, and no way to test if they actually retained anything. PrepStudio fills all three gaps using a
pipeline of AI services — <strong>Gemini 2.5 Flash</strong> for content intelligence and
<strong>ElevenLabs Conversational AI</strong> for voice interaction. Enter a topic, get a full curriculum,
learn through live voice lessons, write and refine articles, then prove your knowledge in a voice mock interview.
</p>
</div>
<!-- ── USER JOURNEY ── -->
<h2>User Journey</h2>
<div class="steps">
<div class="step">
<div class="step-line"></div>
<div class="step-num">1</div>
<div class="step-body">
<h3>Onboarding & Auth</h3>
<p>
Users sign in via <strong>Firebase</strong> (Google OAuth or email/password). The app avoids repeated
Firebase token verification by exchanging the Firebase ID token for a short-lived <strong>HS256 backend JWT</strong>
once, caching it, and using it for all subsequent API calls. Managed entirely by a Zustand store
(<code>authStore.ts</code>) and an Axios interceptor.
</p>
</div>
</div>
<div class="step">
<div class="step-line"></div>
<div class="step-num">2</div>
<div class="step-body">
<h3>Plan Creation <code>/new</code></h3>
<p>
The user enters a topic (e.g. "Django REST Framework") and a duration in days. Gemini 2.5 Flash generates a
structured day-by-day curriculum — each day has a title and 2–4 topics, each with a one-sentence summary.
The entire plan is persisted in PostgreSQL as a <code>Plan → PlanDay → Topic</code> tree.
</p>
</div>
</div>
<div class="step">
<div class="step-line"></div>
<div class="step-num">3</div>
<div class="step-body">
<h3>Plan Dashboard <code>/plan/[id]</code></h3>
<p>
A dark-themed, sidebar-driven UI shows the full curriculum. A progress ring tracks completion percentage
across all topics. The mock interview is <strong>gated at 80% completion</strong> — users can't skip ahead
without actually studying. Each day's topics show completion state (circle → checkmark).
</p>
</div>
</div>
<div class="step">
<div class="step-line"></div>
<div class="step-num">4</div>
<div class="step-body">
<h3>Topic Deep Dive</h3>
<p>
Topic content is <strong>lazily generated</strong> — the first GET calls Gemini and caches the result in the
<code>content</code> column; subsequent visits are instant database reads. Content is rich Markdown:
introduction with analogy, core concepts with subheadings, code examples, and a "gotchas" section.
</p>
<p>
Users can also launch a <strong>Live Audio Lesson</strong> powered by ElevenLabs. A fresh Conversational AI
agent ("Nova, the tutor") is created with the topic content injected as a system prompt. Nova opens with a
hook question, uses analogies, checks for understanding, and closes with 3 key takeaways. The session is a
real-time bidirectional voice WebSocket via <code>@11labs/react</code>.
</p>
</div>
</div>
<div class="step">
<div class="step-line"></div>
<div class="step-num">5</div>
<div class="step-body">
<h3>Article Refiner</h3>
<p>
After studying, users write raw notes (stream-of-consciousness, bullet points, fragments). Gemini refines
them into a polished Markdown blog post <strong>plus</strong> a ready-to-paste Twitter/X thread with 4–6
numbered tweets. Both outputs are copyable with a single click. Each topic also surfaces 3 Gemini-generated
article ideas as writing prompts.
</p>
</div>
</div>
<div class="step">
<div class="step-num">6</div>
<div class="step-body">
<h3>Voice Mock Interview <code>/plan/[id]/interview</code></h3>
<p>
The capstone feature. Backend calls Gemini to generate 8 technical interview questions based on all topics
covered. It then creates an ElevenLabs agent named "Alex" — a strict senior technical interviewer — with
those questions injected in order. Alex asks questions one at a time, acknowledges without hinting
correctness, and ends with the literal sentinel string <code>INTERVIEW_COMPLETE</code>.
</p>
<p>
The frontend hook (<code>useElevenLabsConversation</code>) watches for this sentinel. When detected, it fires
<code>onInterviewComplete</code> with the full conversation transcript, which is POSTed to Gemini for holistic
evaluation. Result: <strong>overall score (0–100), letter grade, summary, 3 strengths, 3 improvement areas,
and per-question scores with assessments</strong>. A live waveform animation shows when Alex is speaking.
</p>
</div>
</div>
</div>
<hr>
<!-- ── ARCHITECTURE ── -->
<h2>Technical Architecture</h2>
<div class="table-wrap">
<table class="arch-table">
<thead>
<tr>
<th>Layer</th>
<th>Stack</th>
</tr>
</thead>
<tbody>
<tr>
<td>Frontend</td>
<td>Next.js 14 App Router, TypeScript, Tailwind CSS, Zustand, Axios, <code>@11labs/react</code>, <code>react-markdown</code></td>
</tr>
<tr>
<td>Backend</td>
<td>FastAPI (async), SQLAlchemy (async), Pydantic, Alembic</td>
</tr>
<tr>
<td>Database</td>
<td>PostgreSQL via Nile DB (PgBouncer transaction-mode, <code>NullPool</code> required)</td>
</tr>
<tr>
<td>Auth</td>
<td>Firebase Admin SDK → backend HS256 JWT exchange</td>
</tr>
<tr>
<td>AI — Content</td>
<td>Gemini 2.5 Flash (plan generation, topic content, article refinement, interview Q gen, transcript evaluation)</td>
</tr>
<tr>
<td>AI — Voice</td>
<td>ElevenLabs Conversational AI API (ephemeral agents per session, signed WebSocket URLs)</td>
</tr>
<tr>
<td>Deployment</td>
<td>Vercel (frontend), custom host with <code>RUN_MIGRATIONS=true</code> Alembic startup (backend)</td>
</tr>
</tbody>
</table>
</div>
<div class="note">
<strong>No connection pooling</strong> — by design. Nile DB uses PgBouncer in transaction mode, which is
incompatible with persistent connection pools, so <code>NullPool</code> is hardcoded in <code>database.py</code>.
</div>
<div class="note">
<strong>ElevenLabs agents are stateless</strong> — a new agent is created for every session and never reused.
The backend POSTs to the Agents API, gets a signed WebSocket URL, and hands it to the frontend. The frontend
owns the WebSocket lifecycle.
</div>
<div class="note">
<strong>Gemini fallback</strong> — every Gemini call has a rich mock fallback that produces realistic-looking
data, so the app is fully functional without API keys during development.
</div>
<hr>
<!-- ── DATA MODEL ── -->
<h2>Data Model</h2>
<div class="data-model">
<span class="dm-entity">User</span> <span class="dm-note">(Firebase UID)</span>
<span class="dm-arrow">└──</span> <span class="dm-entity">Plan</span> <span class="dm-note">(topic, duration, status: active | complete)</span>
<span class="dm-arrow">└──</span> <span class="dm-entity">PlanDay</span> <span class="dm-note">(day_number, title, is_complete)</span>
<span class="dm-arrow">└──</span> <span class="dm-entity">Topic</span> <span class="dm-note">(title, content [lazy-generated], article_ideas JSON, is_complete)</span>
<span class="dm-arrow">└──</span> <span class="dm-entity">Article</span> <span class="dm-note">(raw_text, refined_markdown, twitter_thread)</span>
<span class="dm-arrow">└──</span> <span class="dm-entity">Interview</span> <span class="dm-note">(plan_id, score, feedback JSON, questions JSON, answers JSON)</span>
</div>
<hr>
<!-- ── DESIGN ── -->
<h2>Design Language</h2>
<p>
The UI is a high-contrast dark theme with an indigo/violet accent palette. The brand identity uses a custom SVG
logo mark — a stylized "P" shape with ascending bar-chart elements — rendered with a <code>useId</code>-based
gradient to ensure unique SVG IDs across multiple instances on the same page.
</p>
<div class="design-grid">
<div class="design-card">
<div class="swatch" style="background:#080c14;border:1px solid #1e2d45;"></div>
<h4>Background</h4>
<p><code>#080c14</code> — near-black with a cold blue tint</p>
</div>
<div class="design-card">
<div class="swatch" style="background:linear-gradient(135deg,#6366f1,#7c3aed);"></div>
<h4>Primary Accent</h4>
<p>Indigo → Violet gradient for CTAs, active states, and glows</p>
</div>
<div class="design-card">
<div class="swatch" style="background:#0f1623;border:1px solid #1e2d45;"></div>
<h4>Surface</h4>
<p><code>#0f1623</code> cards with <code>#1e2d45</code> borders</p>
</div>
<div class="design-card">
<div class="swatch" style="background:radial-gradient(circle,rgba(99,102,241,0.18) 0%,transparent 70%);"></div>
<h4>Interactive States</h4>
<p>Subtle ring/glow effects — no heavy box shadows</p>
</div>
</div>
<p style="margin-top:20px;">
The landing page features a scrolling marquee of feature names, a step-by-step how-it-works section, and a
feature grid with icon cards. Auth pages display a consent notice. All pages carry Open Graph and Twitter Card
meta tags for link previews.
</p>
</main>
<footer>
<p>PrepStudio · Next.js 14 + FastAPI + Gemini + ElevenLabs</p>
</footer>
</body>
</html>