c9 / architect

A simple yet powerful plugin system for large-scale node applications
MIT License
981 stars 129 forks source link

Status #41

Open grabbou opened 9 years ago

grabbou commented 9 years ago

Hi, I've gone through lots of different approaches when it comes down to organising large NodeJS apps and this one is by far the best one I've ever seen (probably just because I think exactly the same way about DI). The only thing I am worried about is the date of the last commit & the number of awaiting PR's to be reviewed / merged. Is the repo still production-ready & up to date or it's been deprecated? Thanks!

Another question (I will try to sort that out tomorrow) is - whether it's possible to include custom plugin-only dependencies in my package.json? Let's say I have 10 modules (each module declares passport strategy & rest links) and I don't want to pollute my root package.json with social media specific libraries like graph-fb or instagram-node.

And - the very last question - is 'register' callback capable of being invoked as async callback? Let's say I have database module and I want to register it only after successful connection with the database. So it means that other modules that consume it will have to wait till the connection is being established.

jakecraige commented 9 years ago

I can't vouch for if this will be maintained going forward, but from a quick look, it looks like you can call register asyncronously.

  1. code - An array of plugins is created in the proper order
  2. code - It loops through each plugin recursively passing in a next function that when called, starts the next plugin
  3. code your plugin is called. In a different part it sets the setup method to what you exported from your plugin file. Notice it passes in the register function that you call within your plugin
  4. code - The last line of that register function tells it to continue and load the next plugin

Hopefully that makes sense, but you can load them async. Which is pretty sweet.