chaidocs
git-wiki

git-wiki-project

Suraj Kumar Jha 11 pages 2 min read Updated Sep 11, 2026
On this page
  1. AI Code Assistant Architecture
  2. Chapter 0: Project Foundation
  3. Chapter 1: Express Server & Job Store
  4. Chapter 2: Why Inngest Background Jobs?
  5. Chapter 2: Inngest Event System
  6. Chapter 3: Fetching & Chunking Code
  7. Chapter 3: Saving Vectors to Pinecone
  8. Chapter 3: Indexing Flow & Polling
  9. Chapter 4: Smart Code Search (RAG)
  10. Chapter 4: Chat API & Inngest Runner
  11. Master Build Roadmap

AI Code Assistant Architecture

01 A diagram showing User -> Express API -> Instant Job ID, while Inngest runs heavy indexing to Pinecone in the background.
Notes
Let users chat with any GitHub codebase like asking questions on ChatGPT. Express handles instant API requests so the app never freezes. Inngest processes heavy file indexing in the background. Pinecone stores code snippets as vectors for quick semantic search.

Chapter 0: Project Foundation

02 A project folder structure showing a locked .env file and index.js booting on port 3000.
Notes
Initialize modern Node.js using 'type: module' for clean ES imports. Use 'dotenv' to protect API keys (OpenAI, Pinecone, GitHub) like your UPI PIN. Add 'nodemon' so the server restarts automatically whenever code changes. Verify setup by starting the server and checking console output.

Chapter 1: Express Server & Job Store

03 An Express server issuing a status card displaying 'Job ID: #101 | Status: Queued'.
Notes
Set up Express with CORS and JSON body parsers. Create a /health check route to confirm the server is running. Use an in-memory jobStore to track task states: queued, running, completed. Works like a digital token counter at Haldiram's while your order is prepared.

Chapter 2: Why Inngest Background Jobs?

04 A fast track delivering a quick 202 response to user, while a conveyor belt processes background tasks.
Notes
Reading hundreds of code files takes minutes; HTTP requests would time out. Like ordering on Zepto: you get instant order confirmation instead of waiting at the warehouse. Express returns '202 Accepted' with a jobId immediately. Inngest handles the long-running task and retries automatically on errors.

Chapter 2: Inngest Event System

05 A 3-step pipeline with checkmarks on Step 1 (Fetch) and Step 2 (Chunk), currently running Step 3 (Save).
Notes
Express emits an event like 'repo/index.requested'. Inngest Dev Server catches the event and triggers registered step functions. Each 'step.run()' saves progress — if step 3 fails, steps 1 and 2 won't re-run. Connects locally via webhook at /api/inngest.

Chapter 3: Fetching & Chunking Code

06 A GitHub source file neatly sliced into overlapping cards tagged with metadata.
Notes
Octokit scans the GitHub repo tree and downloads up to 200 code files. Skips junk like node_modules and keeps relevant files (.js, .py, .md). LangChain splits big files into 1000-character chunks. 150-character overlap prevents code logic from being cut in half mid-function.

Chapter 3: Saving Vectors to Pinecone

07 3D vector database grid showing isolated partitions for different repository namespaces.
Notes
Converts code chunks into 1536-dimension embeddings using OpenAI. Upserts vectors into Pinecone under dedicated repo namespaces. Namespace isolation ensures 'swiggy/cart' code never mixes with 'zomato/cart'. Once saved, updates jobStore status to 'completed'.

Chapter 3: Indexing Flow & Polling

08 A polling status bar moving from Queued (0%) to Processing to Complete (45 files, 180 chunks).
Notes
POST /api/index triggers the indexing workflow and returns a jobId. Client polls GET /api/index/:jobId just like checking IRCTC Tatkal PNR status. Job status transitions from 'queued' to 'running' to 'completed'. Returns total file count and chunk count upon completion.

Chapter 4: Smart Code Search (RAG)

09 User question matching top Pinecone code chunks, feeding into OpenAI to output answer + source citations.
Notes
User asks: 'How does payment checkout work in this repo?'. Pinecone performs similarity search and fetches top 5 relevant code snippets. GPT-4o-mini receives only these 5 snippets as context. LLM provides a concise answer along with exact source file paths.

Chapter 4: Chat API & Inngest Runner

10 A chat bubble showing AI answer with clickable badge chips showing source file paths.
Notes
POST /api/chat triggers 'chat/question.requested' in Inngest. Returns a jobId immediately so the UI stays super responsive. Client polls GET /api/chat/:jobId to receive the final answer and sources. Note: The repo must be indexed first, or search context will be empty.

Master Build Roadmap

11 A 4-milestone roadmap showing progressive green ticks from base server to fully working AI codebase chat.
Notes
Step 1: Express setup + /health route check. Step 2: Connect Inngest dev server & test hello-world event. Step 3: Build GitHub fetch, chunking, and Pinecone vector indexing. Step 4: Build RAG chat pipeline with OpenAI and source tracking.