How shivtejg236/nemoforge works
Purpose and Entry Points
NemoForge is an AI-assisted web-research platform: it browses a requested target, extracts cleaned page content, and asks NVIDIA’s Llama model to answer the user’s prompt from that content. The backend process starts at backend/src/index.ts; the React SPA starts at frontend/src/main.tsx and composes its application shell in frontend/src/App.tsx. Local startup is automated by scripts/launch.sh.
Frontend Interaction Layer
The frontend is a Vite/React application with Zustand client state. It provides agent creation, live execution visibility, stored-result exploration, and settings through:
• frontend/src/pages/AgentBuilder.tsx
• frontend/src/pages/ResultsExplorer.tsx
• frontend/src/store/useStore.ts
It calls the backend through configured REST and WebSocket endpoints in frontend/src/config.ts. The key real-time UI boundary is the backend’s stream of execution logs and base64 browser screenshots.
HTTP, Authentication, and Session Boundary
The Node backend combines Express REST routes with a WebSocket server. Authentication is JWT-based middleware, separating protected agent/session operations from login/token issuance:
• backend/src/index.ts
• backend/src/routes/auth.ts
• backend/src/middleware/auth.ts
The REST/API layer accepts work requests and exposes persisted agent data; WebSockets deliver in-progress browser-agent events rather than requiring polling.
Agent Orchestration Pipeline
backend/src/agent/orchestrator.ts is the primary workflow coordinator. It receives the user prompt and target, emits lifecycle/log/screenshot events, invokes browser execution, converts the page to cleaned DOM text, and sends that text plus the original prompt to NVIDIA NIM. Its final Markdown analysis becomes the completed result.
The pipeline deliberately separates web acquisition from AI interpretation: browser automation determines what page data is collected; the LLM interprets already-collected DOM context instead of driving brittle selector logic.
Asynchronous Execution
Agent runs are queued and executed by a BullMQ-based worker layer:
• backend/src/agent/queue.ts
• backend/src/agent/worker.ts
• backend/src/agent/orchestrator.ts
This boundary keeps potentially long browser/LLM work outside the request path and enables queued status transitions and live event broadcasting. Redis is implied by BullMQ as material queue infrastructure, although no Redis deployment artifact is present in the tree.
Browser Acquisition and Stealth
Browser setup is isolated in backend/src/agent/stealth.ts, which selects among local Chromium modes and Bright Data’s remote Scraping Browser WebSocket endpoint. Ghost Cursor supplies human-like Bézier mouse behavior during Puppeteer-driven navigation. External web targets are therefore accessed through either local Chrome or Bright Data’s residential/anti-bot browser infrastructure, not directly by the frontend.
Persistence and Deployment
SQLite persistence stores session history, logs, and results through:
• backend/src/db/database.ts
• backend/nemoforge.sqlite-wal
Runtime configuration includes the database path, JWT secret, NVIDIA NIM key, and Bright Data endpoints via .env.example. The intended production split is Docker/Render for the backend (backend/Dockerfile, render.yaml) and Vercel for the frontend (frontend/vercel.json). NVIDIA NIM’s chat-completions API and Bright Data’s browser/proxy services are the central external dependencies.
Main entry points: index.ts Express + WebSocket server · orchestrator.ts Research orchestrator · App.tsx Application shell · queue.ts Run queue
Components 22
React frontend
- SPA entry
frontend/src/main.tsx - Application shell
frontend/src/App.tsx - Agent Builder · Creates browser research requests.
frontend/src/pages/AgentBuilder.tsx - Results Explorer · Explores stored completed results.
frontend/src/pages/ResultsExplorer.tsx - Client state
frontend/src/store/useStore.ts - API endpoint config · Defines REST and WebSocket endpoints.
frontend/src/config.ts - Frontend deployment
frontend/vercel.json
Backend runtime
- Express + WebSocket server · Serves REST APIs and broadcasts live agent events.
backend/src/index.ts - Login and token routes
backend/src/routes/auth.ts - JWT protection · Guards agent and session operations.
backend/src/middleware/auth.ts - Session and result store · Persists history, logs, and results.
backend/src/db/database.ts - SQLite WAL
backend/nemoforge.sqlite-wal - Backend deployment
backend/Dockerfile
Agent execution
- Run queue · Moves long-running work out of request handling.
backend/src/agent/queue.ts - Queue worker
backend/src/agent/worker.ts - Research orchestrator · Coordinates acquisition, DOM cleaning, AI analysis, and lifecycle events.
backend/src/agent/orchestrator.ts - Browser acquisition · Uses local Chromium or Bright Data remote browser with human-like cursor behavior.
backend/src/agent/stealth.ts
Infrastructure & services
- Redis · BullMQ backing store implied by the worker layer.
- Bright Data browser · Provides remote residential anti-bot browser access.
- Target websites
- NVIDIA NIM · Produces Markdown analysis from prompt and cleaned DOM context.
Other components
- Local launcher · Starts the local frontend and backend.
scripts/launch.sh
Connections 24
- Local launcher → SPA entry: starts
- Local launcher → Express + WebSocket server: starts
- SPA entry → Application shell: renders
- Application shell → Agent Builder: hosts
- Application shell → Results Explorer: hosts
- Agent Builder → Client state: updates
- Results Explorer → Client state: reads
- API endpoint config → Express + WebSocket server: REST + WebSocket · Sends requests and receives logs and screenshots.
- Express + WebSocket server → Login and token routes: serves
- Express + WebSocket server → JWT protection: applies
- JWT protection → Run queue: authorizes runs
- Express + WebSocket server → Session and result store: reads and writes
- Run queue → Redis: uses
- Run queue → Queue worker: dispatches jobs
- Queue worker → Research orchestrator: executes
- Research orchestrator → Browser acquisition: acquires page
- Browser acquisition → Target websites: navigates
- Browser acquisition → Bright Data browser: remote mode
- Research orchestrator → NVIDIA NIM: prompt + cleaned DOM
- Research orchestrator → Session and result store: persists logs and result
- Research orchestrator → Express + WebSocket server: live events · Emits lifecycle logs and screenshots.
- Session and result store → SQLite WAL: journals to
- Backend deployment → Express + WebSocket server: packages
- Frontend deployment → SPA entry: deploys