Skip to content

backend jairam

JAIRAM HIJHMALA requested to merge feature/backend-jairam into main

Core Backend Architecture Your backend is built using Node.js combined with TypeScript, running on the Express framework. Instead of serving just an API, it acts as a unified server that handles both your backend logic and serves your built React frontend.

Key Backend Tasks

  1. Google Gemini AI Integration Library Used: @google/genai

Function: The backend securely connects to Google's Gemini AI models. It accepts input requests from your React frontend (like user grievance submissions), processes or structures them using AI, and passes back the AI-generated analysis or response.

Security: It keeps your GEMINI_API_KEY hidden on the server so users cannot steal it from the browser.

  1. Serving the React Frontend Integration: Look at your package.json build script: vite build && esbuild server.ts...

Function: When the project builds, Vite turns your React app into static files inside a dist/ folder. Your Express server is configured to serve these static files, meaning when a user visits your Render link, your backend server is what actually delivers the website to their browser.

  1. Environment Variable Configuration Library Used: dotenv

Function: It reads sensitive configuration values directly from the server's platform environment (like Render's Environment Variables panel). It looks for:

GEMINI_API_KEY: For AI functionality.

GOOGLE_MAPS_PLATFORM_KEY: For mapping functionality.

PORT: Dynamically assigned by Render (usually defaults to port 10000 or whatever port the platform assigns).

Merge request reports

Loading