Shopify Hotwire Sample
The sample app includes:
- JWT integration for Hotwire Turbo
- JWT integration for Rails Request.JS
- App Bridge 2.0
- Polaris ViewComponents
- Hotwire::Livereload
Since the shopify_app
gem is not fully compatible with App Bridge 2 this sample uses fork.
The old App Bridge 1 sample can be found in
app-bridge-1
branch.
Quick start
To run this app locally, you can clone this repository and do the following.
- Connect to Shopify:
shopify rails connect
- Setup Rails app:
bin/setup
- Run
ngrok
on port 3000:
ngrok http 3000
- Start the app:
rails s
- Install and open this app on a development shop.
Optional
- Add an ngrok configuration
~/.ngrok2/ngrok.yml
authtoken: $$$$$$$$$$$
region: eu
tunnels:
hotwire-example:
addr: 3000
proto: http
bind_tls: true
subdomain: hotwire-example
hotwire-webpack:
addr: 3035
proto: http
bind_tls: true
subdomain: hotwire-webpack
host-header: localhost:3035
- Add
NGROK_WEBPACK_TUNNEL
to your.env
file
SHOPIFY_API_KEY=foo
SHOPIFY_API_SECRET=bar
// This is needed so you don't get CORS issues when Webpack pings while inside the Shopify admin
NGROK_WEBPACK_TUNNEL=hotwire-webpack.eu.ngrok.io
- Use foreman to run the Rails server & Webpack at the same time
foreman start -f Procfile.dev