{"id":19372772,"url":"https://github.com/hasura/github-integration-starter","last_synced_at":"2025-06-17T06:05:26.978Z","repository":{"id":48252622,"uuid":"390721604","full_name":"hasura/github-integration-starter","owner":"hasura","description":"Try out Hasura's GitHub Integration on Cloud Projects using the examples in this repo.","archived":false,"fork":false,"pushed_at":"2023-04-01T05:02:35.000Z","size":95,"stargazers_count":23,"open_issues_count":2,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-24T14:54:51.480Z","etag":null,"topics":["github-integration","hasura"],"latest_commit_sha":null,"homepage":"https://hasura.io/docs/latest/graphql/cloud/projects/github-integration.html","language":null,"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/hasura.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":"2021-07-29T12:46:54.000Z","updated_at":"2024-12-09T05:48:18.000Z","dependencies_parsed_at":"2024-11-10T08:25:30.177Z","dependency_job_id":"0a9455cc-ffd8-45ee-8ada-c75b643b18b5","html_url":"https://github.com/hasura/github-integration-starter","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/hasura/github-integration-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasura%2Fgithub-integration-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasura%2Fgithub-integration-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasura%2Fgithub-integration-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasura%2Fgithub-integration-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hasura","download_url":"https://codeload.github.com/hasura/github-integration-starter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasura%2Fgithub-integration-starter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260301992,"owners_count":22988719,"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":["github-integration","hasura"],"created_at":"2024-11-10T08:25:16.100Z","updated_at":"2025-06-17T06:05:26.962Z","avatar_url":"https://github.com/hasura.png","language":null,"readme":"# Hasura Github Integration Starter Kit\n\nHasura's github integration automatically deploys your github projects using Hasura Cloud, providing automatic updates of your metadata and database migrations from your repo.\n\n## Table of contents\n\n- [Moving from local dev to Hasura Cloud](#moving-from-local-dev-to-hasura-cloud)\n- [Moving from Hasura Cloud to local dev](#moving-from-hasura-cloud-to-local-dev)\n- [Moving between two Hasura Cloud instances](#moving-between-two-hasura-cloud-instances)\n- [Troubleshooting](#troubleshooting)\n\n## Moving from local dev to Hasura Cloud\n\nLet's say you started developing your app using the OSS version of `hasura/graphql-engine` image locally using docker. Now you want to apply the changes to the Hasura Cloud project. The first step is to create a Hasura Cloud project.\n\n[![Deploy to Hasura](https://graphql-engine-cdn.hasura.io/assets/main-site/deploy-hasura-cloud.png)](https://cloud.hasura.io/?pg=github-integration-demo\u0026plcmt=body\u0026tech=default)\n\nOnce a project is created, we will launch console and Connect a Database. Depending on how your local development database has been setup, give the same database name here for this connection. For example `default` is the database name that is used with docker-compose setup initially. Update the name accordingly.\n\n![Connect Database](./assets/connect-database.png)\n\nOnce a database is connected, we can configure Git Deployment.\n\n### Configure Git Deployment\n\nHead to [https://cloud.hasura.io](https://cloud.hasura.io), select the cloud project and go to `Git Deployment` tab on the navigation menu.\n\n![Sign in with Github](./assets/sign-in-with-github.png)\n\nNow Sign in with Github to configure the repo for this project.\n\n![Git Deployment](./assets/setup-git-deployment.png)\n\nAfter selecting the repo/branch, choose the deployment mode.\n\nThere are two modes possible:\n\n- Automatic: Deployment is triggered automatically when git push happens to the configured repo/branch.\n- Manual: Deployment can only be manually triggered from the dashboard.\n\n![Git Deployment Configured](./assets/git-deployment-final.png)\n\nNow, go back to your git repo directory. Assuming you have made some schema or metadata changes via the Console, you can now just git push to trigger a deployment.\n\n```bash\ngit add .\ngit commit -m \"added tables\"\ngit push origin \u003cconfigured-branch\u003e\n```\n\n### Use GitHub Action\n\nFor production environments, we recommend using [GitHub Actions for Hasura](https://github.com/marketplace/actions/github-action-for-hasura) instead of [GitHub Deployment](https://hasura.io/docs/2.0/cloud-ci-cd/github-integration/).\n\nYou can find an example GitHub workflow in the [hasura-ci-migrations.yaml](./.github/workflows/hasura-ci-migrations.yaml) file.\n\n### Try it out\n\nWe have a sample Hasura project in this repo that you can use to quickly try this out. To move from local to cloud, you can make use of the directory `local-to-cloud` to do git push.\n\n## Moving from Hasura Cloud to local dev\n\nLet's say you started developing your app by using a Hasura Cloud project. Now you want to move the current database schema and metadata on the Cloud to a local development setup.\n\nThe first step is to initialise a hasura project locally.\n\n```bash\nhasura init \u003cproject-name\u003e\n```\n\nOnce a project directory is created, we need to initialise the migration files, pulling the database schema from the cloud project.\n\n```bash\nhasura migrate create init --sql-from-server --endpoint \u003chasura-project-url\u003e --admin-secret \u003cadmin-secret\u003e\n```\n\nNow head to the migrations directory to check the version of the migration generated.\n\n```bash\ncd migrations/default\n```\n\nNote down the directory name, which would look something like this `1627564572630_init`. Just copy the version number without the `_init` parts of the name.\n\n```bash\nhasura migrate apply --endpoint \u003chasura-project-url\u003e --admin-secret \u003cadmin-secret\u003e --skip-execution --version 1627564572630\n```\n\nIt is important to add the `skip-execution` flag since that marks the migration as applied. This is to ensure that the schema that is already created on Hasura Cloud project is not getting applied again, which would end in an error state.\n\nFinally, we need to export metadata:\n\n```bash\nhasura metadata export --endpoint \u003chasura-project-url\u003e --admin-secret \u003cadmin-secret\u003e \n```\n\nWe have successfully synced our state from Cloud to a local dev environment. As you make changes to the schema and metadata and push it to a dev branch, you should be able to sync those changes to the Cloud project again.\n\nLet's apply the metadata and migrations to our local Hasura project.\n\n```bash\nhasura metadata apply\nhasura migrate apply\nhasura metadata reload\n```\n\nThe next step is to configure git deployment on the Cloud project by following the steps above.\n\nStart local development of the project using the Hasura CLI. Before that, ensure that the local Hasura project is using the same ENV variable for the Database connection.\n\n```bash\nhasura console\n```\n\nThis will use the default localhost endpoint in `config.yaml`. You can now use the console to modify schema and metadata.\n\nThats it! The migrations and metadata changes will be applied automatically. In case you have selected a manual deployment, you can head to Cloud dashboard and choose to manually trigger a deployment.\n\n### Try it out\n\nWe have a sample Hasura project in this repo that you can use to quickly try this out. To move from cloud to local, you can make use of the directory `cloud-to-local` to do git push. This project has Cloud specific metadata like `api_limits.yaml` that gets ignored in your local development but gets applied on Cloud during git deployment.\n\n## Moving between two Hasura Cloud instances\n\nThis use case is typically for moving between staging and production environments, both of which are in Hasura Cloud.\n\nNow there are two possibilities here. Either you already have a Hasura project structure locally created using the CLI or you just started with a Cloud project to experiment as a dev setup and now want to move the current schema to another cloud project for staging or production.\n\nIn the first case of having an existing project structure locally, all we need to do is,\n\n- Add the environment variable `PG_DATABASE_URL` for the right database connection string. The `env` name should match the one on the local project and hence we have used the default one that comes in the docker-compose setup. Feel free to update this value depending on what your local configuration looks like.\n\nHead to `cloud.hasura.io`, choose the project you want to migrate to and go to the project details page. Click on `Env vars` on the left sidebar navigation and add a new Env var for the database URL.\n\n![Database ENV](./assets/add-database-env.png)\n\nOnce the database ENV is added, the next step is to identify other ENV variables that are used in local Hasura project setup. For example, if you are using Actions/Events/Remote Schemas and the handler URLs are coming from the ENV, then those envs should also be added appropriately.\n\nOnce that is done, we can head to configuring `Git Deployment` for the project. The steps are outlined above.\n\nIn the second case of starting with a Cloud project, we have to initialise the hasura project locally and follow the Git Deployment setup.\n\n## Troubleshooting\n\nIn case a deployment fails, you can fix the corresponding issues in metadata/migration files with another git push. Learn more different steps to identify and fix issues from the [troubleshooting guide](https://hasura.io/docs/latest/graphql/cloud/projects/github-integration.html#troubleshooting-failures) on docs.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasura%2Fgithub-integration-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhasura%2Fgithub-integration-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasura%2Fgithub-integration-starter/lists"}