This repository contains a React frontend (Vite + Tailwind) and a small Node/Express proxy to securely call the Gemini API.
Structure
/- React app (Vite) — frontend/gemini-proxy- Node/Express backend proxy that forwards client requests to the Gemini API
Quick local run (frontend)
-
cd into the frontend and install dependencies:
cd E:/aita-pro npm install
-
Start the dev server:
npm run dev
Quick local run (proxy)
-
cd into the proxy folder and install dependencies:
cd E:/aita-pro/gemini-proxy npm install
-
Create a
.envfile with your Gemini key:GEMINI_API_KEY=your_key_here
-
Start the proxy:
npm start
Deployment notes (Render)
-
Option A: Deploy the
gemini-proxyfolder as a service using the "Deploy from a subdirectory" option in Render. Set the start command to:cd gemini-proxy && npm install && npm start
Render (detailed)
-
Create a new Web Service in Render and connect your GitHub repo
waymbers/AITA. -
In the Service settings set:
- Branch:
main - Root Directory:
gemini-proxy(important) - Build Command:
npm install - Start Command:
npm start - Environment: set
GEMINI_API_KEYto your Gemini secret (do NOT commit this to GitHub) - Port: leave default (Render will set PORT env var); the proxy reads
process.env.PORTautomatically.
- Branch:
-
Deploy. If you prefer not to use Root Directory, set these instead:
- Build Command:
cd gemini-proxy && npm install - Start Command:
cd gemini-proxy && npm start
- Build Command:
-
Once deployed, note the service URL (e.g.
https://<your-service>.onrender.com). Use this in the frontend production env:VITE_GEMINI_PROXY=https://.onrender.com/api/gemini
If you enabled
PROXY_SECRETon the proxy (recommended), the frontend must send the same secret in the headerx-proxy-key. Set the frontend build environment variable to:VITE_PROXY_KEY=<your-proxy-secret>Do NOT commit
VITE_PROXY_KEYto git; set it only in your hosting provider's environment configuration (e.g. Vercel / Netlify / Render).
Troubleshooting
-
If Render logs show
MODULE_NOT_FOUND, it means Render rannpm startin the wrong directory ornode_modulesweren't installed in thegemini-proxyfolder. Use the Root Directory option or thecd gemini-proxy && ...commands above. -
If you see
Missing GEMINI_API_KEYerrors, confirm the environment variable is set in Render. -
Option B: Deploy the
gemini-proxyas its own repository (recommended) and set the start command tonpm install && npm start.
Security
- Never store API keys in the frontend. Use the proxy to keep secrets server-side.
If you want, I can add a small README inside gemini-proxy with exact start commands and a Render-ready start script.