{"id":15049504,"url":"https://github.com/mozilla/galaxy-api","last_synced_at":"2025-12-18T03:42:33.995Z","repository":{"id":12509454,"uuid":"15179138","full_name":"mozilla/galaxy-api","owner":"mozilla","description":"INACTIVE - http://mzl.la/ghe-archive - To infinity and beyond. The backend API.","archived":true,"fork":false,"pushed_at":"2019-03-30T03:56:53.000Z","size":477,"stargazers_count":9,"open_issues_count":0,"forks_count":11,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-29T09:34:54.651Z","etag":null,"topics":["inactive","unmaintained"],"latest_commit_sha":null,"homepage":"http://docs.galaxy.apiary.io/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mozilla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-14T03:07:35.000Z","updated_at":"2023-01-28T03:48:42.000Z","dependencies_parsed_at":"2022-09-13T20:20:17.352Z","dependency_job_id":null,"html_url":"https://github.com/mozilla/galaxy-api","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Fgalaxy-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Fgalaxy-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Fgalaxy-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla%2Fgalaxy-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mozilla","download_url":"https://codeload.github.com/mozilla/galaxy-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235238215,"owners_count":18958059,"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":["inactive","unmaintained"],"created_at":"2024-09-24T21:20:59.375Z","updated_at":"2025-10-04T10:31:02.046Z","avatar_url":"https://github.com/mozilla.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![galaxy-api](images/logo.png?raw=true \"galaxy-api\")\n\n[![Build Status](https://travis-ci.org/mozilla/galaxy-api.svg?branch=master)](https://travis-ci.org/mozilla/galaxy-api \"Build Status\")\n\nHere lies the API for [Galaxy](https://github.com/mozilla/galaxy).\n\nThere is a REST HTTP API and WebSocket API. The REST API can be consumed by game developers. The WebSocket API is intended to be consumed by [galaxy.js](https://github.com/mozilla/galaxy.js), a simple drop-in JavaScript API for multiplayer, web-based games.\n\n\u003e __Note:__ This project is not ready for prime time. Not an official Mozilla project. Pre-alpha everything. Anything and everything at your own risk.\n\n\n## Installation\n\n1. Ensure prerequisities are installed:\n\n    * [__PostgreSQL__](http://www.postgresql.org/)\n\n\t    To install using [Homebrew](http://brew.sh/) on Mac OS X:\n\n            brew install postgresql\n            brew info postgresql\n\n2. Install Node dependencies:\n\n        npm install\n\n    These production dependencies will be installed:\n\n    * [__hapi__](https://github.com/hapijs/hapi):\n    a simple framework for developing web services + APIs\n        * [__boom__](https://github.com/hapijs/boom):\n        utilities for returning HTTP errors\n        * [__joi__](https://github.com/hapijs/joi):\n        schema validator for JS objects and API request payloads\n    * [__pg__](https://github.com/brianc/node-postgres):\n    a PostgreSQL client with pure JS and optional native libpq bindings\n        * [__node-pg-migrate__](https://github.com/theoephraim/node-pg-migrate):\n        a tool for PostgreSQL migrations\n    * [__es6-promise__](https://github.com/jakearchibald/es6-promise):\n    to polyfill ES6 promises for Node, so we can avoid callbacks\n    * [__steam__](https://github.com/seishun/node-steam):\n    wrapper around [Steam](http://store.steampowered.com/)'s\n    [HTTP API](http://steamcommunity.com/dev) (can be used for authentication\n    and friends)\n\n    And these developer dependencies will be installed:\n\n    * [__lab__](https://github.com/hapijs/lab):\n    a test utility for Node, synergises well with hapi\n    * [__gulp__](https://github.com/gulpjs/gulp/):\n    a streaming build system and task runner — used for such tasks as\n    code linting and running database migrations \u0026 operations.\n    * [a bunch of related packages for build tasks](package.json)\n\n3. Create a PostgreSQL database (using `settings.POSTGRES_URL` from `settings_dev.js`):\n\n        npm run refreshdb-dev\n\n4. Initialise settings, if you haven't already:\n\n        cp ./settings_dev.js.dist ./settings_dev.js\n        cp ./settings_prod.js.dist ./settings_prod.js\n        cp ./settings_test.js.dist ./settings_test.js\n\n\n## Developing locally\n\nInitialise settings, if you haven't already:\n\n    cp ./settings_dev.js.dist ./settings_dev.js\n\nTo run the local web server:\n\n    npm run dev\n\nTo run with a different settings file:\n\n    GALAXY_API_SETTINGS=./some_different_settings_dev.js npm run prod\n\n    npm run gulp -- lint\n\nTo run linting tools:\n\n    gulp lint\n\n\n## Deploying to production\n\nInitialise settings, if you haven't already:\n\n    cp ./settings_prod.js.dist ./settings_prod.js\n\nTo run the web server in production:\n\n    npm run prod\n\nTo run with a different settings file:\n\n    GALAXY_API_SETTINGS=./some_different_settings_prod.js npm run prod\n\nAlternatively, without `npm`:\n\n    NODE_ENV=production GALAXY_API_SETTINGS=./settings_prod.js node index.js\n    NODE_ENV=production GALAXY_API_SETTINGS=./some_different_settings_prod.js node index.js\n\n\n## Running tests\n\nInitialise settings, if you haven't already:\n\n    cp ./settings_test.js.dist ./settings_test.js\n\nTo run tests:\n\n    npm test\n\nTo run a single test:\n\n    npm test -- test/lib/db.js\n\nTo run tests without destroying the database first:\n\n    npm run test-keepdb\n\nTo run tests with coverage and linting:\n\n    npm run test-verbose\n\n\n## Working with the database\n\nAll data is currently stored in a relational PostgreSQL database (previously redis was used).\n\n### `gulp` tasks\n\nThese are the available `gulp` tasks for PostgreSQL database and migration operations:\n\n* `gulp createdb` - create a PostgreSQL database using `settings.POSTGRES_URL`.\n* `gulp dropdb` - delete the database.\n* `gulp migratedb` - run migrations.\n* `gulp migratedb-create --name \u003cname\u003e` - create a new migration file called `\u003cname\u003e`.\n* `gulp migratedb-up` - run all up migrations from the current state.\n* `gulp migratedb-up --num \u003cnum\u003e` - run `\u003cnum\u003e` up migrations from the current state.\n* `gulp migratedb-down` - run a single down migration.\n* `gulp migratedb-down --num \u003cnum\u003e` - run `\u003cnum\u003e` down migrations from the current state.\n\n### `psql` commands\n\nTo access the PostgreSQL prompt:\n\n    psql -d galaxy-api\n\nThese are a few helpful PostgreSQL commands:\n\n* `\\h` - view list of available commands.\n* `\\dt+` - list all tables in the database.\n* `\\d+ \u003ctable_name\u003e` - show a table's schema.\n* `drop table \u003ctable_name\u003e` - delete a table.\n* `\\x on` - view a table in \"extended display\" mode.\n\n\n## Examples of using the API\n\nBelow are sample `curl` commands for interacting with the REST API endpoints.\n\nNOTE: This should eventually also live elsewhere in the real API docs, but for\nnow: it's fine; it's fine.\n\n[gameControllers]:\nhttps://github.com/mozilla/galaxy-api/blob/master/api/controllers/game.js\n\n### Games\n\n#### [`GET /games`] [gameControllers]\n\nTo retrieve a list of all game resources.\n\n```\ncurl 'http://localhost:4000/games' \\\n  -H 'Content-Type: application/json' -i\n```\n\n#### [`POST /games`] [gameControllers]\n\nTo create a game resource.\n\n```\ncurl -X POST 'http://localhost:4000/games' \\\n  -H 'Content-Type: application/json' -i -d@- \u003c\u003cEOF\n  {\n    \"name\": \"mario bros\",\n    \"game_url\": \"http://nintendo.com\",\n    \"slug\": \"mario\"\n  }\nEOF\n```\n\n#### [`GET /games/{idOrSlug}`] [gameControllers]\n\nTo retrieve a game resource.\n\n```\ncurl 'http://localhost:4000/games/1' \\\n  -H 'Content-Type: application/json' -i\n```\n\n```\ncurl 'http://localhost:4000/games/mario' \\\n  -H 'Content-Type: application/json' -i\n```\n\n#### [`DELETE /games/{idOrSlug}`] [gameControllers]\n\nTo (soft-)delete a game resource.\n\n```\ncurl -X DELETE 'http://localhost:4000/games/1' -i\n```\n\n```\ncurl -X DELETE 'http://localhost:4000/games/mario' -i\n```\n\n#### [`PUT /games/{idOrSlug}`] [gameControllers]\n\nTo update a game resource.\n\n```\ncurl -X PUT 'http://localhost:4000/games/1' \\\n  -H 'Content-Type: application/json' -i -d@- \u003c\u003cEOF\n  {\n    \"name\": \"mario bros\",\n    \"game_url\": \"http://nintendo.com\",\n    \"slug\": \"mario\"\n  }\nEOF\n```\n\n```\ncurl -X PUT 'http://localhost:4000/games/mario' \\\n  -H 'Content-Type: application/json' -i -d@- \u003c\u003cEOF\n  {\n    \"name\": \"mario bros\",\n    \"game_url\": \"http://nintendo.com\",\n    \"slug\": \"mario\"\n  }\nEOF\n```\n\n```\ncurl -X PUT 'http://localhost:4000/games/wario' \\\n  -H 'Content-Type: application/json' -i -d@- \u003c\u003cEOF\n  {\n    \"name\": \"wario bros\",\n    \"game_url\": \"http://wintendo.com\",\n    \"slug\": \"wario\"\n  }\nEOF\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozilla%2Fgalaxy-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmozilla%2Fgalaxy-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozilla%2Fgalaxy-api/lists"}