Diving into Meteor internals

I’m currently going trough the Meteor internals, but some of the things seem a bit unclear to me. Eventually I will figure it out, but can some help me understand some things? Specifically:

  • Meteor.EnvironmentVariable

Doesnt matter if its videos, people that can help me or a small description of what it does (specifically slots)

4 Likes

I have been digging in to the packages side of the Meteor code (as opposed to the tool side) and would like to document Meteor internals in the guide as a long term goal. I dont have an answer for your question unfortunately but I thought i would add to this thread and see what kind of information had to share or would like to see documented in the future.

My focus up to now has been reviewing the WebApp package, MiniMongo, Tracker, the mongodb package and the DDP communications code.

These packages all require a level of dedication to understanding but once this code is documented well it will hopefully be easier for people to make alterations to the code in the future. That is my hope anyway.

I also feel like this would let the full time Meteor employees focus on the tool itself.

4 Likes

I would love to do a first principle approach on these packages. First really understand n dept what they do and then rebuild from scratch as an optional addition to meteor. That would be a nice way of decoupling.

Its a bit like the spacex approach on Falcon 9. :slightly_smiling_face:

1 Like

I’m a really big fan of this approach (both 1st principles & decomposition for understanding) and getting the Meteor community involved in more deeply learning what drives the “Meteor Magic” as it was described in the early days :grinning::heart: Meteor is hard to replace because it does some really great things for us and it took some very deep engineering & string to together beautifully along with some percentage of $53 mil that went into the actual engineering work :partying_face: I think we have to make it easier for new devs to learn the deeper value of Meteor, which usually only comes from diving in.

I’ve done some of this digging & learning just for my own project and personal deeper understandings, so I’d be happy to add to this or help where I can. I’ve had the same feeling about discovering the “intenrals”, I kind of call this the “architecture choices” of Meteor and it is especially important when integrating Meteor with each front-end (view layer) and other core projects in the JS eco-system.

Here are a couple of cool things I think I’ve learned so far, that might be helpful, I’m just listing them based on what I know so far, and it might give others a chance to expand or cover what I’ve missed. Or correct something if I have it wrong.

Here is a list of what I’ve started to learn about in the Meteor internals:

  1. Fibers which I don’t fully understand yet, but I believe they are linked to the the Meteor.EnvironmentVariable (old discussion here would help I think). Fibers are maybe the most important rarely discussed feature of Meteor, I think because it’s a pretty advanced topic. A good write up by @npvn was done a while back here. Also a Stack Overflow here is helpful. I think Meteor uses fibers heavily in it’s internals. I’ve read several blog posts over the years about this concept and why it’s core to Meteor.

  2. webapp based on connect, this is the most common way to handle webhooks in Meteor and often is not know about by new devs. Took me some time before I realized it was based on connect, and that I could use those docs to make full use of it.

  3. fetch based on Fetch. I don’t know much about where this is used in Meteor, but it was proposed to replace the requests library that is used in the HTTP package.

  4. DDP, I think only Meteor devs know what it is, so it kind of has a marketing problem in my view. Externally people look for “WebSockets” or “Pub/Sub”, so I sometimes use those terms. DDP is one of the coolest things about Meteor and is even cooler using Meteor.callPromise() (an async Meteor.call() over DDP to call any Meteor Method, @robfallows wrote about these here … it uses the deanius:promise package ).

  5. Minimongo is used via vue-meteor-tracker for my Vue based app.

  6. Babel based build system, which is a Meteor crowd pleaser

There are many more core packages that would be fun to explore. I really think @benjamn is our true expert in all of this :grinning: I think he could use help from us in documentation.

4 Likes

Interesting stuff. You are on point. DDP is underestimated and not foubd by many people looking for exactly this mechanism based on words like pub/sub etc.

1 Like

DDP is very simple websocket protocol, I like its simplicity, it gets the job done and easy to understand/modify.

You can find the specs here:

The only thing to highlight is that websockets are required by the protocol. And in some cases, stateless (such as Rest) makes more sense as it is cheaper to scale.

4 Likes