How do you run/integrate the BrainJS codes with the app?

BrainJS runs at the server side. It doesn't work with your app. To this end you don't have to integrate your BrainJS codes with the app.

BrainJS is a kind of JavaScript. Typically JavaScript runs at the client side. However there are exceptions such as Node.js. In fact, BrainJS runs exactly the same way as Node.js.