Hi all. Hope all is well. So I’m trying to build a package-based application in Meteor. My main problem is how to centralize the core component and build packages on top of that. I believe one way is to build the application’s base as we normally do with any Meteor project (lib, client, server,… folders) and for each specific feature build a package and add it to the base. The other way is the way Telescope does it. Telescope has a core package that all other packages depend on so they are functional once they “use” the core package. I personally like the second approach better but been having a hard time making it happen. Any suggestion for a good starting point is appreciated. Thanks.
This is a very thorough guide on writing a package http://themeteorchef.com/recipes/writing-a-package/
The Telescope code is a good place to start to see the package approach in practice although I haven’t seen any usages of Tiny Test in it…
This can be helpful as well https://gibbon.co/tommytwoeyes/packageoriented-architecture-for-meteor
Agreed. This is basically what I have already gone through. I understand how to build packages after reading themeteorchef tutorial. I have a problem building the core package. I guess my problem has to do with modular pattern rather than Meteor-specific problem. Great reading materials though.
Maybe take a look at how the Orion CMS package is structured. Here’s its core package:
So it seems like the
myapp:core package would basically include your other packages, and in this way you can control the load order of everything as well.
this looks amazing. I don’t know how come I haven’t come across it. I’m digging into it right now.
This is a pretty complete summary of the whole process:
Great note. I ended up using the meteor-dust repo that is linked from meteor’s hackpad. I have a question that might not be very meteor related but it does fall into this context. I am trying to make a custom authentication system for my app. Does it make sense to separate this as a module (let’s say app:auth)?
Looking into telescope’s code, there’s a users package but it is not used for authentication (meteor-useraccounts is used instead). I cannot get my head around how authentication can be isolated from the core package into its own. If you believe that using useraccounts is a better alternative, could you elaborate on that? Thx.
@farshid1 Someone asked something similar on SO. Does this help answer your question at all? http://stackoverflow.com/questions/31483274/overwriting-meteors-default-login-handler/31631139#31631139
Yes. I actually ended up using the config.js file in the core module. But I couldn’t much make sense of how callbacks are useful following Telescope’s pattern. Your answer on StackOverflow clarifies the use of callbacks and I will try to make use of them. Thank you for your answer.