MeteorJS 3.0 major impact estimated for July 2024 ☄️ - here is all you need to know 🧐
Jan Küster
Posted on June 24, 2024
The next major MeteorJS release is coming in July 2024! After more than two years of development, this is the final result. The first discussions started in June 2021 and there has been multiple alphas, betas, rcs and a huge amount of package updates. These were constantly battle-tested by the Meteor Core team and the Community, shaping the features and performance of the platform one by one.
Table of contents
- Back in 2021 - the Fibers situation
- Biggest changes
- Will it have consequences?
- Conclusion
- Resources to help you migrate your Meteor app
Back in 2021 - the Fibers situation
MeteorJS emerged from a JavaScript framework towards a true full-stack development platform, batteries included. One of its greatest advantages was to provide features like optimistic UI, zero-config, reactivity out of the box and support for many popular front-ends, which are still among its core features nowadays.
Since pre-1.0 versions, MeteorJS relied on fibers
(coroutines) as its back-end for async programming, long before async/await
became a thing. That was revolutionary for developers: writing async code naturally, in sync-style, without callbacks or other nesting structures, resulting in more comprehensible code and a better developer experience.
In April 2021, fibers
became incompatible with Node 16 and therefore, Meteor was pinned to Node 14. It was clear that that replacing fibers
with async/await
for the entire ecosystem was the only future for MeteorJS. That way, it would always be up-to-date with the latest Node LTS and support the majority of NPM packages out there.
Biggest changes
The core-repository development for this major release gathered over 2300 commits, affecting over 800 files, split in over 200 pull requests, involving contributors from the Meteor Core team and the Community. The efforts for all affected packages are uncountable as they are distributed across the whole community.
The following table lists the most impactful changes:
change | what happend |
---|---|
dropping Fibers | replace any fibers -reliance with async/await
|
top-level await | use async/await without the need for an IIFE |
async database | make all MongoDB interactions async/await
|
async accounts and oauth | ensure accounts, 2FA, passwordless and OAuth packages are async and thus, still zero-config |
ARM support | finally support MeteorJS on ARM architectures |
replace connect with express | drop connect to use express as webserver |
docs upgrade | the entire documentation system was rewritten, replacing hexo with docusaurus, integrating Ask AI into the new docs |
upgrade Node | stick to the latest Node LTS (20 as of writing this article) |
update DDP | make the whole DDP/Websocket infrastructure and data layer compatible with the async/await while avoid breaking isomorphism where possible |
update build system | make the build system (isobuild) work without fibers
|
Galaxy 2 | the official zero-config hosting platform for MeteorJS apps has been upgraded with a facelift and many quality of life features |
Furthermore, there were many fixes, patches, and updates to NPM dependencies and skeleton projects, all aimed at ensuring that MeteorJS remains zero-config by default for many of its core features.
Will it have consequences?
If you are new to MeteorJS:
No worries! Just follow the new docs to create a new project with Meteor 3.0 and develop amazing apps quickly.
$ npm install -g meteor
$ meteor create --release 3.0-rc.4 # soon --release is not required anymore
If you have an existing Meteor apps or packages:
Every (I repeat: every) Meteor app out there was affected! They had to be rewritten in order to being able to upgrade towards 3.0 or otherwise being stuck on Node 14.
This especially involves any database interaction, the backbone of most MeteorJS apps. It also applied to any package with reliance on fibers
. Consider the following example:
import { Meteor } from 'meteor/meteor'
import { Mongo } from 'meteor/mongo'
const Tasks = new Mongo.Collection('tasks')
Before 3.0, using fibers
Meteor.methods({
updateTask ({ _id, text }) {
const taskDoc = Tasks.findOne({ _id })
if (taskDoc.createdBy !== this.userId) {
throw new Meteor.Error(403, 'permission denied', 'not owner')
}
return Tasks.update({ _id }, { $set: { text }})
}
})
After 3.0, using async/await
Meteor.methods({
async updateTask ({ _id, text }) {
const taskDoc = await Tasks.findOneAsync({ _id })
if (taskDoc.createdBy !== this.userId) {
throw new Meteor.Error(403, 'permission denied', 'not owner')
}
return Tasks.updateAsync({ _id }, { $set: { text }})
}
})
It looks not that much but beware that it breaks isomorphism, another core concept of MeteorJS, where code can be shared across server and client. This, combined with the size and structure of medium or large-sized apps can result in a migration effort of multiple months, involving multiple developers.
Another big task was to resolve the version conflicts in the packages, since all of the MeteorJS core packages were updated to a new major version. Thankfully, the Meteor Community Ambassadors (StoryTellerCZ, Alim Gafar, and I) collaborated to create a detailed guide covering this topic:
Conclusion
The next major MeteorJS release is coming in a few weeks, and of course, there will be changes if you have Meteor apps and packages. To help you prepare for all of them, I have made a list below to help you.
Resources to help you migrate your Meteor app
- Read the migration guide
- Read on how to prepare your 2.x app for async
- Read the new meteor 3.0 docs
- Read on extended Node 14 support with security patches
- Subscribe to the Meteor Community Dispatches podcast to stay up to date
- Consult StorytellerCZ, Meteor ambassador and one of the (if not the) most active contributors from the community for help
- Join the Meteor forums and ask for help and guidance
I hope you enjoy this read and see you on Meteor Community!
About me 👋
I regularly publish articles about MeteorJS and JavaScript here on dev.to. I also recently co-hosted the weekly MeteorJS Community Podcast, which covers the latest in Meteor and the community.
You can also find me (and contact me) on GitHub, Twitter/X and LinkedIn.
If you like what you read and want to support me, you can sponsor me on GitHub or buy me a book from my Amazon wishlist.
Posted on June 24, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
June 24, 2024