{"id":25566221,"url":"https://github.com/basitjawad/geminiai","last_synced_at":"2026-01-28T10:03:39.694Z","repository":{"id":277670753,"uuid":"933152914","full_name":"BasitJawad/GeminiAI","owner":"BasitJawad","description":"GeminiSDKUsage I created this project for learning purpose like how to integrate Google Gemini AI SDK.","archived":false,"fork":false,"pushed_at":"2025-02-15T11:11:46.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-25T01:43:57.300Z","etag":null,"topics":["ai","chatgpt","expressjs","gemini-api","reactjs","web"],"latest_commit_sha":null,"homepage":"https://basitjawad.github.io/GeminiAI/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BasitJawad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-15T09:21:58.000Z","updated_at":"2025-02-15T11:23:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac565bd4-0a49-4727-97c1-13cec0d4fcfb","html_url":"https://github.com/BasitJawad/GeminiAI","commit_stats":null,"previous_names":["basitjawad/geminiai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BasitJawad/GeminiAI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BasitJawad%2FGeminiAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BasitJawad%2FGeminiAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BasitJawad%2FGeminiAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BasitJawad%2FGeminiAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BasitJawad","download_url":"https://codeload.github.com/BasitJawad/GeminiAI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BasitJawad%2FGeminiAI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28844011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T07:39:25.367Z","status":"ssl_error","status_checked_at":"2026-01-28T07:39:24.487Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","chatgpt","expressjs","gemini-api","reactjs","web"],"created_at":"2025-02-20T22:28:46.091Z","updated_at":"2026-01-28T10:03:39.684Z","avatar_url":"https://github.com/BasitJawad.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# GeminiAI\n\nGeminiAI is a simple web application that interacts with Google's Generative AI to answer user questions. This project consists of a **backend** built with **Node.js and Express** and a **frontend** using **React.js and Material-UI**.\n\n\u003cimg src=\"https://github.com/user-attachments/assets/708cba51-3e38-4bc9-9afa-b2b518cf6eaa\" width=\"200\" /\u003e\n\nLink to Github Profile: \u003ca href=\"https://github.com/BasitJawad/GeminiSDKUsage\"\u003eGithub\u003c/a\u003e\n\n[![GitHub Repo stars](https://img.shields.io/github/stars/BasitJawad/GeminiAI?style=social)](https://github.com/BasitJawad/GeminiAI/stargazers)\n---\n\n## 📌 Features\n- **Ask AI-powered questions**\n- **Styled with Material-UI**\n- **Backend with Express.js**\n- **Frontend with React.js**\n- **Supports Markdown Formatting**\n\n---\n\n## 🛠️ Installation\n\n### 1️⃣ Clone the Repository\n```sh\n$ git clone https://github.com/BasitJawad/GeminiSDKUsage\n$ cd GeminiSDKUsage\n```\n\n### 2️⃣ Install Dependencies\n#### Backend:\n```sh\n$ cd backend\n$ npm install\n```\n#### Frontend:\n```sh\n$ cd frontend\n$ npm install\n```\n\n---\n\n## 🚀 Running the Application\n\n### Start Backend Server:\n```sh\n$ cd backend\n$ node index.js\n```\n\n### Start Frontend:\n```sh\n$ cd frontend\n$ npm start\n```\n\nYour application will now be running locally.\n\n---\n\n## 📌 Backend Code (Express.js)\n\n```javascript\nconst express = require('express');\nconst messageRoute = express.Router();\nrequire(\"dotenv\").config()\nconst { GoogleGenerativeAI } = require('@google/generative-ai');\n\nconst apiKey = process.env.TestKey1;\nconst genAI = new GoogleGenerativeAI(apiKey);\nconst model = genAI.getGenerativeModel({ model: 'gemini-1.5-flash' });\n\nconst generationConfig = {\n  temperature: 1,\n  topP: 0.95,\n  topK: 64,\n  maxOutputTokens: 8192,\n  responseMimeType: 'text/plain',\n};\n\nmessageRoute.use(express.json());\n\nmessageRoute.post('/api/Question', (req, res) =\u003e {\n  const { Question } = req.body;\n  const chatSession = model.startChat({ generationConfig, history: [] });\n\n  async function Datasend() {\n    try {\n      const result = await chatSession.sendMessage(Question + \" Also write the question at the top too\");\n      res.json({ response: result.response });\n    } catch (error) {\n      console.error('Error in Datasend:', error);\n      res.status(500).send('Error in processing the request');\n    }\n  }\n  Datasend();\n});\n\nmodule.exports = messageRoute;\n```\n\n---\n\n## 📌 Frontend Code (React.js)\n{% raw %}\n```\nimport React, { useState } from 'react';\nimport TextField from '@mui/material/TextField';\nimport Button from '@mui/material/Button';\nimport axios from 'axios';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport { SnackbarProvider, enqueueSnackbar } from 'notistack';\nimport Skeleton from '@mui/material/Skeleton';\nimport Box from '@mui/material/Box';\n\nconst App = () =\u003e {\n  const [Question, setQuestion] = useState('');\n  const [Output, setOutput] = useState('');\n  const [loading, setLoading] = useState(false);\n\n  const SendToBackend = (e) =\u003e {\n    e.preventDefault();\n    setOutput(\"\");\n    setQuestion('');\n    setLoading(true);\n    axios\n      .post('/api/Question', { Question })\n      .then((res) =\u003e {\n        setOutput(res.data.response.candidates[0].content.parts[0].text);\n        setLoading(false);\n      })\n      .catch((err) =\u003e {\n        console.log(err.message);\n        setLoading(false);\n      });\n  };\n\n  return (\n    \u003c\u003e\n      \u003cSnackbarProvider /\u003e\n      \u003cdiv className=\"wrapper bg-black w-screen h-screen flex justify-between flex-col items-center\"\u003e\n        \u003cdiv className=\"entry flex justify-center items-center\"\u003e\n          \u003cform onSubmit={SendToBackend}\u003e\n            \u003cTextField\n              label=\"What do you want to learn about?\"\n              multiline\n              rows={3}\n              value={Question}\n              onChange={(e) =\u003e setQuestion(e.target.value)}\n              InputProps={{ style: { color: 'white' } }} \n              InputLabelProps={{ style: { color: 'gray' } }}\n            /\u003e\n            \u003cButton variant=\"contained\" type=\"submit\"\u003eSubmit\u003c/Button\u003e\n          \u003c/form\u003e\n        \u003c/div\u003e\n\n        \u003cdiv className=\"output relative flex overflow-y-auto\"\u003e\n          {Output \u0026\u0026 \u003cButton variant=\"outlined\" onClick={() =\u003e navigator.clipboard.writeText(Output)}\u003eCopy\u003c/Button\u003e}\n          \u003cdiv className=\"para text-white relative overflow-y-auto p-10\"\u003e\n            {loading ? (\n              \u003cBox sx={{ width: 900 }}\u003e\n                \u003cSkeleton variant=\"text\" sx={{ fontSize: '1rem' }} animation=\"wave\" /\u003e\n              \u003c/Box\u003e\n            ) : (\n              \u003cReactMarkdown \n                components={{ \n                  code: ({ node, inline, className, children, ...props }) =\u003e \n                    !inline ? (\n                      \u003cpre\u003e\u003ccode {...props}\u003e{children}\u003c/code\u003e\u003c/pre\u003e\n                    ) : (\n                      \u003ccode {...props}\u003e{children}\u003c/code\u003e\n                    )\n                }} \n                remarkPlugins={[[remarkGfm, { singleTilde: false }]]}\n              \u003e\n                {Output}\n              \u003c/ReactMarkdown\u003e\n            )}\n          \u003c/div\u003e\n        \u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/\u003e\n  );\n};\n\nexport default App;\n```\n---\n{% endraw %}\n\n## 🙌 Thanks for Reading!\n\nThank you for checking out GeminiAI! If you find this project helpful, feel free to ⭐ star the repository on GitHub. Contributions, feedback, and suggestions are always welcome!\n\n🚀 Happy Coding! 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasitjawad%2Fgeminiai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasitjawad%2Fgeminiai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasitjawad%2Fgeminiai/lists"}