guyaloni
guyaloni

Reputation: 5872

MarionetteJS - code organization

I am starting a new project with the idea of moving some logic to client side. I was looking in Backbone, and later in Marionette. Looks like it is a very good library which extends backbone to make it easier to create an application.

However, I couldn't find in any place a good document explaining the architecture and philosophy behind modules in Marionette.

My question is, although it is quite wide, how should I organize my code? What is the idea behind Module? What should it represent?

My reference is the MarionetteJS TODO example.

Thanks!

Upvotes: 1

Views: 324

Answers (1)

Vitalii Petrychuk
Vitalii Petrychuk

Reputation: 14225

I do not want to write many texts I will just demonstrate two folders structures I like.

Group by independent modules (<3)

src
   application
        router.js  // router here or for each module
        main.js    // app entry point
   profile
        collections
        models
        views
        templates
        profile.js // module entry point
   news
        collections
        models
        views
        templates
        news       // module entry point

Group by Backbone types

src
   collections
         profile
         news
   models
         profile
         news
   modules
         profile.js // module entry point
         news.js    // module entry point
   views
         profile
         news
   templates
         profile
         news
   router.js       // router
   main.js         // app entry point

Upvotes: 5

Related Questions