Community Hub — Engineering Collective Landing Site
Scroll-driven landing page for an engineering collective — full-bleed HLS video hero, pinned-scroll panels, a live client-side credential builder, and a RAG chat assistant over a local knowledge base.
Domain Knowledge
What problem this project solves
The site treats marketing as a performance problem: no content above the fold waits on a video, every scroll effect has a non-jacking fallback for mobile, and the AI assistant's retrieval index lives in module memory to avoid repeated embedding calls.
Architecture
How the system is structured
A single Next.js App Router page composed of independent sections. The chat widget uses a route handler that embeds the local knowledge corpus once per process, stores vectors in module memory, embeds each question as a RETRIEVAL_QUERY, ranks by cosine similarity, and passes the top 4 chunks as model context. The Gemini key is read only in the route handler and never reaches the browser.
Data Model
Schema design and data flow
A local knowledge corpus in src/lib/knowledge.ts — short, single-topic chunks — plus environment config for the Gemini API key and model name.
Key Challenges
Hardest problems encountered
Balancing heavy scroll animation with mobile performance required fallbacks for every effect. The live credential builder had to render identically server and client. The RAG index needed to stay fast and memory-bounded for the life of the process.
Scaling Strategy
How the system grows
Static rendering with dynamic chat only — the marketing content is served from the edge while the assistant route handler keeps a warm embedding index in memory.
Security
Defense-in-depth approach
The Gemini key is server-only and never prefixed with NEXT_PUBLIC_. All assistant traffic flows through the route handler, keeping the API key out of the browser bundle.
Failure Handling
Resilience and recovery
Everything except the chat widget runs without a key; the widget returns a 500 and shows an inline error when the key is missing.
Observability
Monitoring and debugging
No custom telemetry — relies on platform analytics for the marketing page and error boundaries for the interactive sections.
Trade-offs
Engineering decisions and alternatives
HLS video hero over a static image for visual impact with progressive loading. Server-side RAG over client-side model calls to protect the API key. Module-memory vectors over a database for zero-infrastructure retrieval.
Architecture Decisions
Key choices and what was rejected
Senior-Level Topics
Concepts this project explores