How b-harisanker/app_proj works
Purpose and Entry Points
This is a small Node.js application for AI-assisted image/signal analysis, with browser-facing pages and Gemini-oriented integration modules. The runtime entry point is server.js; primary UI entry points are public/index.html and public/image-detector.html.
HTTP Application Boundary
server.js is the backend boundary between browser clients, local application logic, and any external AI service calls. It likely serves the static public/ assets and exposes server-side operations needed to keep AI credentials or API interactions out of the browser.
Browser Workflows
The repository contains two distinct browser surfaces:
• public/index.html: main application interface.
• public/image-detector.html: specialized image-detection/upload workflow.
These pages are the user-input boundary and should pass requests to the backend rather than directly owning model-service credentials.
Gemini / Vision Integration
AI-provider-specific behavior is separated into:
• Gemini.js
• gemini-vision.js
Gemini.js likely handles general Gemini prompting or text/signal interpretation, while gemini-vision.js specializes requests involving image content. This separation is an important provider-adapter boundary: UI and server orchestration should depend on these modules rather than embed provider request formats.
Signal Classification and Heuristics
Heuristics.js represents deterministic, local decision logic that can complement or constrain model output. It is the likely place for rules, thresholds, scoring, or post-processing used to turn raw AI responses and supplied signals into application-level results.
Local Data Layer
data/ai_signals.json is the repository’s embedded signal dataset. It likely supplies known indicators, labels, examples, or reference metadata to heuristic and/or model-driven analysis. This is a local-data boundary: consumers should treat it as source data rather than hard-code its contents into UI or AI adapters.
Primary Flow
The expected control flow is:
1. A user interacts with public/index.html or uploads/selects imagery through public/image-detector.html.
2. server.js receives and validates the request.
3. The server routes text/signal analysis through Gemini.js, image analysis through gemini-vision.js, and applies local interpretation via Heuristics.js.
4. Analysis may reference data/ai_signals.json.
5. The server returns a normalized result for browser rendering.
Runtime and External Dependencies
The project is JavaScript/Node-based, defined by package.json and pinned through package-lock.json. Its material external dependency is the Gemini AI ecosystem implied by Gemini.js and gemini-vision.js; provider access, authentication, request limits, and response failures should remain isolated behind those modules and orchestrated by server.js.
Main entry points: server.js HTTP server · index.html Main interface · image-detector.html Image detector · Heuristics.js Signal heuristics
Components 10
Browser UI
- Main interface
public/index.html - Image detector · Image upload and detection workflow.
public/image-detector.html
Node Backend
- HTTP server · Serves browser assets and orchestrates analysis.
server.js - Signal heuristics · Converts analysis inputs and outputs into application results.
Heuristics.js - AI signals dataset · Embedded signal indicators and reference metadata.
data/ai_signals.json
AI Integration
- Gemini adapter · General text and signal interpretation integration.
Gemini.js - Gemini Vision adapter · Image-content analysis integration.
gemini-vision.js - Gemini AI service
Other components
- Node dependencies
package.json - Locked dependencies
package-lock.json
Connections 12
- Main interface → HTTP server: analysis request
- Image detector → HTTP server: image request
- HTTP server → Main interface: normalized result
- HTTP server → Image detector: normalized result
- HTTP server → Gemini adapter: text/signal analysis
- HTTP server → Gemini Vision adapter: image analysis
- HTTP server → Signal heuristics: local interpretation
- Signal heuristics → AI signals dataset: reference signals
- Gemini adapter → Gemini AI service: provider request
- Gemini Vision adapter → Gemini AI service: vision request
- Node dependencies → HTTP server: runtime definition
- Locked dependencies → Node dependencies: pins dependencies