Few weeks ago I met with Sacha Greif. We talked about many things and one of them was that Meteor should have an Apollo skeleton. It took me a while to get around, but I have finally did it. Here I want to discuss some of the choices I have made in the skeleton.
Which approach?
First thing that confronted me was which packages to use. There were many different packages with different approached. Most notably there were 3 choices. The official apollo
package and its approach, swydo:ddp-apollo
and set from Cult of Coders. This was a hard decision as each had different benefits and drawbacks. cultofcoders:apollo
had the most goodies and benefits, but at the same time was most complicated and more geared towards advanced projects. swydo:ddp-apollo
was very compelling as it used the DDP connections that Meteor uses by default. This allows things like Apollo subscription out of the box and integrating with Meteor Accounts is also quick.
Eventually I have decided to go with the basic apollo
package which communicates over HTTP. First of all it is the least complicated of all the approaches, communication over HTTP is not optimal, but at least there is no deviation from behavior that devs from outside of Meteor will be familiar with.
Code Example
A lot could have been done to show all the capabilities of Apollo integration. Though I quickly rejected that idea. The skeleton exists mainly to provide the initial starting point, not a tutorial.
As a result I have only re-wrote the part of the code with subscription into using GraphQL and implemented the server with a basic schema. Anything more I deemed beyond the scope of the skeleton.
Apollo Client 3.0 and keeping things up to date
During the writing of this article Apollo released Apollo Client 3.0. Thankfully the PR has not yet been merged so I was able to upgrade the skeleton with the latest version.
Going forward I plan to keep things updated as much as possible. I've gone through all the skeletons and updated npm
versions of their dependencies. That was the minimum I could do and something I plan to do going forward.
Coming in Meteor 1.10.3
So if everything is accepted you should see this in Meteor 1.10.3, which we'll hopefully see out in few weeks.
Now with all that said and done. What are your thoughts?
If you like my work, please consider supporting me on GitHub Sponsors ❤️.
Top comments (1)
This is a great addition to Meteor development!