Integrating NodeBB with a different standalone node site



  • Hi there!

    Great work so far. My co-workers and I have been monitoring your project for the past couple of months, evaluating it for our needs for a project we've been working on, and so far we're hopeful that we can make this work. (The only alternatives were Discourse and Disqus, neither of which we were thrilled about.)

    For our project, we've got a pretty fully-featured, standalone site that's running on a Node server and also using Express and Redis. When I first found out about NodeBB, I figured that we could integrate it into our main project as a submodule. Now that I've had more time to play around with it, I'm realizing that NodeBB seems to function better independently, running on a different port from the main app. In general, this is fine and probably makes some things better in production -- if one app happens to crash, it shouldn't affect the other, etc.

    However, we have two needs which I'm not sure how to take care of with that setup:

    1. Shared authentication and user/session management. Both apps use Connect-Redis for sessions, and for as far as I can tell, as long as they use the same Redis store, sessions should automatically be shared. So that's about half of the problem solved. However, the other half is that if the user logs into or creates an account on the main site, they should automatically have an account on NodeBB with the same username/user details.

    I'm guessing the easiest solution is: when a user accesses the NodeBB site, check the Redis session store; if their session is associated with an existing account from the main site, automatically create a new user account for them in NodeBB and log them in right away. Do you agree that's the way to go? If so, where do you think is the best place in the codebase to insert this functionality? Since it deals with high-level authentication, I'm not sure if this would work as a plugin.

    1. If a certain type of data gets created on the main site, a new thread should automatically be created on the NodeBB site. Basically, we need to be able to expose an API of some kind to create new threads, and possibly new categories. Can this be achieved through a plugin?

    We realize that neither of these probably are the kinds of common use cases NodeBB was designed to handle, or at least not at the current stage of development, so we're perfectly fine forking the code and making our own customizations to accommodate these needs (and we'll certainly share our results with the community if anyone would find that helpful). However, any help with getting started is truly appreciated!

    Thanks 🙂


  • Admin

    Hello @xiehan! Sorry for the delay in replying, we've been quite busy on our end with the launch of v0.1.0 and our premium hosting platform.

    1. Shared authentication is best done if both sites use a common login system. The easiest example would be if both sites use facebook login. NodeBB uses PassportJS, so any provider in this list can theoretically be added to NodeBB via a plugin. It is possible to create an account via an API call, but we have not explored that avenue as yet.

    2. Automatically creating a new topic if certain conditions are met is something we want to add at some point. For example -- a wordpress site that automatically pings NodeBB to create a new topic every time a new blog post is written. This can be done with a pair of plugins, one for wordpress, and another for NodeBB.


  • Admin

    These sorts of plugins or enhancements to the core are unofficially on our roadmap, but may not be completed any time soon, as they are prioritised based on demand (and our willingness to create them).

    Given that NodeBB is completely open source, we encourage the public to enhance it!

    If you'd like us to prioritise work on a particular feature or plugin, give us a shout at sales@nodebb.com, and we can talk pricing 🙂



  • @xiehan Would really like to see this made easy!



  • It looks like some of this is solved with the SSO functionality. We'll be interested in how seamless it is for a user that is logged into our site to be able to move to a forum page and have it all just work. Then, in how we access information related to the Nodebb discussions. There is some expected behaviour from a user interaction perspective, that is the devil in the details. Like, which profile do I go to when I click on the profile photo in a discussion? We'd like it to be the profile on our site, obviously.

    We'll definitely be interested in the second part as well. i.e. being able to instantiate a thread from our app

    We've gone through an integration effort with Disqus, so we're aware of some of the nitty gritty.

    Really looking forward to digging in.



  • This is a very interesting thread and I would love to see @xiehan's idea come into fruition. Going forward I believe more and more sites will add a forum feature to their already existing site rather than running it separately so a seamless integration becomes the more vital. @Xiehan I would also love to know what you guys have done to overcome some of these limitations?


 

| |