{"id":31676074,"url":"https://github.com/majid0899/auth-service","last_synced_at":"2026-04-12T00:11:32.992Z","repository":{"id":316407566,"uuid":"1063277873","full_name":"Majid0899/auth-service","owner":"Majid0899","description":"a standalone authentication \u0026 authorization service. It shows reusable, secure, and production-style code.","archived":false,"fork":false,"pushed_at":"2025-10-04T10:35:27.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-04T12:24:34.393Z","etag":null,"topics":["expressjs","javascript","jwt","mysql-database","mysql2","nodejs","redis","sequelize","sequelize-orm","tyepscript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Majid0899.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-09-24T12:07:58.000Z","updated_at":"2025-10-04T10:35:30.000Z","dependencies_parsed_at":"2025-09-24T13:06:48.946Z","dependency_job_id":"525c59c8-28c4-4720-bc9e-2d03325db6a7","html_url":"https://github.com/Majid0899/auth-service","commit_stats":null,"previous_names":["majid0899/auth-service"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Majid0899/auth-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Majid0899%2Fauth-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Majid0899%2Fauth-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Majid0899%2Fauth-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Majid0899%2Fauth-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Majid0899","download_url":"https://codeload.github.com/Majid0899/auth-service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Majid0899%2Fauth-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278891754,"owners_count":26063858,"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-08T02:00:06.501Z","response_time":56,"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","javascript","jwt","mysql-database","mysql2","nodejs","redis","sequelize","sequelize-orm","tyepscript"],"created_at":"2025-10-08T05:01:05.931Z","updated_at":"2026-04-12T00:11:32.987Z","avatar_url":"https://github.com/Majid0899.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"🛡️ Auth Service\n\nAn authentication microservice built with Node.js, Express, and TypeScript, featuring JWT authentication, OAuth (Google \u0026 GitHub), Redis session management, and MySQL (via Sequelize) for data persistence.\n\n🚀 Features\n\n🔐 User registration and login with JWT tokens\n\n🔁 Token refresh and logout endpoints\n\n👥 Role-based authorization (Admin \u0026 User)\n\n🌐 OAuth 2.0 login with Google and GitHub\n\n💾 MySQL integration using Sequelize ORM\n\n⚡ Rate limiting for login endpoint\n\n🧠 Written in TypeScript for better type safety\n\n🧩 Modular structure for scalability\n\n⚙️ Installation\n1 Clone Repository\n    git clone https://github.com/Majid0899/auth-service.git\n    cd auth-service\n2 Install dependencies\n    npm install\n3. Configure environment variables\n    Create a .env file in the root directory and add the following:\n    # ==============================\n      # App Configuration\n    # ==============================\n        PORT=5000\n        URL=http://localhost\n\n  # ==============================\n  # Database Configuration (MySQL)\n  # ==============================\n  DB_HOST=localhost \u003cyourHost\u003e\n  DB_PORT=3306\n  DB_USER=root\n  DB_PASSWORD=rootpassword\n  DB_NAME=auth_db\n\n# ==============================\n# JWT Configuration\n# ==============================\nJWT_SECRET=\u003cyourjwtsecret\u003e\nJWT_REFRESH_SECRET=\u003cyourjwtrefreshsecret\u003e\n\n# ==============================\n# Redis Configuration\n# ==============================\nREDIS_URL=\u003cyour redis url\u003e\n\n# ==============================\n# OAuth Configuration\n# ==============================\nGOOGLE_CLIENT_ID=your_google_client_id\nGOOGLE_CLIENT_SECRET=your_google_client_secret\nGOOGLE_CALLBACK_URL=http://localhost:3000/api/auth/google/callback\n\n\nGITHUB_CLIENT_ID=your_github_client_id\nGITHUB_CLIENT_SECRET=your_github_client_secret\nGITHUB_CALLBACK_URL=http://localhost:3000/api/auth/github/callback\n\n# ==============================\n# Rate Limiting\n# ==============================\nMAX_ATTEMPTS=5\nBLOCK_TIME=900\n\n🧑‍💻 Development\nStart the development server\n  npm run dev\nProduction\n  npm run build\n  npm start\n\n🧩 API Endpoints\n🔸 Authentication Routes (/api/auth)\n\nRegister User\nPOST /api/auth/register\n\nRequest Body:{\n  \"name\": \"John Doe\",\n  \"email\": \"john@example.com\",\n  \"password\": \"Password123!\",\n  \"phone\": \"1234567890\",\n  \"role\": \"user\"\n}\n\nLogin User\nPOST /api/auth/login\n\nRequest Body:{\n  \"email\": \"john@example.com\",\n  \"password\": \"Password123!\"\n}\n\nRefresh Token\nPOST /api/auth/refresh\n\nRequest Body:{\n  \"refreshToken\": \"\u003cJWT_REFRESH_TOKEN\u003e\"\n}\n\nLogout User\nPOST /api/auth/logout\n\nRequest Body:\n\n{\n  \"refreshToken\": \"\u003cJWT_REFRESH_TOKEN\u003e\"\n}\n\nGet Profile (Protected)\n\nGET /api/auth/profile\nHeaders: Authorization: Bearer \u003cJWT_ACCESS_TOKEN\u003e\n\nList All Users (Admin Only)\n\nGET /api/auth/users\nHeaders: Authorization: Bearer \u003cJWT_ACCESS_TOKEN\u003e\n\n🔹 OAuth Routes (/api/auth)\nMethod\tEndpoint\tProvider\tDescription\nGET\t/google\tGoogle\tRedirects to Google login\nGET\t/google/callback\tGoogle\tOAuth callback with access \u0026 refresh tokens\nGET\t/github\tGitHub\tRedirects to GitHub login\nGET\t/github/callback\tGitHub\tOAuth callback with access \u0026 refresh tokens\n\n| Category       | Technology                       |\n| -------------- | -------------------------------- |\n| Runtime        | Node.js (TypeScript)             |\n| Framework      | Express.js                       |\n| Database       | MySQL (Sequelize ORM)            |\n| Cache/Session  | Redis                            |\n| Authentication | JWT + Passport (Google \u0026 GitHub) |\n| Security       | bcrypt, dotenv                   |\n| Utilities      | Nodemon, ts-node, rate limiter   |\n\n🤝 Contributing\n\nFork the repository\n\nCreate a new branch (git checkout -b feature/your-feature)\n\nCommit your changes (git commit -m \"Add new feature\")\n\nPush to your branch (git push origin feature/your-feature)\n\nOpen a Pull Request\n\n🧾 License\n\nThis project is licensed under the ISC License.\n\n📬 Author\n\nMajid Khan\n💼 GitHub\n\n📧 Email: your.email@example.com\n\n\n\n\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmajid0899%2Fauth-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmajid0899%2Fauth-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmajid0899%2Fauth-service/lists"}