Galvanized Iron Router 2.0.0 Released - Rust-Resistant Routing for Meteor 2.0 & 3.0!

I am excited to release Galvanized Iron Router 2.0.0 - the rustproofed successor to that routing package we all know and love!

Just as galvanizing iron makes it rust-resistant and longer-lasting, this fork gives Iron Router a new lease of life with full Meteor 3.0+ compatibility while maintaining support for Meteor 2.0+.

This was a byproduct of my own efforts to upgrade my existing codebases. I hope this helps everyone else in their quest to modernise their mature Meteor apps. Feel free to fork this package. You can find it on GitHub here:

What’s New:

  1. A single unified package: All the iron:* packages you used to install separately are now consolidated into one package:
  • No more juggling iron:core, iron:layout, iron:controller, etc.
  • Simplified installation and maintenance
  1. Modern Meteor Compatibility:
  • Supports both Meteor 2.0 and 3.0, making it easier to transition to the latest Meteor at your own pace.
  • When run under Meteor 3.0+, it will support the promise-based async/await execution model.
  • When run under Meteor 3.1+, it will use Express instead of the Connect middleware

Installation:

Upgrading is simple - your existing code works unchanged:

meteor remove iron:router
meteor add vlasky:galvanized-iron-router

That’s it! 100% API compatibility with the original Iron Router. Enjoy!

12 Likes

The man. The legend! @vlasky saves the day again! :tada:
I’m in the process of upgrading an old Meteor app to Meteor 3, so this will be super useful.

So if I get this right, the main difference with this:

Is that all of the packages are combined into one?

3 Likes

Apart from combining the separate Iron Router packages into one, these are the differences between Galvanized Iron Router and the Polygonwood fork:

  1. The implementation of RouteController.prototype.dispatch():

    Galvanized Iron Router maximises backward compatibility by checking for the presence of Meteor Fiber support. If it’s enabled, it will dispatch the route function within a Fiber, as Iron Router does. Otherwise it will dispatch the route function asynchronously within a try/catch block.

Here are the two different implementations side-by-side:

  1. Galvanized Iron Router uses the functionality of Express 5 as the body parser when running under Meteor 3.1+. The Polygonwood fork retains the original Iron Router functionality that utilises the body-parser NPM package.
2 Likes

Amazing work, @vlasky. I’m glad someone out there is still carrying on the torch of the classic Meteor/Blaze stack. :clap: :clap: :clap:

6 Likes

We’re trying to use this in our Meteor 3 update and are getting a fatal crash on the server where the package uses Random.id() without importing/using it in package.js. I created an issue and PR for it.

Great work on this! :clap:

1 Like

In Meteor 2.16, I had the following pattern in startup/client/routes.js:

//  Configure and limit how requests are handled
Router.configureBodyParsers = function() {
  Router.onBeforeAction(Iron.Router.bodyParser.urlencoded({
    extended: true,
    limit: '10mb'
  }));
  Router.onBeforeAction(Iron.Router.bodyParser.json({
    limit: '10mb'
  }));
};

I wasn’t sure how to handle this in Meteor 3. On a consult with our friend Claude, he’s saying the above isn’t compatible with Meteor 3’s Express integration, and to add the following pattern somewhere in startup/server:

WebApp.connectHandlers.use(Iron.Router.bodyParser.urlencoded({ 
  extended: true, 
  limit: '10mb' 
}));

WebApp.connectHandlers.use(Iron.Router.bodyParser.json({ 
  limit: '10mb' 
}));

Could you input on on this?

Also, I have another breaking PR awaiting a merge on this package.

Seriously, @vlasky and @polygonwood should do a mini panel on Iron Router support for legacy and modern MeteorJS at Impact 2025.

Just saying.

2 Likes

hell to the yeah!!!

1 Like

@vlasky Would you mind merging this PR, it’s been open for two weeks, this package can crash apps if a DynamicTemplate is used.

We have another breaking bug in vlasky:galvanized-iron-router@2.1.2. Currently unusable in Meteor 3.4.1 with rspack.

Guess it’s probably time to switch to Flow Router anyway. This “Galvanized” version of Iron Router has been a bumpy ride. Looks like @vlasky left the community? Hasn’t logged on in a year.

I’m still around, just have been busy with other work. I’ll take a look at this at my next free moment. You are also free to try fixing it with the assistance of agentic tools.

I also recall having difficulties with Rspack when I last updated my main Meteor app to Meteor 3.4 earlier this year.

2 Likes

@evolross version 2.1.3 has just been released which should fix the bug you reported.

2 Likes

Thanks for coming back! Totally agree here. However, I became discouraged about the time required because it looks like the breakage was due to your ES6/Meteor 3 overhaul. I was worried it wouldn’t be a straightforward fix. I’ve also had PRs waiting for extended bits of time in the past on this project. Appreciate you jumping back in though. Thanks for adding the query param test too.