[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8102":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":29,"discoverSource":30},8102,"shopify_app","Shopify\u002Fshopify_app","Shopify","A Rails Engine for building Shopify Apps","",null,"Ruby",1912,726,492,30,0,2,8,6,21.58,"MIT License",false,"main",true,[],"2026-06-12 02:01:49","# Shopify App\n\n[![Version][gem]][gem_url] [![Build Status](https:\u002F\u002Fgithub.com\u002FShopify\u002Fshopify_app\u002Fworkflows\u002FCI\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FShopify\u002Fshopify_app\u002Factions?query=workflow%3ACI)\n\n[gem]: https:\u002F\u002Fimg.shields.io\u002Fgem\u002Fv\u002Fshopify_app.svg\n[gem_url]: https:\u002F\u002Frubygems.org\u002Fgems\u002Fshopify_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](\u002FCONTRIBUTING.md) |\n[License](\u002FLICENSE)\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](\u002Fdocs\u002Fshopify_app\u002Fengine.md) provides all the code required to implement OAuth with Shopify. The [default Shopify App generator](\u002Fdocs\u002Fshopify_app\u002Fgenerators.md#-environment-rails-generate-shopify_app) builds an app that can be embedded in the Shopify Admin and secures it with [session tokens](https:\u002F\u002Fshopify.dev\u002Fconcepts\u002Fapps\u002Fbuilding-embedded-apps-using-session-tokens).\n\n\u003C!-- This section is linked to in `templates\u002Fshopify_app.rb.tt`. Be careful renaming this heading. -->\n## Requirements\n\nTo become a Shopify app developer, you will need a [Shopify Partners](https:\u002F\u002Fwww.shopify.com\u002Fpartners) account. Explore the [Shopify dev docs](https:\u002F\u002Fshopify.dev\u002Fconcepts\u002Fshopify-introduction) to learn more about [building Shopify apps](https:\u002F\u002Fshopify.dev\u002Fconcepts\u002Fapps).\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:\u002F\u002Fpartners.shopify.com\u002Forganizations).\n- **Shopify API secret:** The API secret key app credential specified in your [Shopify Partners dashboard](https:\u002F\u002Fpartners.shopify.com\u002Forganizations).\n\n## Usage\n\n> [!NOTE]\n> This package works best with the Shopify CLI. Learn more at https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Fbuild\u002Fcli-for-apps\n> \n> To get started with a Rails app already connected to the Shopify CLI, run `shopify app init --template=ruby` for a complete setup app. (Recommended)\n> Follow the instructions below to use this gem with a new or existing Rails app.\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. Connect the Shopify CLI to your app:\n\n### Setting up Shopify CLI\n\nFor a more detailed guide on how to set up Shopify CLI, see the [Shopify CLI documentation](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Fbuild\u002Fcli-for-apps\u002Fapp-structure).\n\nTo use your Rails app with Shopify CLI, you'll need to create the required configuration files and set up your project structure:\n\n1. Create a `package.json` file in your app's root directory:\n\n```json\n{\n  \"name\": \"my-shopify-app\",\n  \"version\": \"1.0.0\",\n  \"description\": \"Shopify app built with Rails\",\n  \"scripts\": {},\n  \"dependencies\": {},\n  \"engines\": {\n    \"node\": \">=18.0.0\"\n  }\n}\n```\nThis is required for the Shopify CLI to work. It will be used if you add extension like Checkout UI [extensions](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapi\u002Fcheckout-extensions) to your app.\n\n2. Create a `shopify.app.toml` configuration file in your app's root:\n\n```toml\n# Learn more about configuring your app at https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Ftools\u002Fcli\u002Fconfiguration\n\nclient_id = \"\"\nname = \"My Shopify App\"\nhandle = \"my-shopify-app\"\napplication_url = \"https:\u002F\u002Flocalhost:3000\"\nembedded = true\n\n[access_scopes]\n# Learn more at https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Ftools\u002Fcli\u002Fconfiguration#access_scopes\nscopes = \"write_products\"\n\n[auth]\nredirect_urls = [\n  \"https:\u002F\u002Flocalhost:3000\u002Fapi\u002Fauth\",\n  \"https:\u002F\u002Flocalhost:3000\u002Fapi\u002Fauth\u002Fcallback\",\n  \"https:\u002F\u002Flocalhost:3000\u002Fauth\u002Fcallback\",\n  \"https:\u002F\u002Flocalhost:3000\u002Fauth\u002Fshopify\u002Fcallback\"\n]\n\n[webhooks]\napi_version = \"2024-10\"\n\n[[webhooks.subscriptions]]\ntopics = [\"app\u002Funinstalled\"]\nuri = \"\u002Fapi\u002Fwebhooks\"\n\n[pos]\nembedded = false\n\n[build]\nautomatically_update_urls_on_dev = true\ndev_store_url = \"YOUR-DEV-STORE.myshopify.com\"\n```\n\n3. Create a `shopify.web.toml` file to configure how Shopify CLI runs your Rails app:\n\n```toml\n# Learn more about configuring your app at https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Ftools\u002Fcli\u002Fconfiguration\n\n[commands]\ndev = \"bin\u002Frails server -b 0.0.0.0 -e development\"\nbuild = \"RAILS_ENV=production bin\u002Frails assets:precompile\"\n```\n\n4. (Optional) Update your Rails development configuration to allow Shopify's tunnel hosts. In `config\u002Fenvironments\u002Fdevelopment.rb`, add:\n\n```ruby\nRails.application.configure do\n  # Allow ngrok tunnels for secure Shopify OAuth redirects\n  config.hosts = (config.hosts rescue []) \u003C\u003C \u002F[-\\w]+\\.ngrok\\.io\u002F\n  # Allow Cloudflare tunnels for secure Shopify OAuth redirects\n  config.hosts = (config.hosts rescue []) \u003C\u003C \u002F[-\\w]+\\.trycloudflare\\.com\u002F\n  \n  # Or to allow all hosts in development (less secure):\n  # config.hosts.clear\n  \n  # ... rest of your configuration\nend\n```\nWith the Shopify CLI you can use [localhost development](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Fbuild\u002Fcli-for-apps\u002Fdevelopment) to run your app.\n\n5. Generate your API credentials\n```\nshopify app config link\n> create a new app\n```\n\n6. 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\n7. Run a migration to create the necessary tables in your database:\n\n```sh\nrails db:migrate\n```\n\n8. Start the dev server and install the app\n```\nshopify app dev\n```\nClink on the Preview URL to install the app and view it in the Shopify Admin\n\nThis app implements [OAuth 2.0 Token Exchange](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Fbuild\u002Fauthentication-authorization\u002Faccess-tokens\u002Ftoken-exchange) with Shopify to authenticate requests made to Shopify APIs. By default, this app is configured to use [session tokens](https:\u002F\u002Fshopify.dev\u002Fconcepts\u002Fapps\u002Fbuilding-embedded-apps-using-session-tokens) to authenticate merchants when embedded in the Shopify Admin.\n\nSee [*Generators*](\u002Fdocs\u002Fshopify_app\u002Fgenerators.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 [`\u002Fdocs`](\u002Fdocs).\n\n* Start with the [*Generators*](\u002Fdocs\u002Fshopify_app\u002Fgenerators.md) document to learn more about the generators this gem offers.\n* Check out the [*Changelog*](\u002FCHANGELOG.md) for notes on the latest gem releases.\n* See [*Troubleshooting*](\u002Fdocs\u002FTroubleshooting.md) for tips on common issues.\n* If you are looking to upgrade your Shopify App version to a new major release, see [*Upgrading*](\u002Fdocs\u002FUpgrading.md) for important notes on breaking changes.\n\n### Overview\n\n[Quickstart](\u002Fdocs\u002FQuickstart.md)\n\n[Troubleshooting](\u002Fdocs\u002FTroubleshooting.md)\n\n[Upgrading](\u002Fdocs\u002FUpgrading.md)\n\n[Shopify App](\u002Fdocs\u002Fshopify_app)\n  * [Authentication](\u002Fdocs\u002Fshopify_app\u002Fauthentication.md)\n  * [Engine](\u002Fdocs\u002Fshopify_app\u002Fengine.md)\n  * [Controller Concerns](\u002Fdocs\u002Fshopify_app\u002Fcontroller-concerns.md)\n  * [Generators](\u002Fdocs\u002Fshopify_app\u002Fgenerators.md)\n  * [Sessions](\u002Fdocs\u002Fshopify_app\u002Fsessions.md)\n  * [Testing](\u002Fdocs\u002Fshopify_app\u002Ftesting.md)\n  * [Webhooks](\u002Fdocs\u002Fshopify_app\u002Fwebhooks.md)\n  * [Content Security Policy](\u002Fdocs\u002Fshopify_app\u002Fcontent-security-policy.md)\n  * [Logging](\u002Fdocs\u002Fshopify_app\u002Flogging.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`  | `\u002Flogin`                 | Login              |\n| `POST` | `\u002Flogin`                 | Login              |\n| `GET`  | `\u002Fauth\u002Fshopify\u002Fcallback` | OAuth redirect URI |\n| `GET`  | `\u002Flogout`                | Logout             |\n| `POST` | `\u002Fwebhooks\u002F:type`        | Webhook callback   |\n\nThese routes are configurable. See the more detailed [*Engine*](\u002Fdocs\u002Fshopify_app\u002Fengine.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*](\u002Fdocs\u002Fshopify_app\u002Fauthentication.md).\n\n### New embedded app authorization strategy (Token Exchange)\n\n> [!TIP]\n> If you are building an embedded app, we **strongly** recommend using [Shopify managed installation](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Fauth\u002Finstallation#shopify-managed-installation)\n> with [token exchange](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Fauth\u002Fget-access-tokens\u002Ftoken-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:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Fauth\u002Fget-access-tokens\u002Fauthorization-code-grant).\n\nThis is achieved by using [Shopify managed installation](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Fauth\u002Finstallation#shopify-managed-installation)\nto handle automatic app installations and scope updates, while utilizing\n[token exchange](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Fauth\u002Fget-access-tokens\u002Ftoken-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:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Fauth\u002Finstallation#shopify-managed-installation)\n    by configuring your scopes [through the Shopify CLI](https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapps\u002Ftools\u002Fcli\u002Fconfiguration).\n> [!NOTE]\n> 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> 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\u002Finitializers\u002Fshopify_app.rb\nShopifyApp.configure do |config|\n  #.....\n  config.embedded_app = true\n  config.new_embedded_auth_strategy = true\n\n  # You can enable session expiry date check so a new access token is fetched automatically when the session expires.\n  # See expiry date check docs: https:\u002F\u002Fgithub.com\u002FShopify\u002Fshopify_app\u002Fblob\u002Fmain\u002Fdocs\u002Fshopify_app\u002Fsessions.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](\u002Fdocs\u002Fshopify_app\u002Fauthentication.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](\u002Fdocs\u002Fshopify_app\u002Fcontroller-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:\u002F\u002Fshopify.dev\u002Fconcepts\u002Fabout-apis\u002Fversioning). 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:\u002F\u002Fshopify.dev\u002Fconcepts\u002Fabout-apis\u002Fversioning#deprecation-practices).\n\nSee the [Shopify API gem README](https:\u002F\u002Fgithub.com\u002FShopify\u002Fshopify-api-ruby\u002F) for more information.\n","Shopify\u002Fshopify_app 是一个用于构建 Shopify 应用的 Ruby on Rails 引擎。它提供了一系列生成器、模块和混入功能，帮助开发者创建与 Shopify API 交互的应用程序，并且内置了实现 OAuth 认证所需的所有代码。此外，通过使用默认生成器可以快速搭建出能够嵌入到 Shopify 后台管理界面的应用，并利用会话令牌来确保安全。该项目非常适合那些希望为 Shopify 商店开发定制化应用或集成服务的开发者使用。","2026-06-11 03:16:05","top_language"]