Now that Apollo Client 2.0 is released I decided to update the DDP-Apollo package to support it. We’re getting close to a stable API and
1.0.0 will be released soon.
Why choose DDP-Apollo?
DDP-Apollo has been created to leverage the power of DDP for GraphQL queries and subscriptions. For Meteor developers there is no real need for an HTTP server or extra websocket connection, because DDP offers all we need and has been well tested over time.
- DDP-Apollo is one of the easiest ways to get GraphQL running for Meteor developers
- Works with the Meteor
accountspackages out of the box, giving a
userIdin your resolvers
- Doesn’t require an HTTP server to be setup, like with express, koa or hapi
- Supports GraphQL Subscriptions out-of-the-box
- Doesn’t require an extra websocket for GraphQL Subscriptions, because DDP already has a websocket
- Easy to combine with other Apollo Links
- Already have a server setup? Use
DDPSubscriptionLinkstand-alone for just Subscriptions support
- Works with Apollo Dev Tools, just like any other Apollo link
Installation and documentation
See all the details in the README of the repo:
Any downsides to this approach?
There are some points to take in consideration when choosing DDP as a network interface.
External consumers of your API
DDP-Apollo works great when only your own Meteor app uses your GraphQL API. And it also work for other Meteor apps who want to consume it, because they can simply make a DDP connection to your app. But if you have other apps or processes that only support HTTP then you still need to setup something like an express server. Luckily DDP-Apollo does nothing to your resolvers or schema, so you can reuse those for your HTTP setup and run both the DDP as the HTTP version side by side.
Apollo Engine is the successor of Apollo Optics. DDP-Apollo supports Optics out-of-the-box. Apollo Engine though works as a HTTP proxy, meaning it doesn’t support websockets (yet). This means no support for GraphQL subscriptions and no support for DDP-Apollo. If Engine is a requirement (and I must say it’s awesome), then DDP-Apollo isn’t for you.
Moving away from DDP
Like mentioned above, DDP-Apollo doesn’t modify your schema or resolvers in any way. If you ever wish to just use HTTP or move away from Meteor you can reuse your schema and resolvers without any changes.