Can Reaction be used as a back-end only system?


#1

Hi there!

I really like from what I’ve seen of Reaction so far.
However, I am not completely sure if it is an appropriate solution for my use-case.

I am building a website that is mostly content driven, but will feature a small web-shop.
I am already using React.js with node.js on the backend.

What I would like to use Reaction for is to have a separate system for commerce related stuff. I need a UI where orders and products can be viewed and managed, and a backend-system that does the heavy lifting of placing orders.

Would it be a good idea to Reaction in my case?

In another forum-post I have read that Reaction exposes its API through meteor’s ddp protocol. What kind of calls can be made through this API, and where can I find out more about this?

Thanks!


#2

Yes, you can use Reaction as a server only component using the DDP protocol.

Using a DDP lib like https://www.npmjs.com/package/ddp; You can subscribe to publications from the server, and call any method that was defined as a Meteor method.

// You will get a list of all products
ddpclient.subscribe("Products");
// Call a meteor method
ddpclient.call("products/createProduct");

There are some examples of calling meteor methods, from within Reaction in our docs. https://docs.reactioncommerce.com/reaction-docs/master/reaction-products#productscreateproduct

You just apply the same concepts, but using a DDP client lib like the one mentioned earlier.