{"id":22772315,"url":"https://github.com/pactflow/example-consumer","last_synced_at":"2025-05-15T16:04:47.190Z","repository":{"id":37698398,"uuid":"252887698","full_name":"pactflow/example-consumer","owner":"pactflow","description":"An example of a consumer that uses Pact+PactFlow to create a consumer driven contract with its provider","archived":false,"fork":false,"pushed_at":"2025-05-10T16:10:57.000Z","size":4342,"stargazers_count":27,"open_issues_count":4,"forks_count":541,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-10T17:22:56.304Z","etag":null,"topics":["example"],"latest_commit_sha":null,"homepage":"https://pactflow.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pactflow.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-04-04T02:10:58.000Z","updated_at":"2025-05-10T16:11:00.000Z","dependencies_parsed_at":"2023-02-13T01:30:30.689Z","dependency_job_id":"c42a2c13-bec5-4482-b779-f097bcbcf5ec","html_url":"https://github.com/pactflow/example-consumer","commit_stats":{"total_commits":168,"total_committers":9,"mean_commits":"18.666666666666668","dds":0.5476190476190477,"last_synced_commit":"279c21dee748803c35420b9b9ff94d19df0bc896"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-consumer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-consumer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-consumer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-consumer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pactflow","download_url":"https://codeload.github.com/pactflow/example-consumer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254374410,"owners_count":22060610,"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":["example"],"created_at":"2024-12-11T17:08:04.025Z","updated_at":"2025-05-15T16:04:47.164Z","avatar_url":"https://github.com/pactflow.png","language":"JavaScript","readme":"# Example Consumer\n\n[![Build](https://github.com/pactflow/example-consumer/actions/workflows/build.yml/badge.svg)](https://github.com/pactflow/example-consumer/actions/workflows/build.yml)\n\n[![Pact Status](https://test.pactflow.io/pacts/provider/pactflow-example-provider/consumer/pactflow-example-consumer/latest/badge.svg?label=provider)](https://test.pactflow.io/pacts/provider/pactflow-example-provider/consumer/pactflow-example-consumer/latest) (latest pact)\n\n[![Can I deploy Status](https://test.pactflow.io/pacticipants/pactflow-example-consumer/branches/master/latest-version/can-i-deploy/to-environment/production/badge)](https://test.pactflow.io/pacticipants/pactflow-example-consumer/branches/master/latest-version/can-i-deploy/to-environment/production/badge)\n\nThis is an example of a Node consumer using Pact to create a consumer driven contract, and sharing it via [PactFlow](https://pactflow.io).\n\nIt is using a public tenant on PactFlow, which you can access [here](https://test.pactflow.io/) using the credentials `dXfltyFMgNOFZAxr8io9wJ37iUpY42M`/`O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1`. The latest version of the Example Consumer/Example Provider pact is published [here](https://test.pactflow.io/pacts/provider/pactflow-example-provider/consumer/pactflow-example-consumer/latest).\n\nThe project uses a Makefile to simulate a very simple build pipeline with two stages - test and deploy.\n\n* Test\n  * Run tests (including the pact tests that generate the contract)\n  * Publish pacts, associating the consumer version with the name of the current branch\n  * Check if we are safe to deploy to prod (ie. has the pact content been successfully verified)\n* Deploy (only from master)\n  * Deploy app (just pretend for the purposes of this example!)\n  * Record the deployment in the Pact Broker\n\n## Usage\n\nSee the [PactFlow CI/CD Workshop](https://github.com/pactflow/ci-cd-workshop).\n\n## Running the application\n\nStart up the [provider](https://github.com/pactflow/example-provider/) (or another [compatible](https://docs.pactflow.io/docs/examples) provider) API by running `npm run start`.\n\nOpen a separate terminal for the consumer.\n\nBefore starting the consumer, create a `.env` file in the root of the project and set the URL to point to your running provider:\n\n```bash\nREACT_APP_API_BASE_URL=http://localhost:8080\n```\n\nThen run:\n\n```bash\nnpm run start\n```\n\n### Pre-requisites\n\n**Software**:\n\n* Tools listed at: https://docs.pactflow.io/docs/workshops/ci-cd/set-up-ci/prerequisites/\n* A pactflow.io account with an valid [API token](https://docs.pactflow.io/#configuring-your-api-token)\n\n\n#### Environment variables\n\nTo be able to run some of the commands locally, you will need to export the following environment variables into your shell:\n\n* `PACT_BROKER_TOKEN`: a valid [API token](https://docs.pactflow.io/#configuring-your-api-token) for PactFlow\n* `PACT_BROKER_BASE_URL`: a fully qualified domain name with protocol to your pact broker e.g. https://testdemo.pactflow.io\n\n### Usage\n\n#### Pact use case\n\n* `make test` - run the pact test locally\n* `make fake_ci` - run the CI process locally\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpactflow%2Fexample-consumer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpactflow%2Fexample-consumer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpactflow%2Fexample-consumer/lists"}