{"id":28221610,"url":"https://github.com/201harsh/ai-cg","last_synced_at":"2025-06-10T16:30:42.692Z","repository":{"id":288702328,"uuid":"968816560","full_name":"201Harsh/AI-CG","owner":"201Harsh","description":"End AI-CG","archived":false,"fork":false,"pushed_at":"2025-05-02T20:04:02.000Z","size":91,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-18T06:08:47.707Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://endaicodegen.onrender.com/","language":"JavaScript","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/201Harsh.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-04-18T19:39:02.000Z","updated_at":"2025-05-02T20:04:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"cf011147-b0f8-447e-b38a-658af15798c5","html_url":"https://github.com/201Harsh/AI-CG","commit_stats":null,"previous_names":["201harsh/ai-cg"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/201Harsh%2FAI-CG","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/201Harsh%2FAI-CG/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/201Harsh%2FAI-CG/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/201Harsh%2FAI-CG/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/201Harsh","download_url":"https://codeload.github.com/201Harsh/AI-CG/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/201Harsh%2FAI-CG/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259109997,"owners_count":22806632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-05-18T06:08:45.880Z","updated_at":"2025-06-10T16:30:42.683Z","avatar_url":"https://github.com/201Harsh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 EndAI Code Generator\n\n**EndAI** is an intelligent and responsive web application that empowers developers to generate complete coding projects — including boilerplate code and detailed project descriptions — with a single prompt. It uses **Google Gemini AI** to generate production-ready code and markdown-based explanations, making it an ideal tool for developers, learners, and creators looking to kickstart new ideas quickly.\n\n---\n\n## 🌟 Key Features\n\n- ⚙️ **AI-Powered Generation**  \n  Instantly generate project code and accompanying markdown descriptions using the Google Gemini API.\n\n- 📁 **Project Management System**  \n  Seamlessly create, save, and switch between multiple projects in a user-friendly sidebar layout.\n\n- 📝 **Typing Animation Effect**  \n  Realistic typewriter animation enhances the experience when displaying newly generated content.\n\n- 🧠 **Smart Memory Handling**  \n  Previously saved projects load instantly without the typing animation, making the UX feel more efficient.\n\n- 💡 **Live Syntax Highlighting**  \n  Use of Prism.js ensures beautifully highlighted code blocks for better readability.\n\n- 📝 **Markdown Description Rendering**  \n  Descriptions are rendered using React Markdown for rich-text formatting and readability.\n\n- 📱 **Mobile Responsive**  \n  Fully responsive UI ensures smooth experience on both desktop and mobile devices.\n\n- 📋 **One-Click Copy Buttons**  \n  Instantly copy the code or description with a click for faster integration into your workflow.\n\n---\n\n## 🧰 Tech Stack\n\n| Category            | Technologies Used                          |\n|---------------------|--------------------------------------------|\n| **Frontend**        | React.js, Vite, Tailwind CSS               |\n| **AI Integration**  | Google Gemini API (free-tier support)      |\n| **Animations**      | Framer Motion                              |\n| **Code Highlighting** | Prism.js                                 |\n| **Markdown Renderer** | React Markdown                           |\n| **State Management** | React Context API \u0026 Hooks                 |\n\n---\n\n## 📁 Project Folder Structure\n\n\n---\n\n# 🔐 How Authentication Works Backend\n\nThis is the backend authentication system for the **EndAI Code Generator** app. It handles user registration, email OTP verification, secure login/logout, and token-based authentication using JWT. Built with **Node.js**, **Express**, and **MongoDB**, it ensures a smooth and secure authentication flow for developers.\n\n---\n\n## ⚙️ Features\n\n- 🔒 **User Registration** with email and password\n- 📧 **OTP Verification** via email before account activation\n- 🔑 **Secure Login** using JWT\n- 🚪 **Logout** with token/session invalidation\n- 🧠 **Password Hashing** with bcrypt\n- 🛡️ **Protected Routes** using auth middleware\n- 💌 **Email Sending** using Nodemailer\n- ⏱️ **OTP Expiry Handling**\n\n---\n\n## 🛠️ Tech Stack\n\n| Technology     | Description                    |\n|----------------|--------------------------------|\n| Node.js + Express | Web server and routing       |\n| MongoDB + Mongoose | Database and data modeling  |\n| bcryptjs       | Password hashing               |\n| jsonwebtoken   | JWT-based token auth           |\n| dotenv         | Manage environment variables   |\n| Nodemailer     | Email delivery for OTP         |\n\n---\n\n## 🧠 Authentication Flow\n\n### 1. 📝 Register User\n\n- **Endpoint**: `POST /api/auth/register`\n- **Payload**:\n  ```json\n  {\n    \"email\": \"harsh@example.com\",\n    \"password\": \"yourpassword\"\n  }\n  ```\n## ✅ Verify OTP\n **Endpoint: POST /api/auth/verify-otp**\n\n\n## 🔓 Login\n\n**Endpoint: POST /api/auth/login**\n\n\n## 🚪 Logout\n**Endpoint: POST /api/auth/logout (optional)**\n\nProcess:\n\nClears HTTP-only cookie (if using cookies)\n\nOr removes token client-side\n\n\n\n## 🔐 Environment Variables\nCreate a .env file in the root and add:\n\n```\n.env\nPORT=4000\nMONGO_URI = your_mongodb_connection_string\nJWT_SECRET = your_jwt_secret_key\nEMAIL_USER = your_email@example.com\nEMAIL_PASS = your_email_password_or_app_password\n```\n## 📁 Project Structure\n\n```bash\nendai-auth-backend/\n├── controllers/\n│   └── authController.js     # Handles register, verify, login, logout\n├── models/\n│   └── User.js               # Mongoose user schema\n├── routes/\n│   └── authRoutes.js         # Express routes for auth\n├── middleware/\n│   └── authMiddleware.js     # JWT token verification\n├── utils/\n│   └── sendOTP.js            # Nodemailer utility\n├── .env                      # Environment variables\n├── server.js                 # App entry point\n└── package.json              # Project metadata\n```\n\n## ▶️ Running the Server\n1. Clone the Repo\n```bash\ngit clone https://github.com/201Harsh/End-AI-CG.git\ncd Backend\n```\n## Install Dependencies\n```bash\nnpm install\n```\n## Configure .env\n```\nFill in the required values for MongoDB, JWT, and email.\n```\n\n## Start the Server\n```bash\nnpx nodemon or node server.js\nServer runs on http://localhost:4000\n```\n\n## 🔐 Securing Your API\n- Hash passwords with bcrypt (already implemented)\n\n- JWT tokens expire after 1h (customizable)\n\n- OTP expires after 5–10 minutes (can be extended)\n\n- Optional: Add rate limiting for OTP requests\n\n## 📬 Sending Emails (OTP)\n- Uses Nodemailer\n\n- Compatible with Gmail (use an App Password)\n\n- Can be swapped out for Mailgun, SendGrid, etc.\n\n## 🔧 Future Improvements\n- ✅ Add \"Resend OTP\" with cooldown\n\n- 🔐 Add password reset via email\n\n- 📊 Add user analytics and dashboard\n\n- 🌍 Host on Render/Heroku/Vercel backend\n\n---\n\n## 🧠 How It Works On Frontend\n\n### 1. 🚀 Creating a Project\n- Click the `+` button or \"Create New Project\".\n- Type a prompt describing the type of project/code you want.\n- Hit “Generate”.\n- The AI processes the request and generates:\n  - A syntax-highlighted code block.\n  - A markdown description.\n- Both are displayed with a typing animation.\n\n### 2. 📂 Navigating Projects\n- Each generated project is listed in a collapsible sidebar.\n- Click any saved project to quickly reload it (typing effect skipped for saved items).\n\n### 3. 📋 Copying Content\n- Buttons are provided to copy the code and markdown description to your clipboard instantly.\n\n---\n\n## 💡 Why Choose EndAI?\n\n- ⚡ Skip boilerplate and get straight to building.\n- 📚 Perfect for learning and exploring new coding patterns.\n- 🎨 Clean and minimal UI focused on productivity.\n- 🔁 Save and revisit your generated projects anytime.\n\n---\n\n## 🔧 Getting Started (Local Development)\n\nFollow these steps to set up the project locally:\n\n### 1. 📦 Clone the Repository\n\n```bash\ngit clone https://github.com/201Harsh/End-AI-CG.git\ncd Frontend\n```\n## 🔧 Install Dependencies\n\n``` bash \nnpm install \n```\n\n## 🔑 Configure Environment Variables\nCreate a .env file in the root directory and add your Google Gemini API key:\n\n```bash\nVITE_GEMINI_API_KEY=your_google_gemini_api_key\n```\n\nDon't have one? You can get a free API key from the Google AI Studio.\n\n## 🚀 Run the Development Server\n\n``` bash\nnpm run dev\n```\n- The app will be running at http://localhost:5173 (or whatever port Vite assigns).\n\n## 🏗️ Build for Production\n```bash\nnpm run build\n```\n## 🖼️ Screenshots\n\n**No screen shot Available**\n\n## 📦 Main Dependencies\n\n- React — Core UI framework\n\n- Tailwind CSS — Utility-first styling\n\n- Framer Motion — Smooth animations\n\n- Prism.js — Code syntax highlighting\n\n- React Markdown — Description rendering\n\n- Google Gemini API — AI generation engine\n\n## 🔐 Environment Variables\n\n- Variable\tDescription\nVITE_GEMINI_API_KEY\tYour Google Gemini API key\n\n\n## 🤝 Contributing\nContributions are welcome! Whether it's improving the UI, fixing bugs, or adding new features:\n\n- Fork the repository.\n\n- Create a new branch (git checkout -b feature-name).\n\n- Commit your changes (git commit -m 'add feature').\n\n- Push to the branch (git push origin feature-name).\n\n- Open a pull request.\n\n## 📃 License\n\n**This project is licensed under the MIT License.© 2025 Harsh**\n\n## 🌐 Live Demo\n - 🔗 Live Preview on\n - https://endaicodegen.onrender.com/\n\n ---\n\n**Made with ❤️ by Harsh**\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F201harsh%2Fai-cg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F201harsh%2Fai-cg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F201harsh%2Fai-cg/lists"}