Engines friendly framework from scratch

Hi,

I’ve been thinking about web frameworks because I will write a small
one in JavaScript to share code between client and server. I would
like to be able layer an application like engines allow in Rails. What
would an optimal directory structure for this?

So far I have this something like this where a top-level
config/environment.js would control layer loading order. The plugins
directory of a layer could be used to distribute sub-layers upon which
the depends.

  • layers/
    • app/
      • config/
      • controllers/
      • db
      • doc
      • lib
      • models/
      • public/
      • plugins/
      • test/
      • views/
    • authentication/
      • config/
      • controllers/
      • db
      • doc
      • lib
      • models/
      • public/
      • plugins/
      • test/
      • views/
  • config/
  • log/
  • tmp/

Any ideas or suggestions?

Thanks,
Peter