PreBunk AI detects manipulative patterns in text and images using Gemini. This is a Vite + React + TypeScript app styled with Tailwind CSS v4.
- Prerequisites: Node.js 18+ and a Gemini API key
- Install dependencies:
npm install- Configure environment: create
.env.localand set your key. The build maps this value in vite.config.ts.
# .env.local
GEMINI_API_KEY=your_key_here- Run in development:
npm run dev- Build and preview production:
npm run build
npm run preview- The client references
process.env.API_KEYdefined in vite.config.ts. Client-only deployments can expose the key in bundled code. For production, prefer a backend proxy that calls Gemini server-side and returns JSON to the client. - Tailwind v4 is configured via postcss.config.js using
@tailwindcss/postcss, and index.css imports Tailwind via@import "tailwindcss";.
- Push the repo to your Git provider.
- Import the project in Vercel.
- Environment variable:
GEMINI_API_KEY(Production/Preview). - Build command:
npm run build - Output directory:
dist
If you enabled the secure proxy:
- The function is in api/analyze.ts and will read
process.env.GEMINI_API_KEYserver-side. - The client calls the proxy via services/geminiService.ts.
- Build:
npm run build - Publish/Output:
dist - Env var:
GEMINI_API_KEY
To hide your API key in production:
- Add a serverless function (e.g.,
api/analyze.tson Vercel) that readsprocess.env.GEMINI_API_KEYand calls@google/genai. - Update services/geminiService.ts to POST user input (text/image) to
/api/analyzeand use the JSON response.
I can scaffold this proxy and patch the service on request.
- Vite not found (
'vite' is not recognized'): runnpm installto restore dev dependencies, thennpm run build. - Windows EPERM unlink during
npm ci:- Close apps locking files; pause antivirus temporarily.
- Remove
node_modulesandpackage-lock.json. - Clear cache and reinstall:
Stop-Process -Name node -Force
Remove-Item -Recurse -Force node_modules
Remove-Item -Force package-lock.json
npm cache clean --force
npm install- Tailwind v4 PostCSS error: install
@tailwindcss/postcssand ensure postcss.config.js contains:
export default {
plugins: {
'@tailwindcss/postcss': {},
},
};- Chart container size warning: give the chart wrapper explicit dimensions. See components/RiskGauge.tsx.
npm run dev— start Vite dev servernpm run build— production build todistnpm run preview— serve the built app locally
- React 19, Vite 6, TypeScript
- Tailwind CSS v4
@google/genai(Gemini 3 Flash Preview)- Recharts
This contains everything you need to run your app locally.
View your app in AI Studio: https://ai.studio/apps/drive/1IionE69CxyZXezW2wHcjDam1u_XLBJ92
Prerequisites: Node.js
- Install dependencies:
npm install - Set the
GEMINI_API_KEYin .env.local to your Gemini API key - Run the app:
npm run dev
