Can you recommend flowrouter-ssr?

Currently, I am using FlowRouter for routing. Now, I am in need for server-side rendering. For instance, I would like to send og:image meta tags for Twitter and Facebook alongside with certain pages (e.g. user profiles).

I know that FlowRouter in general is somehow deprecated since Kadira left the community, but still, there’s no better router around, at least for Blaze. So I am asking myself if I can “risk” to switch from flowrouter to flowrouter-ssr.

Does anybody know about the actual state of this project, i.e. how “reliable” it is, any incompatibilities with FlowRouter or major bugs? The issue list is quite long. All my subscriptions are done on template-level, so this incompatibility to FlowRouter 2.0 would be no problem for me.

Should there be other alternatives to achieve SSR, please let me know :slight_smile: Thanks.

(BTW: Has anybody already volunteered to either take over flowrouter or flowrouter-ssr? I am wondering how MDG will deal with the problem that vital parts of the Meteor ecosystem, like routing, are now somewhat deprecated.)

If you are using Blaze, you won’t be able to do server side rendering with flow-router. According to the docs, at least. (I could be mistaken, though).

If you are just interesting in SEO, there is a solution/workaround here: https://github.com/arunoda/meteor-seo-without-spiderable. Not the most elegant solution, but it might work for your use case.

@mitar’s Blaze Components also supports server side rendering (https://github.com/peerlibrary/meteor-blaze-components). Unfortunately, I have no idea how well it works or how to go about implementing it because I have never used it. (Sorry @mitar!! I love your work, though!)

1 Like

Thanks for your fast reply and pointing me to the packages.

(It’s really a pitty how the Meteor community is fragmented now. How I loved those days where every package “just worked”, without any caveats regarding Blaze, Angular, React, GraphQL…)

3 Likes

I know some people seem to be running from Arunoda’s (or other people’s abandonware), but if you are already using FR, Picker may be an option?

I followed the awesome instructions laid out by @khamoud over here.

Been using it for a month or two without issue. One thing to note is that if you have a permissions scheme for visibility (restricting access to paid users, etc), you will need to account for that, as this sets up your routes to be publicly scrapeable.

4 Likes

Thanks, this looks very promising!

1 Like

Awesome, thanks for this! I was just wondering how to get Facebook to pull dynamic OpenGraph images from my Meteor app’s routes.

2 Likes

I feel it, too.

It’s funny that you posted this today, because I spent several hours studying server side rendering with meteor last night. Good timing! I basically just regurgitated my findings. I feel like an expert now! But yeah, I hit the same pain points and had very similar thoughts (at least in regards to this topic).

Actually, my biggest wish with Meteor would be to see an integration on the level of Next and Electrode. I think they do some very interesting things to optimize page loads and support SEO/SSR. I am really curious and interested as to how that integration could/should work.

1 Like

Oh, I should also mention…

If you are only interested in SEO, prerender might be an options. I say “might” because I recall @joshowens saying before that he had some problems integrating it. Unfortunately, I don’t recall where or how to find it again… I think it may have been in a post about the Crater.io relaunch and why he opted for SSR. I’d hate to misrepresent his words, so I tagged him in case he would like to clear anything up on that.

I wasn’t interested in paying a monthly fee for prerender.io just to get SEO working. On top of that, I deployed a prerender server of my own on digital ocean using docker, on a 1gb droplet and found that it wasn’t stable/fast enough and Google was showing a good bit of 502 errors in their logs :frowning:

Moving to SSR dramatically improved my error rates and speeds, but the caveat is that you need to really be careful and figure out a way to get some caching in front of the SSR server to ensure you don’t overrun the server. SSR just moves the processing time and CPU usage from the browser to the server, which can be dangerous.

2 Likes

Thanks for these insights!

And yes, I also did not want to pay a monthly fee just to get SEO working. :slight_smile:

One question, @joshowens: How exactly are you doing your SSR now?

For thus who might be interested, I’ve started an SSR project here : https://github.com/ssr-server/ssr

It’s in its infancy but it already displays react-router@4 demo. It’s based on React + React-router + Express, … and of course Meteor.

I plan on handling server side caching of templates with Electrode caching mechanism, data caching, service worker and application cache (for iOS, Safari & IE).

2 Likes

Will definitely be checking this out!

It is React, so Meteor-React-Router-SSR package, works great. Hit one weird snag with an html comment getting tangled up with the fast render injector, but removed the comment and everything started working.

Also, I will say it again, please make sure to put caching in place if you turn on SSR… At least on some level.

1 Like

Thanks for the additional infos! Guess I will have to switch to React now (or give Picker a try instead)… May I additionally ask you what you are using for caching Crater? Probably a cache built right into the web server, e.g. nginx?

Interesting. Would it be possible to use this as an additional router for just SSR, or do I have to swtich everything to React to make it work. I am using Blaze + FlowRouter for client-side routing at the moment.

1 Like

Actually, this solution provides the router. It’s deep linked to react-router@4 and its match capabilities. Plus, the planned caching will take one of the most interesting part of Electrode.

It could be doable to recreate a router that matches react-router client & server capabilities. Identically, recreating a caching strategy for Blaze is also doable as Templates can be rendered to string. But… well, that would require a lot of work.

1 Like

I was expecting you to say that :slight_smile: Everytime I come across cool stuff, it’s React only… Guess I will have to do the switch now.

You mean something like CloudFlare?

React might not be the solution as well ! If you go for react then you are probably going to use this : https://atmospherejs.com/reactrouter/react-router-ssr

And if you click on the github link (https://github.com/thereactivestack-legacy/meteor-react-router-ssr), you will see a warning

WARNING: This project is no longer in active maintenance.

If you use this package you will end up with this issue https://github.com/thereactivestack-legacy/meteor-react-router-ssr/issues/106 and thus you can’t use react router v4 or even v3.

So I can say everything related to Meteor is deprecated in these days, so maybe the meteor itself is deprecated. I was trying to move from blaze to react myself too and in the middle of process I find out that many react related packages are not getting updated any more and thus I’m currently in process of leaving meteor.

1 Like