@Mega as @Schamper said, I only discovered this last week, so we use require.parent.parent/etc for everything, but require.main works just as well.
Keep in mind require.main's "scope" is app.js, so you'd have to do require.main.require('./src/groups.js'); if you want access to the groups lib.
require.main will always be app.js for plugins, since plugins are only called by NodeBB.