1

I have a main angular application and other developers from other companies will have to provide functionality that is integrated in our app.

I was thinking to provide them with some documentation and require them to develop everything in one module, but this could result in them accessing some global state and breaking stuff.

I do not like that the way of integrating is to just copy that module in the app, edit the code and import the module and the main component. It will need to be tested for each module, and it is a high risk involved with each external module.

How else could I look at this problem?

I was thinking to require them to provide the entire module as a web component, but I am not convinced that it would solve the problem completely.

How can I have third party developers create modules for my app and integrate them with as little risk as possible?

Ovidiu Badita
  • 133
  • 10

1 Answers1

1

Either way, other devs would have to provide a self-sustaining component. Let it be a web component or an Angular module, they have to create it so that it can work on its own.

So both solutions are acceptable.

To avoid the maximum of risks, you should indeed provide a public API that they can use, and protect your code by not explaining the "under the hood" part.

You can't really use another of doing so, since Angular is a compiled language. That means the code must be present before building your application (except for web components, but since you're in Angular, might as well use Angular modules).

Finally, this is a web application, and either way, if they want to, they can access your whole application just by going to its URL. I wouldn't scratch my head too long on that if I were you : just ask for self-sustaining modules, and integrate them into your application as Angular modules.

  • I am concerned with what happens if they use the store or create actions that will trigger code that is not supposed to be triggered. Also, each module may require some packages in package.json. If I ever upgrade, I will have to upgrade the code they provide if it is a module, and I would like to avoid that. Maybe I over-complicate things... I do not like any of the solutions I come up with so far, but I can't think of somehting better. – Ovidiu Badita Oct 03 '19 at 08:44
  • 1
    Then do not expose the store so that they can't access it. For the dependencies, [here you have some information](https://stackoverflow.com/questions/52604189/how-to-embed-an-angular-app-into-another-app). Finally, for an upgraden yes, you would have to upgrade their code. It's not a bad thing to do, but I don't know the purpose of your project, so I really can't tell ... –  Oct 03 '19 at 08:47