Meteor: load code and templates from a Collection

I’m wondering how hard it would be to hack together the following:

All of the js files, html files, css, etc – i.e. the codebase of my meteor app – are stored in a Collection, say called Codebase.

Thus instead of using an ordinary text editor to edit files on my filesystem, I edit documents in the Collection . Otherwise everything works like it normally does. For example, when I update a document in the Codebase collection, the server restarts (live reloads).


  1. Is there an easy way to do that?

  2. If not, what architectural things get in the way?

  3. If not, can I easily do SOME of the above scenario, for example load
    just my templates from a Collection?

I don’t think it would be too hard to do for the CSS as it can still be added as an external file.

However I wouldn’t know where to start for the HTML templates and JS, as those files are bundled when deploying the app and file structure is important for them. How would execution work if there is a change in one of the JS files?

Hard, because you would bypass the Meteor build process. The build process does not happen in the app, but the Meteor command line tool.

You can eval the document on the server and create js and html files and then create a route that loads the files to the client. Or just send the collection to the client and eval it there.
You can use Spacebars compiler for templates but it is not a public api, so no documentation.