{"id":25735737,"url":"https://github.com/vishwas-chakilam/urlguard","last_synced_at":"2026-06-11T04:31:12.770Z","repository":{"id":278312430,"uuid":"934699052","full_name":"Vishwas-Chakilam/URLGuard","owner":"Vishwas-Chakilam","description":"A machine learning-based system for detecting malicious URLs. Utilizes advanced classification techniques to differentiate between safe and harmful links. 🚀🔍","archived":false,"fork":false,"pushed_at":"2025-12-14T05:30:50.000Z","size":184,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-16T07:46:17.174Z","etag":null,"topics":["complete-source-code","fastapi","machine-learning","random-forest-classifier","reactjs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vishwas-Chakilam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-02-18T09:08:53.000Z","updated_at":"2025-12-14T05:45:25.000Z","dependencies_parsed_at":"2025-02-19T05:37:47.591Z","dependency_job_id":null,"html_url":"https://github.com/Vishwas-Chakilam/URLGuard","commit_stats":null,"previous_names":["vishwas-chakilam/urlguard"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Vishwas-Chakilam/URLGuard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vishwas-Chakilam%2FURLGuard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vishwas-Chakilam%2FURLGuard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vishwas-Chakilam%2FURLGuard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vishwas-Chakilam%2FURLGuard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vishwas-Chakilam","download_url":"https://codeload.github.com/Vishwas-Chakilam/URLGuard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vishwas-Chakilam%2FURLGuard/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34183109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"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":["complete-source-code","fastapi","machine-learning","random-forest-classifier","reactjs"],"created_at":"2025-02-26T05:31:48.122Z","updated_at":"2026-06-11T04:31:12.744Z","avatar_url":"https://github.com/Vishwas-Chakilam.png","language":"TypeScript","funding_links":["http://login-paypal.com"],"categories":[],"sub_categories":[],"readme":"# URL Guard — React + Supabase + Pretend ML\n\nApple-inspired, production-ready React application that demonstrates how a RandomForest-like pipeline could classify URLs as **Benign / Defacement / Phishing / Malicious**. Everything is wired to Supabase for authentication, points/badges, history, quiz results, reports, and contact requests. A Flask backend stub mirrors the same deterministic ML logic so you can swap in a real model later.\n\n\u003e 🔒 **Important:** The ML layer is a  deterministic model (`src/lib/demoModel.ts`). Replace it with your API when you are ready for production.\n\n## Feature highlights\n\n- Supabase auth (email/password) with profiles, avatar uploads, points, and badge progression.\n- Analyze page with 3-step pipeline, deterministic scoring, toasts, history sync, reports, and guest preview.\n- Gamification rules (points, badges, report/quiz bonuses) with progress bars and deletions that rollback points.\n- Quiz engine pulling 10 seeded questions per session, with Supabase persistence when logged in.\n- Contact form wired to EmailJS + optional Supabase storage.\n- About, Profile, History, Quiz, Contact, Privacy, Terms, How-it-works, and 404 pages — all responsive and accessible.\n- Optional Flask API (`flask_backend/`) mirroring the pretend model to demonstrate a real inference endpoint.\n\n## Tech stack\n\n- React 18 + TypeScript + Vite\n- Tailwind CSS + framer-motion + Heroicons + react-hot-toast\n- Supabase (`@supabase/supabase-js`) for auth/storage\n- EmailJS (`@emailjs/browser`) for contact notifications\n- Flask (optional backend demo)\n\n## Quick start\n\n```bash\n# Frontend\nnpm install\nnpm run dev\n\n# Optional: Flask API (virtual env recommended)\ncd flask_backend\npython -m venv .venv \u0026\u0026 source .venv/bin/activate  # or .venv\\Scripts\\activate on Windows\npip install -r requirements.txt\npython app.py\n```\n\nNavigate to `http://localhost:5173` for the client and `http://127.0.0.1:5001/api/health` to verify the Flask API.\n\n## Environment variables\n\nDuplicate `env.example` → `.env` and fill in:\n\n```\nVITE_SUPABASE_URL=\nVITE_SUPABASE_ANON_KEY=\nVITE_CLIENT_URL=http://localhost:5173\nVITE_EMAILJS_SERVICE_ID=\nVITE_EMAILJS_TEMPLATE_ID=\nVITE_EMAILJS_PUBLIC_KEY=\nVITE_FLASK_API_URL=http://127.0.0.1:5001/api/predict\n```\n\nIf you migrate to Next.js later, equivalent `NEXT_PUBLIC_*` keys are already referenced in code.\n\n## Supabase setup\n\n1. Create a new Supabase project.\n2. Run `supabase/schema.sql` in the SQL editor to create tables, indexes, and RLS policies:\n   - `profiles`\n   - `analyses`\n   - `reports`\n   - `quiz_results`\n   - `contacts`\n3. Enable the default storage bucket `avatars` (create one if missing) for profile pictures.\n4. Update environment variables with the generated URL + anon key.\n\n### RLS reminder\n\nThe provided SQL enables row-level security with policies scoped to `auth.uid()`. Confirm they are active before going live.\n\n## Pretend RandomForest pipeline\n\n- File: `src/lib/demoModel.ts`\n- Steps:\n  1. Normalize URL, strip fragments, ensure protocol.\n  2. Check protocol, domain length, heuristic entropy, and trusted domain list (`src/data/trustedDomains.ts`).\n  3. Seeded PRNG simulates RandomForest probabilities + metrics (accuracy, precision, recall, support).\n\nSwap it with a real API:\n\n```ts\n// demoModel.ts\n// const response = await fetch(import.meta.env.VITE_FLASK_API_URL!, {\n//   method: 'POST',\n//   headers: { 'Content-Type': 'application/json' },\n//   body: JSON.stringify({ url }),\n// });\n// return await response.json();\n```\n\nThe Flask backend already exposes `/api/predict` using the same deterministic logic (`flask_backend/demo_model.py`). Replace `analyze_url` with your real model call when ready.\n\n## Gamification rules\n\n| Event            | Points |\n| ---------------- | ------ |\n| Benign result    | +5     |\n| Defacement       | +3     |\n| Phishing         | +7     |\n| Malicious        | +10    |\n| Report submission| +2     |\n| Quiz             | `2 * correct answers` |\n\nBadges unlock at 10 / 50 / 100 / 250 points (`badgeTiers` in `src/data/badgeTiers.ts`). Deleting a history entry rolls back the awarded points automatically.\n\n## EmailJS configuration\n\n1. Create a service, template, and public key at [EmailJS](https://www.emailjs.com/).\n2. Paste the values into the env file (`VITE_EMAILJS_*`).\n3. Customize the template fields to match `{ name, email, subject, message }`.\n4. Without keys, contact submissions still get saved in Supabase (if configured) and a toast explains that the email step is skipped.\n\n## Testing checklist\n\n| Scenario                         | Steps |\n| -------------------------------- | ----- |\n| Guest analysis                   | Visit `/analyze`, run `http://example-unsafe.test`, observe toast prompting login. |\n| Authenticated analysis           | Sign up, analyze `https://google.com`, confirm history entry and points. |\n| Report submission                | Click “Report URL” — toast should confirm and points +2 should apply. |\n| History filters \u0026 deletion       | Apply label filter, delete entry, ensure point rollback. |\n| Quiz flow                        | Answer all 10 questions, submit, and check Supabase `quiz_results`. |\n| Contact form                     | Submit message (with EmailJS keys) and verify email + Supabase `contacts` row. |\n| Dark mode                        | Toggle header icon; theme preference persists in localStorage. |\n\nSample URLs for demos:\n\n- Safe: `https://google.com`, `https://github.com`\n- Suspicious: `http://login-paypal.com`, `https://very-long-domain-with-random-strings.biz`\n- Malicious (pretend): `http://phishy-bank-login.ru`\n\n## Replacing the pretend ML with a real model\n\n1. Deploy your model behind an API (Flask example already included).\n2. Update `VITE_FLASK_API_URL` (or any endpoint) and swap the call inside `demoModel.ts`.\n3. Optional: move the Supabase persistence to the Flask route if you need server-side control.\n4. Keep the trusted domain list in `src/data/trustedDomains.ts` or load it from Supabase storage if you prefer.\n\n## Folder overview\n\n```\nsrc/\n  components/        # Layout, auth forms, analysis widgets\n  contexts/          # Auth, theme, history, gamification providers\n  data/              # Trusted domains, badge tiers, quiz questions\n  lib/               # demoModel + Supabase client\n  pages/             # All routes (Home, Analyze, History, Profile, etc.)\nflask_backend/       # Optional Flask API wrapper\nsupabase/schema.sql  # Tables + policies\nenv.example          # Environment template\n```\n\n## Licence\n\nMIT — feel free to adapt for your own academic or demo projects. Please swap in a genuine ML model before claiming production readiness.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishwas-chakilam%2Furlguard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvishwas-chakilam%2Furlguard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishwas-chakilam%2Furlguard/lists"}