{"id":28059514,"url":"https://github.com/manojtharindu11/sos","last_synced_at":"2026-05-07T06:35:48.943Z","repository":{"id":291723292,"uuid":"961496249","full_name":"manojtharindu11/sos","owner":"manojtharindu11","description":"SOS Game is a simple multiplayer word game where players take turns placing “S” or “O” to form “SOS” on a grid. The player with the most SOS wins.","archived":false,"fork":false,"pushed_at":"2025-05-06T13:11:38.000Z","size":233,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T08:06:18.452Z","etag":null,"topics":["express","multiplayer-game","nodejs","react-vite","socket-io"],"latest_commit_sha":null,"homepage":"https://sos-game-theta.vercel.app","language":"JavaScript","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/manojtharindu11.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-06T16:37:57.000Z","updated_at":"2025-05-06T15:09:00.000Z","dependencies_parsed_at":"2025-05-06T08:38:19.333Z","dependency_job_id":null,"html_url":"https://github.com/manojtharindu11/sos","commit_stats":null,"previous_names":["manojtharindu11/sos"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/manojtharindu11/sos","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manojtharindu11%2Fsos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manojtharindu11%2Fsos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manojtharindu11%2Fsos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manojtharindu11%2Fsos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manojtharindu11","download_url":"https://codeload.github.com/manojtharindu11/sos/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manojtharindu11%2Fsos/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32726202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["express","multiplayer-game","nodejs","react-vite","socket-io"],"created_at":"2025-05-12T08:05:39.949Z","updated_at":"2026-05-07T06:35:48.930Z","avatar_url":"https://github.com/manojtharindu11.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🆘 SOS Game\r\n\r\nThe **Multiplayer SOS Game** is a digital adaptation of the classic \"SOS\" game designed for real-time, competitive play. Two players compete by taking turns placing **S** or **O** on a grid, aiming to form the sequence \"SOS\" horizontally, vertically, or diagonally. The system tracks scores, manages user sessions securely using JWT, and ranks players based on performance.\r\n\r\n---\r\n\r\n## 🎮 Game Rules\r\n\r\n- Two players alternate turns.\r\n- Each player chooses an empty grid cell and places either **\"S\"** or **\"O\"**.\r\n- Forming \"SOS\" in any direction earns a point.\r\n- The game ends when the board is full.\r\n- The player with the highest score wins.\r\n\r\n---\r\n\r\n## 🚀 Features\r\n\r\n- 🧑‍🤝‍🧑 Real-time multiplayer gameplay (via Socket.IO)\r\n- 🎯 Scoring system for successful \"SOS\" formations\r\n- 📊 Dynamic leaderboard and ranking\r\n- 🔐 JWT-based authentication with refresh token handling\r\n- 🧠 Performance-based ranking: `finalScore / numberOfContexts`\r\n- 🗂️ Game history tracking and secure session management\r\n\r\n---\r\n\r\n## 🛠️ Tech Stack\r\n\r\n- **Frontend**: React\r\n- **Backend**: Node.js, Express.js\r\n- **WebSocket**: Socket.IO\r\n- **Database**: MongoDB (with Mongoose)\r\n- **Authentication**: JWT + Refresh Tokens\r\n\r\n---\r\n\r\n## 📂 Project Structure\r\n\r\n```bash\r\n.\r\n├── frontend/\r\n│   ├── src/\r\n│   │   ├── api/\r\n│   │   ├── components/\r\n│   │   ├── context/\r\n│   │   ├── guards/\r\n│   │   ├── hooks/\r\n│   │   ├── pages/\r\n│   │   ├── routes/\r\n│   │   ├── styles/\r\n│   │   ├── utils/\r\n│   │   └── app.jsx\r\n│   ├── index.html\r\n│   ├── package.json\r\n│   ├── package-lock.json\r\n│   ├── .env.example\r\n│   └── .gitignore\r\n├── backend/\r\n│   ├── models/         # Mongoose models (User, Game)\r\n│   ├── controller/     # Game and Auth logic\r\n│   ├── routes/         # API endpoints\r\n│   ├── middleware/     # Auth, error handling, validation\r\n│   ├── services/       # Game services and logic\r\n│   ├── socket/         # Real-time game handlers\r\n│   ├── validators/     # Input validation\r\n│   ├── utils/          # Token helpers, ranking logic\r\n│   ├── server.js\r\n│   ├── package.json\r\n│   ├── package-lock.json\r\n│   ├── .env.example\r\n│   └── .gitignore\r\n└── README.md\r\n````\r\n\r\n---\r\n\r\n## 📈 Ranking System\r\n\r\nPlayer rankings are calculated based on performance using the formula:\r\n\r\n```txt\r\nperformance = finalScore / numberOfContexts\r\n```\r\n\r\nRanks are displayed using a zero-padded 3-digit format:\r\n\r\n| Raw Rank | Displayed |\r\n| -------- | --------- |\r\n| 1        | 001       |\r\n| 12       | 012       |\r\n| 120      | 120       |\r\n\r\n---\r\n\r\n## 📦 Installation \u0026 Setup\r\n\r\n### 1. Clone the repository\r\n\r\n```bash\r\ngit clone https://github.com/manojtharindu11/sos\r\ncd sos\r\n```\r\n\r\n### 2. Install dependencies\r\n\r\n```bash\r\n# Frontend\r\ncd frontend\r\nnpm install\r\n\r\n# Backend\r\ncd ../backend\r\nnpm install\r\n```\r\n\r\n### 3. Configure environment variables\r\n\r\n#### `.env` (Backend)\r\n\r\n```env\r\nMONGODB_URI=mongodb://localhost:27017/sosGame\r\nPORT=5000\r\n\r\nVITE_FRONTEND_URLS=\"http://localhost:5173,http://localhost:3000\"\r\n\r\nACCESS_TOKEN_SECRET=yourAccessTokenSecret\r\nACCESS_TOKEN_EXPIRY=15m\r\nREFRESH_TOKEN_SECRET=yourRefreshTokenSecret\r\nREFRESH_TOKEN_EXPIRY=7d\r\n```\r\n\r\n#### `.env` (Frontend)\r\n\r\n```env\r\nVITE_API_URL=http://localhost:5000\r\nVITE_SOCKET_URL=http://localhost:5000\r\n```\r\n\r\n### 4. Start the development servers\r\n\r\n```bash\r\n# Backend\r\ncd backend\r\nnpm start\r\n\r\n# Frontend\r\ncd ../frontend\r\nnpm run dev\r\n```\r\n---\r\n\r\n## 📸 Screenshots\r\n\r\n![Image](https://github.com/user-attachments/assets/87541ab9-2caf-4529-b816-2a9248e596d7)\r\n![Image](https://github.com/user-attachments/assets/24d65274-9953-432f-9aff-6bd3eefddda1)\r\n![Image](https://github.com/user-attachments/assets/8e20d4bf-f74a-4d2b-b4a4-f08c07eeb736)\r\n![Image](https://github.com/user-attachments/assets/d325ed1c-eb06-4f88-b5a4-c2c71768d184)\r\n![Image](https://github.com/user-attachments/assets/73adc083-b1d7-47a1-9f91-c8d0c59cca52)\r\n\r\n---\r\n\r\n## 👨‍💻 Author\r\n\r\n**Manoj Thilakarathna**\r\n📧 [manojtharindu11@gmail.com](mailto:manojtharindu11@gmail.com)\r\n🔗 [GitHub](https://github.com/manojtharindu11)\r\n\r\n---\r\n\r\n## 🛡️ License\r\n\r\nThis project is licensed under the MIT License.\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanojtharindu11%2Fsos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanojtharindu11%2Fsos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanojtharindu11%2Fsos/lists"}