{"id":19772711,"url":"https://github.com/michaelkolesidis/scratch-bonanza-server","last_synced_at":"2025-11-09T15:06:47.426Z","repository":{"id":171250654,"uuid":"646296723","full_name":"michaelkolesidis/scratch-bonanza-server","owner":"michaelkolesidis","description":"The server of Scratch Bonanza, an instant lottery game.","archived":false,"fork":false,"pushed_at":"2024-07-15T16:19:26.000Z","size":55,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-15T19:55:13.261Z","etag":null,"topics":["api","backend","cors","express","game-server","instant-lottery","instant-win","lottery","lottery-game","node","nodejs","number-generator","online-game","restful-api","scratch-and-win","scratchcard","scratchcard-game"],"latest_commit_sha":null,"homepage":"https://scratch-bonanza.vercel.app/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelkolesidis.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-27T23:29:04.000Z","updated_at":"2024-07-15T16:19:29.000Z","dependencies_parsed_at":"2024-01-22T21:43:31.369Z","dependency_job_id":null,"html_url":"https://github.com/michaelkolesidis/scratch-bonanza-server","commit_stats":null,"previous_names":["michaelkolesidis/scratch-bonanza-server","mnkbb699/scratch-bonanza-server","mkole/scratch-bonanza-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelkolesidis%2Fscratch-bonanza-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelkolesidis%2Fscratch-bonanza-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelkolesidis%2Fscratch-bonanza-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelkolesidis%2Fscratch-bonanza-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelkolesidis","download_url":"https://codeload.github.com/michaelkolesidis/scratch-bonanza-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224219654,"owners_count":17275477,"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","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","backend","cors","express","game-server","instant-lottery","instant-win","lottery","lottery-game","node","nodejs","number-generator","online-game","restful-api","scratch-and-win","scratchcard","scratchcard-game"],"created_at":"2024-11-12T05:07:27.491Z","updated_at":"2025-11-09T15:06:47.369Z","avatar_url":"https://github.com/michaelkolesidis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scratch Bonanza Server\n\nThe server of [Scratch Bonanza](https://github.com/michaelkolesidis/scratch-bonanza).\n\n![Attention! Free Software](./attention-free-software.png)\n\nThis software is free (as in freedom). **If you use any part of this code, you must make your entire project's source code publicly available under the same license.** This applies whether you modify the code or use it as it is in your own project. This ensures that all modifications and derivative works remain free software, so that everyone can benefit. If you are not willing to comply with these terms, you must refrain from using any part of this code.\n\nFor full license terms and conditions, you can read the AGPL-3.0 at: [gnu.org/licenses/agpl-3.0.html](https://www.gnu.org/licenses/agpl-3.0.html).\n\n## Instructions\n\n**1.** Install the project dependencies:\n\n```\nyarn\n```\n\n**2.** Start the server:\n\n```\nyarn start\n```\n\n**3.** Start the frontend, following the instructions in the [Scratch Bonanza](https://github.com/michaelkolesidis/scratch-bonanza) repository.\n\n## Features\n\nThe server offers a single API endpoint that returns an array of four values chosen randomly.\n\nGiven the significance of security in the online gaming industry, where safeguarding fairness and integrity is paramount, to achieve secure random number generation, the server relies on the [Crypto](https://nodejs.org/api/crypto.html#crypto) module of Node.js. It is specifically designed to utilize cryptographic algorithms and system-level entropy sources, ensuring the production of random output that is suitable for cryptographic operations and resistant to various attacks.\n\nSince it is possible for Node.js to be built without including support for the `node:crypto` module, it is checked whether the module is available. If that is not the case, the service will fall back to using [Math.random()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random) for generating random numbers.\n\nThe values and the probability of occurrence are the following:\n\n| Value | Probability |\n| ----- | :---------: |\n| 0     |     50%     |\n| 1     |     30%     |\n| 10    |     15%     |\n| 100   |     4%      |\n| 1000  |     1%      |\n\nThese are the probabilities of some scenarios to occur:\n\n| Scenario            | Probability |\n| ------------------- | :---------: |\n| Get at least 1 coin |  39.8332%   |\n| Get four 0s         |    6.25%    |\n| Get four 1s         |    0.81%    |\n| Get four 10s        |  0.050625%  |\n| Get four 100s       |  0.000256%  |\n| Get four 1000s      |  0.000001%  |\n\n## Technologies\n\nThe core technologies of _Scratch Bonanza Server_ are Node and [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing). The following libraries and tools are used:\n\n| Name       | License | Description                                                     |\n| ---------- | :-----: | --------------------------------------------------------------- |\n| TypeScript |   MIT   | A strongly typed programming language that builds on JavaScript |\n| Node.js    |   MIT   | Cross-platform JavaScript runtime environment.                  |\n| Express    |   MIT   | Backend framework for building RESTful APIs with Node.js        |\n| CORS       |   MIT   | Node.js CORS middleware                                         |\n\n## See Also\n\n- [Scratch Bonanza](https://github.com/michaelkolesidis/scratch-bonanza)\n\n## License\n\n\u003ca href=\"https://www.gnu.org/licenses/agpl-3.0.html\"\u003e\u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/0/06/AGPLv3_Logo.svg\" height=\"100px\" /\u003e\u003c/a\u003e\n\nCopyright (c) 2023 Michael Kolesidis\u003cbr\u003e\nLicensed under the [GNU Affero General Public License v3.0](https://www.gnu.org/licenses/agpl-3.0.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelkolesidis%2Fscratch-bonanza-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelkolesidis%2Fscratch-bonanza-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelkolesidis%2Fscratch-bonanza-server/lists"}