It would be really nice for someone to provide a best-practices for a microservice-type architecture. I’m also using the All-In-Packages–>Umbrella Packages style architecture in 1.2 in an app that is split up into around 10 microservices that all share some code and am struggling a bit with how to migrate to the new modules system. My current structure is like this:
microservice-1
—.meteor
—/packages -> simlink to …/packages
microservice-1
—.meteor
—/packages -> simlink to …/packages
packages
—app:package
—app:package2
—…
The ToDo example has been helpful in how to structure a small app. But what are the recommendations for building out a larger app with multiple services? Do I put everything in the /imports folder then just use an index.js in each microservice to import the required components? Or do I need to put one in /client and /service for each microservice? Also, how do I handle NPM imports. Do I only need to run npm install module --save once or once for each app? Advice appreciated.
Thanks!
In “all-in-packages” I had a “packages/lib” loading all the “related meteor+third-party packages”, p.e. like
var packages = [
'meteor-base@1.0.1', // Packages every Meteor app needs to have
'mobile-experience@1.0.1', // Packages for a great mobile UX
'mongo@1.1.2', // The database Meteor supports right now
// ....
PLUS in .meteor/packages I was only loading my own CORE Package that bundled it all together. Playing around with 1.3 a bit I found that I seem to definetly need some meteor-base-packages listed in .meteor/packages - just like in the example todos app.
What do you guys recon for adding those packages? Shall I simply use meteor add aldeed:simple-schema instead, meaning that I get all the advantages of being able to do a simple meteor list or meteor update?
Yep - that’s one of the biggest benefits of the module approach over packages - you don’t have to mess around with package.js files for most apps anymore.
Nono! Meteor automatically does this for you with .meteor/versions. So whenever you clone and run your project, Meteor will pick the same numbers as before! Unless you use meteor update which updates the packages in your project.
What to do with fixtures (that before had debugOnly: true in their package.js).
I’d like to run those fixtures in development mode, but NOT in production. Is there a flag to check against, like
if (Meteor.isDebugOnly) {
require ('fixture.js')
}
He’s referring to the “packages for everything” approach that some developers leverage, to get certain benefits (a lot of which are no longer relevant with 1.3). See item 4 of Building-Large-Apps-Tips for more details.
Thanks for the hint - I had wiped away my package.json or it did not exist. In order to recover it I removed my node_modules directory and reinstalled the node-packages via meteor npm install --save jquery html-to-textmeteor npm install --save *
Anyone else having to do this, too: one of the first steps should be to put your 3rd party and meteor packages-imports out of you “lib”-packge into ./meteor/packages. check the according package versions within .meteor/versions.
PLUS (if using npm packages) make sure that a package.json) exists (see this topic above)