Even if you run a full node on the same server as the music server, you SHOULD NOT be interfacing it through spaghetti code. There should be a formal protocol/RPC-API barrier between the two.
Anyway with js the best you can have is illusion of non spaghetti code, because it's not like js really support object polymorphism, or anything.
The node.js packaging can give the impression of design pattern, but it's mostly intentional.
Can always have definition of module/interface hierarchy for js ui app, but to me it just look like decoration.
It's has to understand the node-> module->method pattern but that's all. Node are the http layer, module can be abstracted with a js class with rpc calls, but anything more evolved is not possible in js.
As far as i know for js, all classes and functions are the same type, so it's hard to have good design pattern.
The application can just rely on naming convention and assume the type from there, it's the best you can do with js.
Which is how you end up using variable name as if it was the type name of a static class, but it's just variable naming convention there is no real "type class". The name correspond to an instance of unique class defined with the inline synthax, but it's not the the type name of a static class, it has no intrinsic meaning for the js engine. ( big difference for design pattern ^^).
With enough semantic confusion it can look like design pattern, but the js engine cant do any real type checking of anything.
JS programmers are used to this, even if I find this disturbing can give it the merit that it works and the synthax is intuitive for OO programmers, but in reality it's still very weak .
It's very hard to have true multi layered pattern with js.
You can only have one true layer of abstraction.
If a js class method is used as call back and has to use different class depending on returned data type, hard to make in sort the second class is fully aware of the calling context, you can only be sure of the type at one level, because of lack of true explicit typing, even giving the instance of the caller class cant give it's type to the callee, the method can only assume the "this" type from the naming convention of the caller code. The synthax is cute & all but it's very easy to mess up with multi layered code. In the end it can only be close to spaghetti :p
The design pattern has to be pretty flat or it will always end up messy with js.
To me all class/modules need to be on the same level using the static class like variable naming convention of js. Each module interface is implemented as inline class instance with a specific global name, and modules call are made throught call to this object methods, callback being mostly hard coded into the object definition for a specific UI. Most of the time it's simpler to let application initiliaze the object-module instance with the parameters it can customize for it needs, and let the js object handle the call back internally.
The js application need to have these module / class definition, and a node to connect to who host these modules, and then it can distribute the request on these node for the different interactions with the UI, using call to the named objects methods .
But it's not hard to see how a better language can be thought of