{"id":30655984,"url":"https://github.com/sohambhattacharjee2003/chatbot","last_synced_at":"2025-10-14T04:35:12.558Z","repository":{"id":312094850,"uuid":"1044942092","full_name":"SohamBhattacharjee2003/Chatbot","owner":"SohamBhattacharjee2003","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-28T14:09:34.000Z","size":9263,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-06T01:22:12.062Z","etag":null,"topics":["expressjs","imagekit","mongodb","openai","reactjs","stripe","tailwindcss"],"latest_commit_sha":null,"homepage":"https://chatbot-woad-iota.vercel.app/","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/SohamBhattacharjee2003.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-26T12:30:05.000Z","updated_at":"2025-08-28T14:09:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"8b25186f-67f7-4f0c-9145-43d505fe154b","html_url":"https://github.com/SohamBhattacharjee2003/Chatbot","commit_stats":null,"previous_names":["sohambhattacharjee2003/chatbot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SohamBhattacharjee2003/Chatbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SohamBhattacharjee2003%2FChatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SohamBhattacharjee2003%2FChatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SohamBhattacharjee2003%2FChatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SohamBhattacharjee2003%2FChatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SohamBhattacharjee2003","download_url":"https://codeload.github.com/SohamBhattacharjee2003/Chatbot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SohamBhattacharjee2003%2FChatbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017939,"owners_count":26086213,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["expressjs","imagekit","mongodb","openai","reactjs","stripe","tailwindcss"],"created_at":"2025-08-31T10:02:57.537Z","updated_at":"2025-10-14T04:35:12.553Z","avatar_url":"https://github.com/SohamBhattacharjee2003.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Chatbot — Text + Image Generation\n\n**Repository:** `SohamBhattacharjee2003/Chatbot`\n\n\n---\n\n## Short description (repo tagline)\n\nAI-powered chat application built with the MERN stack that generates both conversational text and images using OpenAI, stores/serves media with ImageKit, and supports paid features through Stripe.\n\n---\n\n## Table of Contents\n\n* [Project Overview](#project-overview)\n* [Key Features](#key-features)\n* [Tech Stack](#tech-stack)\n* [Architecture \u0026 Flow](#architecture--flow)\n* [Getting Started (Local)](#getting-started-local)\n\n  * [Prerequisites](#prerequisites)\n  * [Environment Variables](#environment-variables)\n  * [Install \u0026 Run](#install--run)\n* [Deployment Notes](#deployment-notes)\n* [How It Works — Implementation Details](#how-it-works---implementation-details)\n\n  * [OpenAI integration](#openai-integration)\n  * [ImageKit integration](#imagekit-integration)\n  * [Stripe integration](#stripe-integration)\n* [Project Structure (High-level)](#project-structure-high-level)\n* [Testing \u0026 Troubleshooting](#testing--troubleshooting)\n* [Contributing](#contributing)\n* [License](#license)\n* [Contact](#contact)\n\n---\n\n## Project Overview\n\nThis project is a production-oriented AI chatbot that supports *both* natural-language conversation and AI-generated images. The app exposes a polished UI (deployed on Vercel), a backend API (Node/Express) backed by MongoDB, and paid/premium features managed via Stripe. Image storage/optimization/delivery is handled via ImageKit for fast CDN delivery.\n\nDesigned for: demos, prototypes, teaching samples, and as a foundation for commercial products that want conversational + visual AI features in one package.\n\n---\n\n## Key Features\n\n* Text generation \u0026 completion using OpenAI (chat, prompts, context/history-aware replies).\n* Image generation via OpenAI image endpoints (or image model) and/or pipeline to ImageKit.\n* Image upload, optimization, and CDN delivery using ImageKit.\n* Stripe payments for premium features (credits, subscriptions, or per-generation billing).\n* Persistent chat history stored in MongoDB per user.\n* Clean, responsive frontend (React) and deployment-ready configuration (Vercel-friendly).\n\n---\n\n## Tech Stack\n\n* **Frontend:** React (compatible with Next.js if used), client-side UI components\n* **Backend:** Node.js + Express\n* **Database:** MongoDB (Atlas or self-hosted)\n* **AI:** OpenAI APIs (text \u0026 image generation)\n* **Storage/CDN:** ImageKit\n* **Payments:** Stripe (Secrets on server)\n* **Auth (suggested):** JWT / session-based auth\n* **Deployment:** Vercel (frontend), any Node host (backend) or unified deployment\n\n---\n\n## Architecture \u0026 Flow\n\n1. User interacts with the React UI and sends chat messages.\n2. Frontend calls backend API endpoints (`/api/chat`, `/api/generate-image`, etc.).\n3. Backend validates auth, applies rate limits or credit checks (if using Stripe), and forwards requests to OpenAI.\n4. Generated images are uploaded (or proxied) to ImageKit for CDN delivery and stored metadata in MongoDB.\n5. Stripe handles purchases; server verifies Stripe webhooks to grant credits/subscriptions.\n6. Chat history and usage metrics are recorded in MongoDB.\n\n\n## Deployment Notes\n\n* **Frontend:** Deploy on Vercel for zero-config deployments. Add environment variables in the Vercel dashboard.\n* **Backend:** You can deploy the backend to Vercel (serverless functions), Render, Railway, Heroku, or any VPS. Ensure webhooks (Stripe) are reachable and secure.\n* **MongoDB:** Use MongoDB Atlas for an easy hosted DB; set the `MONGO_URI` accordingly.\n* **Stripe Webhooks:** Use Stripe CLI for local testing, and set the `STRIPE_WEBHOOK_SECRET` in production.\n\n---\n\n## How It Works — Implementation Details\n\n### OpenAI integration\n\n* Server makes authenticated requests to OpenAI for completions/chat and for generating images.\n* Conversations may be stored and passed as `messages` for context to the OpenAI Chat API.\n* Make sure to handle token usage and errors gracefully (rate limits, timeouts).\n\n### ImageKit integration\n\n* Upload generated images (or user uploads) to ImageKit via the SDK/server-side upload to keep private keys secure.\n* Store the returned CDN URL in your database for fast access in the client.\n\n### Stripe integration\n\n* Use server-only secret key to create payment intents, handle subscriptions or one-off purchases.\n* Verify Stripe webhook signatures on the backend to securely grant credits or update subscription status.\n* Keep billing logic idempotent and safe for repeated webhook calls.\n\n---\n\n## Project Structure (High-level)\n\n```\n/Chatbot\n  /client            # React or Next.js frontend\n  /server            # Express API, OpenAI calls, Stripe webhooks\n  README.md\n  .env.example\n```\n\nIf your repo uses a monorepo or different structure, adjust this section to match the actual layout.\n\n---\n\n## Testing \u0026 Troubleshooting\n\n* If image generation fails: check `OPENAI_API_KEY`, and ensure your usage plan supports image endpoints.\n* If uploads fail: verify ImageKit keys and endpoint, and that uploads are done server-side (private key).\n* If payments fail: check Stripe test keys, webhook endpoint, and check logs for `idempotency_key` issues.\n\n---\n\n## Contributing\n\nThanks for considering contributions! A recommended CONTRIBUTING.md workflow:\n\n1. Fork the repo\n2. Create a feature branch (`git checkout -b feat/my-feature`)\n3. Make changes, add tests if applicable\n4. Open a pull request with a clear description\n\nPlease follow consistent formatting and linting. Add tests or manual reproduction steps for bug fixes.\n\n---\n\n## License\n\nSuggested: **MIT License** — lightweight and permissive. Add a `LICENSE` file if you choose it.\n\n---\n\n## Contact\n\nMaintainer: **Soham Bhattacharjee**\n\n* GitHub: `https://github.com/SohamBhattacharjee2003`\n* Live demo: [https://chatbot-woad-iota.vercel.app/](https://chatbot-woad-iota.vercel.app/)\n\n---\n\nIf you'd like, I can:\n\n* generate a `README.md` file you can copy/paste or commit directly,\n* craft a shorter `GitHub repository description` and `README` banner (badges + one-line), or\n* produce a polished `CONTRIBUTING.md`, `SECURITY.md`, or `ISSUE_TEMPLATE.md` next.\n\nTell me which of the above you'd like next and I'll add it directly to the repo content.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsohambhattacharjee2003%2Fchatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsohambhattacharjee2003%2Fchatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsohambhattacharjee2003%2Fchatbot/lists"}