Managing multiple API integrations

I’m working on a Meteor app with multiple user accounts that will have several integrations with third-party web services. My goal is to build it out so the code is as DRY as possible, but I’m stuck at when’s the right point to build for separate services. Here’s what I have in mind now:

  1. A collection of integrations with high-level information about each web service, including the fields needed for authentication (username/password, API token-only, OAuth2, etc).
  2. A collection of accounts where details about each account’s integration with each web service will be stored (these are multi-user accounts, so I can’t use the meteor.users collection).
  3. A separate library for each web service with specific HTTP calls based on the methods available to that specific service.
  4. A user can go to a page in the app and browse the available integrations. If they want to add one, they click a button.
  5. A modal is now rendered with the correct authentication fields for that specific integration (or a new window opened for OAuth2).
  6. When the user adds their credentials, those are sent to the server where a generic test method imports the specific library for that integration and does a test GET call (or manages the OAuth2 exchange workflow).
  7. The user receives feedback on whether the test was successful and then is presented with follow-up options. For instance, if adding a MailChimp API token, they would be presented with a list of available lists and could select one to use for syncing.
  8. The user would select a schedule of how often to run the integration (10 minutes, hourly, daily, weekly, manually).

I’m merrily crunching away on these steps, but wanted to throw it out to the experts to see if there’s a better way of thinking about this. My biggest question is: What’s the right point to separate different services, versus trying to standardize all services?

Would love to hear others experiences in managing multiple user-based integrations.


Curious, any learnings to share from this project or similar undertakings since? I have a feeling I’ll be in a similar situation soon.

Would also be curious if you have any best practices to share on whether it’s better to:

  1. keep all related API functions in one file and import Collections as needed to do writes
  2. or, to bascially do the opposite, export the API and import it as needed in a Collection file to do writes