{"id":25171618,"url":"https://github.com/basemax/gameapirust","last_synced_at":"2026-05-05T07:31:50.411Z","repository":{"id":168453022,"uuid":"642392006","full_name":"BaseMax/GameAPIRust","owner":"BaseMax","description":"Welcome to our Betting Web Service API assignment! In this assignment, you will be developing a web service API for a betting platform that allows users to place bets on various games. This assignment will assess your ability to design and implement a RESTful API using Rust and relevant web frameworks.","archived":false,"fork":false,"pushed_at":"2023-05-23T08:21:07.000Z","size":34,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T11:57:27.759Z","etag":null,"topics":["api","api-rest","restful","rocket","rust","rust-rocket","webservice"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaseMax.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}},"created_at":"2023-05-18T13:14:51.000Z","updated_at":"2023-05-23T02:29:27.000Z","dependencies_parsed_at":"2024-01-12T10:25:46.208Z","dependency_job_id":"d307b4aa-117c-415a-8777-ed937d9d1229","html_url":"https://github.com/BaseMax/GameAPIRust","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":0.2222222222222222,"last_synced_commit":"7bbec5f21a113cd6c0f7b659aa7b11e40cd77dde"},"previous_names":["basemax/gameapirust"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BaseMax/GameAPIRust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FGameAPIRust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FGameAPIRust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FGameAPIRust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FGameAPIRust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/GameAPIRust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2FGameAPIRust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32640533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"online","status_checked_at":"2026-05-05T02:00:06.033Z","response_time":54,"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":["api","api-rest","restful","rocket","rust","rust-rocket","webservice"],"created_at":"2025-02-09T09:21:22.986Z","updated_at":"2026-05-05T07:31:50.389Z","avatar_url":"https://github.com/BaseMax.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Game web service api written in Rust\n\nWelcome to our Betting Web Service API assignment! In this assignment, we'll be developing a web service API for a betting platform that allows users to place bets on various games. This assignment will assess the ability to design and implement a RESTful API using Rust and the Axum web framework. Please read the instructions below to get started.\n\n## Prerequisites\n\nTo complete this assignment, you will need the following:\n\n- Rust programming language installed on your machine.\n- Basic understanding of JSON for data serialization.\n- Familiarity with web development concepts, RESTful APIs, and HTTP protocols.\n\n## Task\n\nYour task is to design and implement a RESTful API for a betting platform. You are required to implement the following endpoints:\n\n- `POST /api/users` - Create a new user account.\n- `POST /api/authenticate` - Authenticate a user and retrieve an access token.\n- `GET /api/games` - Retrieve the list of available games.\n- `POST /api/bets` - Place a bet on a game.\n- `GET /api/bets` - Retrieve the details of a user's bets.\n- `GET /api/games/:game_id/results` - Retrieve the results of a specific game.\n- `GET /api/leaderboard` - Retrieve the leaderboard of top users.\n- `GET /api/users/:user_id`: Retrieves the details of a specific user based on their userId.\n- `GET /api/profile`: Retrieves the details the current user.\n- `PUT /api/profile`: Updates the user's information, such as username, password, or other profile details.\n- `DELETE /api/profile`: Deletes the user's account and associated data from the system.\n- `GET /api/games/:game_id/bets`: Retrieves the list of bets placed on a specific game.\n- `PUT /api/bets/:bet_id`: Updates an existing bet, allowing users to modify the amount or other details.\n- `DELETE /api/bets/:bet_id`: Cancels a specific bet made by a user.\n- `GET /api/games/:game_id/participants`: Retrieves the list of participants involved in a specific game.\n- `POST /api/games/:game_id/results`: Sets the results of a specific game, allowing authorized users to declare the outcome or winner.\n\n## API Endpoint examples\n\n`POST /api/users`\n\nCreates a new user account.\n\nRequest body:\n\n```json\n{\n    \"username\": \"example_user\",\n    \"password\": \"password123\"\n}\n```\n\nResponse:\n\n```json\n{\n    \"token_type\": \"Bearer\",\n    \"access_token\": \"\u003cjwt-HS512-token\u003e\"\n}\n```\n\n`POST /api/authenticate`\n\nAuthenticates a user and retrieves an access token.\n\nRequest body:\n\n```json\n{\n    \"username\": \"example_user\",\n    \"password\": \"password123\"\n}\n```\n\nResponse:\n\n```json\n{\n    \"token_type\": \"Bearer\",\n    \"access_token\": \"\u003cjwt-HS512-token\u003e\"\n}\n```\n\n`GET /api/games`\n\nRetrieves the list of available games for betting.\n\nResponse:\n\n```json\n{\n    \"games\": [\n        {\n            \"id\": 1,\n            \"results\": null,\n            \"end_time\": 1684655024208,\n            \"start_time\": 1684223024208,\n            \"name\": \"Volleyball World Cup\"\n        },\n        {\n            \"id\": 2,\n            \"results\": null,\n            \"end_time\": 1685000624208,\n            \"start_time\": 1684827824208,\n            \"name\": \"Football World Cup\"\n        },\n        {\n            \"id\": 2,\n            \"results\": \"Germany\",\n            \"end_time\": 1684655024208,\n            \"start_time\": 1684223024208,\n            \"name\": \"Basketball League\"\n        }\n    ]\n}\n```\n\n`POST /api/bets`\n\nPlaces a bet on a game.\n\nRequest body:\n\n```json\n{\n  \"gameId\": 2,\n  \"amount\": 100,\n  \"expected_results\": \"Germany\"\n}\n```\n\nResponse:\n\n```json\n{\n    \"id\": 457,\n    \"user_id\": 1,\n    \"game_id\": 2,\n    \"amount\": 100,\n    \"expected_results\": \"Germany\"\n}\n```\n\n`GET /api/bets`\n\nRetrieves the details of a user's bets.\n\nResponse:\n\n```json\n{\n    \"bets\": [\n        {\n            \"id\": 456,\n            \"user_id\": 1,\n            \"game_id\": 1,\n            \"amount\": 100,\n            \"expected_results\": \"Germany\"\n        },\n        {\n            \"id\": 457,\n            \"user_id\": 1,\n            \"game_id\": 2,\n            \"amount\": 100,\n            \"expected_results\": \"Germany\"\n        }\n    ]\n}\n```\n\n`GET /api/games/:game_id/results`\n\nRetrieves the results of a specific game.\n\nResponse:\n\n```json\n{\n    \"id\": 1,\n    \"results\": \"Germany\",\n    \"end_time\": 1684655024208,\n    \"start_time\": 1684223024208,\n    \"name\": \"Volleyball World Cup\"\n}\n```\n\n`GET /api/leaderboard`\n\nRetrieves the leaderboard of top users based on their total winnings.\n\nResponse:\n\n```json\n{\n    \"leaderboard\": [\n        {\n            \"user_id\": 2,\n            \"username\": \"foo_2\",\n            \"total_winnings\": 5\n        },\n        {\n            \"user_id\": 1,\n            \"username\": \"foo\",\n            \"total_winnings\": 1\n        },\n        {\n            \"user_id\": 3,\n            \"username\": \"foo2\",\n            \"total_winnings\": 0\n        }\n    ]\n}\n```\n\n`GET /api/users/:user_id`\n\nRetrieves the details of a specific user based on their userId.\n\nResponse:\n\n```json\n{\n  \n    \"id\": 1,\n    \"username\": \"foo\",\n    \"total_winnings\": 1\n}\n```\n\n`GET /api/profile`\n\nRetrieves the details the current user.\n\nResponse:\n\n```json\n{\n    \"id\": 1,\n    \"balance\": 100,\n    \"username\": \"foo\",\n    \"total_winnings\": 1\n}\n```\n\n`PUT /api/profile`\n\nUpdates the user's information, such as username, password, or other profile details.\n\nRequest body:\n\n```json\n{\n    \"username\": \"foo\",\n    \"password\": \"xD\"\n}\n```\n\nResponse:\n\n```json\n{\n    \"id\": 1,\n    \"balance\": 100,\n    \"password\": \"xD\",\n    \"username\": \"foo\",\n    \"is_superuser\": true,\n    \"total_winnings\": 1,\n    \"token\": \"\u003cjwt-HS512-token\u003e\"\n}\n```\n\n`DELETE /api/profile`\n\nDeletes the user's account and associated data from the system.\n\nResponse:\n\n```json\n{\n    \"result\": \"success\"\n}\n```\n\n`GET /api/games/:game_id/bets`\n\nRetrieves the list of bets placed on a specific game.\n\nResponse:\n\n```json\n{\n    \"bets\": [\n        {\n            \"id\": 456,\n            \"game_id\": 1,\n            \"user_id\": 1,\n            \"amount\": 100,\n            \"expected_results\": \"Germany\"\n        }\n    ]\n}\n```\n\n`PUT /api/bets/:bet_id`\n\nUpdates an existing bet, allowing users to modify the amount or other details.\n\nRequest body:\n\n```json\n{\n    \"amount\": 500\n}\n```\n\nResponse:\n\n```json\n{\n    \"id\": 457,\n    \"user_id\": 1,\n    \"game_id\": 2,\n    \"amount\": 500,\n    \"expected_results\": \"Germany\"\n}\n```\n\n`DELETE /api/bets/:bet_id`\n\nCancels a specific bet made by a user.\n\nResponse:\n\n```json\n{\n    \"result\": \"success\"\n}\n```\n\n`GET /api/games/:game_id/participants`\n\nRetrieves the list of participants involved in a specific game.\n\nResponse:\n\n```json\n[\n    {\n        \"id\": 1,\n        \"username\": \"foo\",\n        \"total_winnings\": 1\n    }\n]\n```\n\n`POST /api/games/:game_id/results`\n\nSets the results of a specific game, allowing authorized users to declare the outcome or winner.\n\nRequest body:\n\n```json\n{\n    \"results\": \"Germany\"\n}\n```\n\nResponse:\n\n```json\n{\n    \"results\": \"success\"\n}\n```\n\n## Technologies\n\nHere are the technologies that you're assigned to use:\n\n- Tokio as the runtime\n- Axum backend framework\n- Jsonwebtoken for authorization\n- In memory database written with a Hashmap\n- Serde and Serde_Json for json encode/decode\n\n## Disclaimer: This Betting Web Service API Project\n\nPlease note that this Betting Web Service API project is purely intended for educational purposes and should not be used in production environments. It is essential to exercise caution and be aware of the potential risks associated with real-world betting systems.\n\nUsing this project in a live production setting may expose you to various legal, financial, and regulatory challenges that require careful consideration and adherence to applicable laws and regulations specific to your jurisdiction.\n\nWe strongly advise against deploying this project as a live betting platform without conducting a thorough assessment of legal and regulatory requirements. It is your responsibility to ensure compliance with all relevant laws, regulations, and licensing obligations applicable to online betting services.\n\nBy accessing or utilizing this project, you agree that you understand the aforementioned disclaimer and that you will not use this project for any production or commercial purposes. The developers and contributors of this project shall not be held liable for any consequences arising from the use of this project in any unauthorized or inappropriate manner.\n\nIf you have any questions or concerns regarding the usage of this project, please seek legal advice or consult with the appropriate authorities before proceeding.\n\n**Note:** It is crucial to consult legal professionals and comply with all applicable laws and regulations when developing and deploying any real-world gambling or betting services.\n\n## Authors\n\n- Mahdi Sharifi (devraymondsh@gmail.com)\n- Max Base\n\nCopyright 2023, Max Base\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fgameapirust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Fgameapirust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fgameapirust/lists"}