Skip to chat
NEXUSback to chat

learn about me

Under the hood

First, who's behind it — then how it actually works. This site isn't a static résumé; it's a live application, and the chat can tell you the rest.

ST

Sai Teja

AI Engineer · RAG & Full-Stack

I build production RAG systems, agentic pipelines, and full-stack AI apps where retrieval, orchestration, and clean UX come together.

↓ and here's how it works

01

The request lifecycle

Every question runs this exact path. The eight-node strip is the real control flow of an async generator on the server — each node is a yield that streams one event to the browser the instant it happens. Two of those stages make genuine network calls.

Browserfetch() · reads the SSE streamPOST /api/chatSSE: stage → token → doneNEXT.JS ROUTE HANDLER · /api/chat · VERCEL SERVERLESSqueryembedsearchchunksreranksourcesassemblegenerateasync function* orchestrate(query) — each circle is one `yield`Gemini APItext-embedding-004Supabase Postgrespgvector cosine search↑ top-8 chunks + similarity scoresGemini 2.5 FlashgenerateContentStream()↑ tokens, streamed one at a timethe browser renders every event above as it arrives — nothing is precomputed or replayed
The strip inside the dashed boundary is a single async generator — its real control flow, not a decorative animation. At search it embeds the query and runs a cosine-similarity search; at generate it streams tokens from Gemini. Both round-trips are real, and their outputs are exactly what the on-screen confidence score and typing effect show.
02

Why admin edits can't leak

The admin dashboard talks to the database straight from the browser — there's no separate backend standing guard. The safety comes from where the permission check actually lives.

A COMMON PATTERN — NOT WHAT NEXUS DOESAdmin UIroute handler:if (!isAdmin) rejectDatabasetrusts the app⚠ only as safe as every route remembering this checkWHAT NEXUS ACTUALLY DOESAdmin UIsigned insupabase-js + JWTSupabase PostgresRLS policy: is_admin() reads the JWT — on every query✓ write allowed✗ rejected, unconditionally
The permission check isn't code a route has to remember to call — it's a policy Postgres itself evaluates on every query, so no code path can accidentally skip it.
03

Stack at a glance

Frontend
Next.js 16 (App Router), React 19, TypeScript
Styling / motion
Tailwind CSS v4, Framer Motion, React Three Fiber
Transport
Server-Sent Events over a Vercel serverless function
Generation
Gemini 2.5 Flash (streaming), swappable adapter
Retrieval
Gemini text-embedding-004 → pgvector cosine search
Database
Supabase Postgres, Row-Level Security, Auth, Storage
Ingestion
Standalone Python / FastAPI worker, idempotent chunk + embed
Deploy
Vercel + GitHub Actions CI, custom domain, PWA