Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 8, Hotwire, Stimulus, no react #122

Open
Alagaesia93 opened this issue Feb 23, 2024 · 16 comments
Open

Rails 8, Hotwire, Stimulus, no react #122

Alagaesia93 opened this issue Feb 23, 2024 · 16 comments

Comments

@Alagaesia93
Copy link

Hello Shopify!

With the upcoming release of Rails 8, I think the default rails template for a Shopify app could deeply change. This is more a topic for discussions, but there is no discussions tab so here I am.

In particular

  • Is React really needed? Embedded apps have a full page reload when changing from the app menu, and inside the app it could easily be another page (index.html.erb to show.html.erb), especially with Hotwire. A full stack dev could just get some Polaris designs and create a fully working app without needing to know one line of React
  • If needed, Stimulus could be used for interactivity, replacing the need for React
  • Kamal will sit on top of Docker / Kubernetes, allowing to deploy everywhere
  • solid queue and solid cache examples (especially on rate limiting Shopify's APIs) => [idea] implementing rate limiting per queue? rails/solid_queue#97

Benefits

  • zero bundling and transpiling - way faster deployments (and easy to debug)
  • way faster development cycle
  • shorter learning curve
  • frontend developers focused on building extensions (admin, storefront, account, checkout etc)

I am very interested in building something like this, I have already seen a few resources online (i.e. https://github.com/kirillplatonov/shopify-hotwire-sample) from @kirillplatonov.

Is it interesting for Shopify as well? I'm asking because I can see an outdated Ruby version on this repo, for example, and official documentation mentioning only Remix templates.

Copy link

This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.

@github-actions github-actions bot added the Stale label Apr 24, 2024
@Alagaesia93
Copy link
Author

Not stale :)

@github-actions github-actions bot removed the Stale label May 1, 2024
@bifo90
Copy link

bifo90 commented May 6, 2024

Yep! I absolutely agree with you. Let's keep a Ruby App template updated 💪

Copy link

github-actions bot commented Jul 6, 2024

This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days.

@github-actions github-actions bot added the Stale label Jul 6, 2024
@jagthedrummer
Copy link

Not stale. Please disable the bot. It's hostile and give the impression that you don't actually want to hear from developers.

@lizkenyon
Copy link
Contributor

Hi there 👋

First of all, I have put up a PR to remove stalebot from this repository. That should have been done months ago when we removed it from other repositories, but some repos were missed, including this one. And sorry for not jumping into this discussion sooner.

We do want to hear the feedback from out community, and thank you for starting this discussion.

Secondly, there has been internal discussions about the future of the ruby template, and what it could look like without React. Including chatting with folks like @kirillplatonov, about their experiences with their template. At this time we don't have anything to announce, but this is a topic the team has been thinking about.

One of the more immediate things we are looking to do is putting together a guide of how to modify the current template without the react frontend.

@paulomarg
Copy link
Contributor

Hey folks, thanks for raising this discussion! As @lizkenyon mentioned, this is something we have been thinking about, and we've added a Wiki page on unplugging the React frontend from the current template. Please let us know if you have any issues with it, or if we missed anything!

I think the OP makes a lot of good points, and we'll make sure to take that feedback into consideration going forward.

In the meantime, I also wanted to get a sense of how the community prefers to set up their UI styles. When not using React:

  • Do folks use Polaris?
  • If so, what is your preferred way of loading / using it?

@jagthedrummer
Copy link

jagthedrummer commented Aug 23, 2024

I'm using the Polaris CSS, and I currently link to it on unpkg. (I just noticed that I'm several versions behind, so I don't know if that's even a possibility anymore. On a quick skim of the "Getting started" bits in the Polaris docs I didn't spot any obvious resources about just importing the CSS and using it to style HTML directly.)

I pull it into my apps via a gem that I made to help manage both the CSS and the markup.

https://github.com/jagthedrummer/polaris_view_helpers

I don't use any of the React stuff.

@dhmacs
Copy link

dhmacs commented Aug 24, 2024

I'm primarily a React dev (being using React since 2015) and I've only learned Rails a couple years ago.

I'd love to see the Shopify Rails template embrace Rails 8 + Hotwire, in fact at my company we've built one in-house because Rails + React template is complicating things that are quite simple in vanilla Rails.

We're currently using Polaris View Components, but it'd be great have an Hotwire solution backed by Shopify team.
It could be styled erb markup + Stimulus controllers to be added where needed

@remy727
Copy link

remy727 commented Oct 22, 2024

Hello @paulomarg, there is a typo in Wiki page

Wrong

Create a new home view in web/views/home/index.html.erb:

Correct

Create a new home view in web/app/views/home/index.html.erb:

How can I create PR to update wiki page?

@lizkenyon
Copy link
Contributor

Thanks for the ping @remy727 I have updated it.

@remy727
Copy link

remy727 commented Oct 22, 2024

@lizkenyon @paulomarg, I unplugging the React frontend by following the steps in Wiki page.

But I can't preview the app. I ran the app using Ngrok tunnel but I always have ERR_NGROK_8012 error. I tried different ports and checked firewall but the same error. I tried original ruby template but it worked well.
You can reproduce the issue on shopify-app-template-ruby-demo

Image

@lizkenyon
Copy link
Contributor

Hi @remy727

Can you please create a new issue for this. Thanks!

@remy727
Copy link

remy727 commented Oct 22, 2024

@lizkenyon, yes. I created #150

@danielfriis
Copy link

danielfriis commented Jan 9, 2025

... and we've added a Wiki page on unplugging the React frontend from the current template. Please let us know if you have any issues with it, or if we missed anything!

@paulomarg I followed your guide, but it seems insufficient to get the app fully working. I can't navigate to other controllers or actions without being redirected to the install-page.

@remy727
Copy link

remy727 commented Feb 6, 2025

@danielfriis, just want to make sure you updated shopify.web.toml file.

# shopify.web.toml

roles = ["frontend"]

[commands]
dev = "bin/rails server"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants