A full-stack AI chat app inspired by Google Gemini, built using React for the frontend and Express.js for the backend.
This project demonstrates secure API handling, AI text generation, and a beautiful, real-time chat interface powered by Google's Generative AI.
π gemini-clone
Gemini-Clone/
β
βββ backend/ # Express.js server
β βββ server.js
β βββ package.json
β βββ .env # Store Gemini API key here
β βββ .gitignore
β
βββ frontend/ # React.js client
β βββ src/
β βββ public/
β βββ package.json
β βββ .gitignore
β
βββ README.md
- π€ AI Chat with Gemini API β Real-time responses using Googleβs Generative AI.
- π Secure Backend β API key is hidden using environment variables (
.envfile). - β‘ Fast Response Handling β Backend proxy ensures smooth and secure communication.
- π¬ Modern UI β React frontend styled to resemble Geminiβs sleek design.
- π§ Custom Safety Filters β Uses
HarmCategoryandHarmBlockThresholdto prevent unsafe responses.
| Layer | Technologies Used |
|---|---|
| Frontend | React.js, Fetch API, CSS |
| Backend | Node.js, Express.js |
| AI Model | Google Generative AI (Gemini 1.5 or 2.0) |
| Environment | dotenv |
| Security | CORS, Environment Variables |
| Deployment | Vercel (frontend), Render/Railway (backend) |
Follow these steps to set up locally π
### 1οΈβ£ Clone the repository
git clone https://github.com/18jayanth/Gemini-Clone.git
cd Gemini-Clone
Backend Setup
cd backend
npm install
Create a .env file inside backend/:
GEMINI_API_KEY=your_api_key_here
PORT=5000
Then run:
npm start
The backend runs on http://localhost:5000
3οΈβ£ Frontend Setup
cd ../frontend
npm install
npm start
The frontend runs on http://localhost:5500
4οΈβ£ Connect Frontend β Backend
In your frontendβs API call (e.g., generateImage.jsx or chat.js), set:
fetch("http://localhost:5000/api/chat", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ prompt }),
});π§ How It Works
User enters a prompt in the React frontend.
The frontend sends this prompt to the backend (/api/chat endpoint).
The Express backend securely forwards it to Gemini API using your hidden API key.
The Gemini model processes and returns the generated text.
The backend responds with the AIβs output, which is then displayed beautifully in the UI.
πΌοΈ Screenshots Feature Screenshot π¬ Chat Interface
π οΈ Environment Setup Notes
File Purpose
.env Stores API keys like GEMINI_API_KEY (
π§βπ» Add chat history with MongoDB
π€ Integrate voice input/output
π Dark mode toggle
π§ Multi-model switch (Gemini, GPT, Claude)
π± Mobile-responsive UI enhancements
π Acknowledgements
Google Generative AI
React
Express.js
Inspiration from Google Geminiβs interface
π¨βπ» Author
Jayanth π Machine Learning & Full Stack Enthusiast π Github