{"id":21824511,"url":"https://github.com/shopify/shopify_app","last_synced_at":"2025-05-15T00:04:34.487Z","repository":{"id":439334,"uuid":"61203","full_name":"Shopify/shopify_app","owner":"Shopify","description":"A Rails Engine for building Shopify Apps","archived":false,"fork":false,"pushed_at":"2025-05-12T11:54:01.000Z","size":5574,"stargazers_count":1811,"open_issues_count":29,"forks_count":711,"subscribers_count":555,"default_branch":"main","last_synced_at":"2025-05-15T00:02:23.949Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/Shopify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2008-10-09T15:10:52.000Z","updated_at":"2025-05-13T07:52:08.000Z","dependencies_parsed_at":"2024-01-22T16:44:46.897Z","dependency_job_id":"236ee520-9857-4d33-a559-552de95365ec","html_url":"https://github.com/Shopify/shopify_app","commit_stats":{"total_commits":1538,"total_committers":260,"mean_commits":5.915384615384616,"dds":0.9401820546163849,"last_synced_commit":"5aa51c48c30017fb87e5cbc3e99b384466e75405"},"previous_names":[],"tags_count":208,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fshopify_app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fshopify_app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fshopify_app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fshopify_app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shopify","download_url":"https://codeload.github.com/Shopify/shopify_app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249199,"owners_count":22039029,"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-11-27T17:58:51.742Z","updated_at":"2025-05-15T00:04:34.404Z","avatar_url":"https://github.com/Shopify.png","language":"Ruby","readme":"# Shopify App\n\n[![Version][gem]][gem_url] [![Build Status](https://github.com/Shopify/shopify_app/workflows/CI/badge.svg)](https://github.com/Shopify/shopify_app/actions?query=workflow%3ACI)\n\n[gem]: https://img.shields.io/gem/v/shopify_app.svg\n[gem_url]: https://rubygems.org/gems/shopify_app\n\nThis gem builds Rails applications that can be embedded in the Shopify Admin.\n\n[Introduction](#introduction) |\n[Requirements](#requirements) |\n[Usage](#usage) |\n[Documentation](#documentation) |\n[Contributing](/CONTRIBUTING.md) |\n[License](/LICENSE)\n\n\n## Introduction\n\nThis gem includes a Rails engine, generators, modules, and mixins that help create Rails applications that work with Shopify APIs. The [Shopify App Rails engine](/docs/shopify_app/engine.md) provides all the code required to implement OAuth with Shopify. The [default Shopify App generator](/docs/shopify_app/generators.md#-environment-rails-generate-shopify_app) builds an app that can be embedded in the Shopify Admin and secures it with [session tokens](https://shopify.dev/concepts/apps/building-embedded-apps-using-session-tokens).\n\n\u003c!-- This section is linked to in `templates/shopify_app.rb.tt`. Be careful renaming this heading. --\u003e\n## Requirements\n\nTo become a Shopify app developer, you will need a [Shopify Partners](https://www.shopify.com/partners) account. Explore the [Shopify dev docs](https://shopify.dev/concepts/shopify-introduction) to learn more about [building Shopify apps](https://shopify.dev/concepts/apps).\n\nThis gem requires that you have the following credentials:\n\n- **Shopify API key:** The API key app credential specified in your [Shopify Partners dashboard](https://partners.shopify.com/organizations).\n- **Shopify API secret:** The API secret key app credential specified in your [Shopify Partners dashboard](https://partners.shopify.com/organizations).\n\n## Usage\n\n1. To get started, create a new Rails app:\n\n``` sh\nrails new my_shopify_app\n```\n\n2. Add the Shopify App gem to the app's Gemfile:\n\n```sh\nbundle add shopify_app\n```\n\n3. You will need to provide several environment variables to the app.\nThere are a variety of way of doing this, but for a development environment we recommended the [`dotenv-rails`](https://github.com/bkeepers/dotenv) gem.\nCreate a `.env` file in the root of your Rails app to specify the full host and Shopify API credentials:\n\n```sh\nHOST=http://localhost:3000\nSHOPIFY_API_KEY=\u003cYour Shopify API key\u003e\nSHOPIFY_API_SECRET=\u003cYour Shopify API secret\u003e\n```\n\n4. Run the default Shopify App generator to create an app that can be embedded in the Shopify Admin:\n\n```sh\nrails generate shopify_app\n```\n\n5. Run a migration to create the necessary tables in your database:\n\n```sh\nrails db:migrate\n```\n\n6. Run the app:\n\n```sh\nrails server\n```\n\n7. Within [Shopify Partners](https://www.shopify.com/partners), navigate to your App, then App Setup, and configure the URLs, e.g.:\n\n  * App URL: http://localhost:3000/\n  * Allowed redirection URL(s): http://localhost:3000/auth/shopify/callback\n\n8. Install the app by visiting the server's URL (e.g. http://localhost:3000) and specifying the subdomain of the shop where you want it to be installed to.\n\n9. After the app is installed, you're redirected to the embedded app.\n\nThis app implements [OAuth 2.0](https://shopify.dev/tutorials/authenticate-with-oauth) with Shopify to authenticate requests made to Shopify APIs. By default, this app is configured to use [session tokens](https://shopify.dev/concepts/apps/building-embedded-apps-using-session-tokens) to authenticate merchants when embedded in the Shopify Admin.\n\nSee [*Generators*](/docs/shopify_app/generators.md) for a complete list of generators available to Shopify App.\n\n## Documentation\n\nYou can find documentation on gem usage, concepts, mixins, installation, and more in [`/docs`](/docs).\n\n* Start with the [*Generators*](/docs/shopify_app/generators.md) document to learn more about the generators this gem offers.\n* Check out the [*Changelog*](/CHANGELOG.md) for notes on the latest gem releases.\n* See [*Troubleshooting*](/docs/Troubleshooting.md) for tips on common issues.\n* If you are looking to upgrade your Shopify App version to a new major release, see [*Upgrading*](/docs/Upgrading.md) for important notes on breaking changes.\n\n### Overview\n\n[Quickstart](/docs/Quickstart.md)\n\n[Troubleshooting](/docs/Troubleshooting.md)\n\n[Upgrading](/docs/Upgrading.md)\n\n[Shopify App](/docs/shopify_app)\n  * [Authentication](/docs/shopify_app/authentication.md)\n  * [Engine](/docs/shopify_app/engine.md)\n  * [Controller Concerns](/docs/shopify_app/controller-concerns.md)\n  * [Generators](/docs/shopify_app/generators.md)\n  * [Sessions](/docs/shopify_app/sessions.md)\n  * [Handling changes in access scopes](/docs/shopify_app/handling-access-scopes-changes.md)\n  * [Testing](/docs/shopify_app/testing.md)\n  * [Webhooks](/docs/shopify_app/webhooks.md)\n  * [Content Security Policy](/docs/shopify_app/content-security-policy.md)\n  * [Logging](/docs/shopify_app/logging.md)\n\n### Engine\n\nMounting the Shopify App Rails Engine provides the following routes. These routes are configured to help install your application on shops and implement OAuth.\n\n| Verb   | Route                    | Action             |\n|   ---: | :---                     | :---               |\n| `GET`  | `/login`                 | Login              |\n| `POST` | `/login`                 | Login              |\n| `GET`  | `/auth/shopify/callback` | OAuth redirect URI |\n| `GET`  | `/logout`                | Logout             |\n| `POST` | `/webhooks/:type`        | Webhook callback   |\n\nThese routes are configurable. See the more detailed [*Engine*](/docs/shopify_app/engine.md) documentation to learn how you can customize the login URL or mount the Shopify App Rails engine at nested routes.\n\nTo learn more about how this gem authenticates with Shopify, see [*Authentication*](/docs/shopify_app/authentication.md).\n\n### New embedded app authorization strategy (Token Exchange)\n\n\u003e [!TIP]\n\u003e If you are building an embedded app, we **strongly** recommend using [Shopify managed installation](https://shopify.dev/docs/apps/auth/installation#shopify-managed-installation)\n\u003e with [token exchange](https://shopify.dev/docs/apps/auth/get-access-tokens/token-exchange) instead of the legacy authorization code grant flow.\n\nWe've introduced a new installation and authorization strategy for **embedded apps** that\neliminates the redirects that were previously necessary.\nIt replaces the existing [installation and authorization code grant flow](https://shopify.dev/docs/apps/auth/get-access-tokens/authorization-code-grant).\n\nThis is achieved by using [Shopify managed installation](https://shopify.dev/docs/apps/auth/installation#shopify-managed-installation)\nto handle automatic app installations and scope updates, while utilizing\n[token exchange](https://shopify.dev/docs/apps/auth/get-access-tokens/token-exchange) to retrieve an access token for\nauthenticated API access.\n\n##### Enabling this new strategy in your app\n\n1. Enable [Shopify managed installation](https://shopify.dev/docs/apps/auth/installation#shopify-managed-installation)\n    by configuring your scopes [through the Shopify CLI](https://shopify.dev/docs/apps/tools/cli/configuration).\n\u003e [!NOTE]\n\u003e Ensure you don't have `use_legacy_install_flow = true` in your `shopify.app.toml` configuration file. If `use_legacy_install_flow` is true, Shopify will not manage the installation process for your app.\n\u003e You should remove the `use_legacy_install_flow` line from your `shopify.app.toml` configuration file or set it to `false`.\n\n2. Enable the new auth strategy in your app's ShopifyApp configuration file.\n\n```ruby\n# config/initializers/shopify_app.rb\nShopifyApp.configure do |config|\n  #.....\n  config.embedded_app = true\n  config.new_embedded_auth_strategy = true\n\n  # If your app is configured to use online sessions, you can enable session expiry date check so a new access token\n  # is fetched automatically when the session expires.\n  # See expiry date check docs: https://github.com/Shopify/shopify_app/blob/main/docs/shopify_app/sessions.md#expiry-date\n  config.check_session_expiry_date = true\n  ...\nend\n\n```\n3. Handle special callback logic. If your app has overridden the OAuth CallbackController to run special tasks post authorization,\nyou'll need to create and configure a custom PostAuthenticateTasks class to run these tasks after the token exchange. The original\nOAuth CallbackController will not be triggered anymore. See [Post Authenticate Tasks documentation](/docs/shopify_app/authentication.md#post-authenticate-tasks) for more information.\n4. Make sure your `embedded_app` layout is correct. If your app has any controller which includes `ShopifyApp::EnsureInstalled`, they will now also include the `ShopifyApp::EmbeddedApp` concern, which sets `layout 'embedded_app'` for the current controller by default. In cases where the controller originally looked for another layout file, this can cause unexpected behavior. See [`EmbeddedApp` concern's documentation](/docs/shopify_app/controller-concerns.md#embeddedapp) for more information on the effects of this concern and how to disable the layout change if needed.\n5. Enjoy a smoother and faster app installation process.\n\n### API Versioning\n\n[Shopify's API is versioned](https://shopify.dev/concepts/about-apis/versioning). With Shopify App `v1.11.0`, the included Shopify API gem allows developers to specify and update the Shopify API version they want their app or service to use. The Shopify API gem also surfaces warnings to Rails apps about [deprecated endpoints, GraphQL fields and more](https://shopify.dev/concepts/about-apis/versioning#deprecation-practices).\n\nSee the [Shopify API gem README](https://github.com/Shopify/shopify-api-ruby/) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshopify%2Fshopify_app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshopify%2Fshopify_app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshopify%2Fshopify_app/lists"}