{"id":20898851,"url":"https://github.com/metafam/thegame","last_synced_at":"2025-04-08T03:14:27.222Z","repository":{"id":37012454,"uuid":"255885896","full_name":"MetaFam/TheGame","owner":"MetaFam","description":"The platform that MetaGame will be played on aka MetaOS - an open source framework for running decentralized societies. Currently featuring MyMeta Profiles, Dashboard \u0026 Quests","archived":false,"fork":false,"pushed_at":"2024-04-13T09:00:53.000Z","size":187254,"stargazers_count":128,"open_issues_count":60,"forks_count":76,"subscribers_count":16,"default_branch":"develop","last_synced_at":"2024-04-13T23:48:46.340Z","etag":null,"topics":["ceramic","leaderboard","web3"],"latest_commit_sha":null,"homepage":"https://metagame.wtf","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MetaFam.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,"dei":null}},"created_at":"2020-04-15T10:43:17.000Z","updated_at":"2024-04-19T12:34:31.889Z","dependencies_parsed_at":"2024-04-19T12:45:00.618Z","dependency_job_id":null,"html_url":"https://github.com/MetaFam/TheGame","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaFam%2FTheGame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaFam%2FTheGame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaFam%2FTheGame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetaFam%2FTheGame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MetaFam","download_url":"https://codeload.github.com/MetaFam/TheGame/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767236,"owners_count":20992548,"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":["ceramic","leaderboard","web3"],"created_at":"2024-11-18T11:12:24.062Z","updated_at":"2025-04-08T03:14:27.195Z","avatar_url":"https://github.com/MetaFam.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Game\n\nMonorepo for the MetaGame applications, backend and databases.\n\nWe're using the following stack:\n\n![Architecture](guides/architecture.svg)\n\n#### Frontend\n\n- [NextJS](https://nextjs.org/)\n- [Chakra UI](https://chakra-ui.com/)\n\n#### Backend\n\n- [Hasura](https://hasura.io/)\n- [GraphQL](https://graphql.org/)\n- [URQL](https://formidable.com/open-source/urql/)\n- [Ceramic IDX](https://idx.xyz/)\n- [Infura](https://infura.io/)\n- [Docker](https://www.docker.com/)\n\n#### Overall\n\n- [Prettier](https://prettier.io/)\n- [Lerna](https://lerna.js.org)\n- [TypeScript](https://www.typescriptlang.org/)\n- [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)\n\n## MetaGame\n\n- [Website](https://enter.metagame.wtf)\n\n\n## Guides\n\nIf you're new to the MetaGame codebase, check out the following guides to learn how to contribute.\n\n- [Video Walkthrough](https://www.youtube.com/watch?v=-Qhz6H4t0Ik)\n- [Backend Guide](guides/BACKEND.md)\n- [Frontend Guide](guides/FRONTEND.md)\n- [C4 Guide](guides/C4.md)\n- [Contributing Guide](guides/CONTRIBUTING.md)\n\n## Development\n\nBefore you start contributing read the [Contributing Guide](guides/CONTRIBUTING.md)!\n\n### Bootstrap\n\nCreate your local .env file\n\n```shell script\ncp .env.sample .env\n```\n\nCreate a GitHub token at https://github.com/settings/tokens\n\nSet `GITHUB_API_TOKEN=your_github_token` in `.env`\n\n### Install Packages\n\n```shell script\nyarn\n```\n\nInitial TS Compilation For Monorepo Packages\n\n```shell script\nyarn typecheck\n```\n\nAdding a package to the codebase can be done with [Lerna](https://github.com/lerna/lerna/tree/main/commands/add#readme)\n\n### Run services\n\n**Start backend services**\n\n```shell script\nyarn docker:start\n```\n\n**For M1 Mac Users**\n\nOfficial docker images of Hasura don't work on M1 yet\n\nIn `hasura/Dockerfile`\nReplace\n\n```\nFROM hasura/graphql-engine:v1.3.3.cli-migrations-v2\n```\n\nwith\n\n```\nFROM fedormelexin/graphql-engine-arm64:v1.3.3.cli-migrations-v2\n```\n\n- Runs docker containers for backend, Hasura Engine, and PostGres database\n- will auto-restart on any changes to `packages/backend` and `packages/utils`\n\nIf you are running for the first time on an empty database, once the services\nare running you have two options to populate the database:\n\n1. Populate the database with the production dataset:\n\n```shell script\nyarn hasura:seed-db\n```\n\n2. Populate the database with the initial dataset:\n\n```shell script\ncurl -X POST http://localhost:4000/actions/syncSourceCredAccounts?force=true\n```\n\n**Rebuild backend services**\n\nIf your docker containers fail to start due to changes in config, you may need to rebuild the containers. This can take several minutes.\n\n```shell script\nyarn docker:build\n```\n\n**Stop backend services**\n\n```shell script\nyarn docker:stop\n```\n\n- Stops all the containers\n\n**Troubleshooting**\n\nRebuild and run the containers (in attach mode):\n\n```shell script\ndocker-compose up --build\n```\n\nIn case non of the above commands are working try purge the docker containers and images you can do this by running (notice: this removes all the containers and images on your computer!):\n\n```shell script\ndocker system prune -a\n```\n\n_If you're working on the front-end and the build fails with something like the error below, you'll need to create a `.env` file in `packages/web` and add `NEXT_PUBLIC_GRAPHQL_URL=https://api-staging.metagame.wtf/v1/graphql`_\n\n```\n[Error [CombinedError]: [Network] request to http://localhost:8080/v1/graphql failed, reason: connect ECONNREFUSED 127.0.0.1:8080] {\n  type: 'CombinedError',\n  graphQLErrors: [],\n  networkError: {\n    message: 'request to http://localhost:8080/v1/graphql failed, reason: connect ECONNREFUSED 127.0.0.1:8080',\n    type: 'system',\n    errno: 'ECONNREFUSED',\n    code: 'ECONNREFUSED'\n  }\n}\n```\n\n** A note about environment variables **\n\nIf you need to add an environment variable, it will need to go in several places:\n\n- your own `.env` file\n- `.env.sample`\n- `gcp-deploy.yaml`\n  - For backend variables, add to the `deploy-backend` step alongside the others\n  - For frontend variables, add to the `deploy-frontend` step. **You may also need to add it to the `build-frontend` step, if it is used in a page that is statically generated by next.js**\n- `gcp-deploy-frontend.yaml` for frontend variables, this should be the same as the frontend actions in the other yaml file\n\nSecrets will need to be added to the `TheGame` Github secrets; contact a senior builder for assistance.\n\nAs an aside, the `gcp-deploy-frontend.yaml` is the deployment configuration for our test and production frontend instances, while `gcp-deploy.yaml` is only for PR environments.\n\n### Run NextJS Web App dev mode (new)\n\n```shell script\nyarn web:dev\n```\n\nGo to [http://localhost:3000](http://localhost:3000)\n\nHappy Coding!\n\n### Run Discord Bot\n\n```shell script\nyarn discord-bot dev\n```\n\nThis will automatically register with Discord and relay chat messages to your local instance! Pretty cool. Testing in a dedicated test Discord server (rather than MetaGame's) is recommended.\n\n### Tooling\n\nStart Hasura console\n\n```shell script\nyarn hasura:console\n```\n\nHasura CLI example\n\n```shell script\nyarn hasura migrate status\nyarn hasura migrate squash --name \"\u003cfeature-name\u003e\" --from 1598417879553\nyarn hasura migrate apply --version \"\u003csquash-migration-version\u003e\" --skip-execution\n```\n\n[Hasura CLI documentation](https://hasura.io/docs/1.0/graphql/manual/hasura-cli/index.html)\n[Hasura Migrations Guide](https://hasura.io/docs/1.0/graphql/manual/migrations/basics.html#migrations-basics)\n\nGenerate GraphQL Types\n\n```shell script\nyarn generate\n```\n\nReload Schema + Generate GraphQL Types (backend needs to be running)\n\n```shell script\nyarn update-schema\nyarn generate\n```\n\n### Restart with fresh database\n\n```shell script\nyarn docker:clean\nyarn docker:start\n```\n\n### Run typechecks\n\n```shell script\nyarn typecheck\n```\n\n### WIP Branch Push\n\nUpon pushing to the repository a linting check will be initialized validating your code.\nIf you want to push the branch to the repository (maybe for collaboration) while the code isn't completely valid yet you have the option of skipping the linting process:\n\n```shell script\ngit push -u origin \u003cbranch\u003e [--no-verify]\n```\n\nPlease use this only when absolutely necessary!\n\n### Debugging with Visual Studio Code\n\nWhen running the backend stack locally using docker-compose, you can still debug the backend container using VS Code. Just add [this configuration](https://gist.github.com/alalonde/75e4d4237aacd9e45ac38e5b5faf479b) to your `.vscode/launch.json`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetafam%2Fthegame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetafam%2Fthegame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetafam%2Fthegame/lists"}