{"id":15994357,"url":"https://github.com/oskarrough/slaytheweb-backend","last_synced_at":"2025-04-05T00:16:03.767Z","repository":{"id":151237966,"uuid":"529699797","full_name":"oskarrough/slaytheweb-backend","owner":"oskarrough","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-25T08:29:41.000Z","size":382,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-25T09:29:53.886Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://api.slaytheweb.cards","language":"JavaScript","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/oskarrough.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}},"created_at":"2022-08-27T21:23:10.000Z","updated_at":"2025-02-25T08:29:45.000Z","dependencies_parsed_at":"2024-12-15T15:19:21.679Z","dependency_job_id":"1ead4bd4-3f7a-457c-9384-927551f91f68","html_url":"https://github.com/oskarrough/slaytheweb-backend","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Fslaytheweb-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Fslaytheweb-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Fslaytheweb-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskarrough%2Fslaytheweb-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oskarrough","download_url":"https://codeload.github.com/oskarrough/slaytheweb-backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266566,"owners_count":20910837,"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":[],"created_at":"2024-10-08T07:08:39.859Z","updated_at":"2025-04-05T00:16:03.745Z","avatar_url":"https://github.com/oskarrough.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Slay the Web backend\n\nA REST API for [Slay the Web](https://github.com/oskarrough/slaytheweb) to post and store highscores.\n\nIt is deployed and live on https://api.slaytheweb.cards with three endpoints:\n\n```\nGET /api/runs - returns all runs (but not all data per run)\nGET /api/runs/{id} - returns a single run\nPOST /api/runs  - stores a run\n```\n\n## How is it made?\n\nA Node.js API (built with [Next.js](https://nextjs.org/)) which connects to a remote `libsql` (fork of sqlite) database running on a `sqld` server, hosted by https://turso.tech.\n\n## Development\n\nLink the project with Vercel in order to get the environment variables:\n\n```bash\nvercel link\n```\n\nfollowed by\n\n```bash\nvercel env pull .env.local\n```\n\nyou should see `TURSO_URL` and `TURSO_TOKEN`.\n\nand finally, to run the development server:\n\n```bash\nnpm run dev\n```\n\n## Schema\n\nThere are two tables: `players` and `runs`. Every run stores a reference to the name of a player.\n\nThere is no authentication, and player names are not protected. C'est la vie.\n\nThe run.game_state column isn't actually the FULL game state, rather a minimized version, see `minimizeGameState()`.\n\n## More dev tips\n\nOpen an sqlite shell to the live database. `rare-neon` is the name of it in the Turso cloud..\n\n```bash\nturso db shell rare-neon\n```\n\nand then in the sqlite shell, for example:\n\n```sql\n.read schema.sql\ninsert into players (name) values ('Jaw Worm')\ninsert into runs (player, game_state) values ('Jaw Worm', '{turn: 42, hello: \"world\"}')\nselect * from runs;\n```\n\nif the server is running locally, you can do:\n\n```\ncurl -X POST --header 'Content-Type: application/json' -d '{\"player\": \"XX\", \"won\": 1}' http://localhost:3000/api/runs\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foskarrough%2Fslaytheweb-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foskarrough%2Fslaytheweb-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foskarrough%2Fslaytheweb-backend/lists"}