node.js / django mini apps

I was impressed by the mini-app concept in the peepcode node.js tutorial. Instead of having global folders:

/site/models
/site/views

you create another level of seperation per application area:

/site/login/models
/site/catalog/models

AFAIU application areas must know nothing on each other. This creates some questions as for where to put shared db models, and if too much shared models imply that the wrong mini-app seperation was made. I'm trying to find more material on this mini-app concept. The webcast mentions that it is common in django. Anyone has experience or material about it in node (preferred) or django?

I also based my express.js structure on Django. There are two different techniques and they both have limitations and they both aren't exactly like Django apps.

I use this api in my app.js file.

var app = express();
require('./some-app1').init(app);
require('./some-app2').init(app);

My sub-app directory:

 some-app
 - index.js
 - middleware.js

This is the same for both techniques.

Next is the way I use when my app doesn't need a dedicated views directory.

index.js

 var middleware = require('./middleware');

 var subapp = function (app) {
    app.get('/stuff', middleware.handle_stuff);
 }

 module.exports = subapp;

This is how I started out doing things which is really basic but works well.

For the second technique you need to know that Express actually has something that is called a sub-app. This is a real Express object which you mount on top of a base application.

index.js

 var app = express();

 app.get('/stuff', middleware.handle_stuff);

 var subapp = function (app) {
    app.use(app);
 }

 module.exports = subapp;

Before picking the first or second technique I mostly just ask myself 'Do I need a dedicated views directory for this app?'. If the answer is 'yes' I'll go for the second. I've seen others use the second technique because the real sub apps can run on their own so you can actually do isolated http request for testing.