Playing with a node.js app project layout

I'm pleased with this project layout for a node.js-based web client / server app.

➜  toothub git:(master) ✗ tree
├── Procfile
├── README.md
├── app.json
├── bin
│   └── toothub
├── config.json-dist
├── htdocs
│   ├── css
│   │   └── main.styl
│   └── index.html
├── lib
│   ├── cli
│   │   ├── index.js
│   │   └── server.js
│   ├── client
│   │   └── index.js
│   ├── models
│   │   ├── Item.js
│   │   └── index.js
│   └── server
│       ├── index.js
│       └── static.js
├── package.json
└── test
    └── test-index.js

Browserify lets me share a lot of code between client & server, using the same conventions. Though, I have to be careful not to pile too much into the client-side JS bundle. It's really easy to inflate that.

The require-dir module lets me do some lazy things to break up my code into more submodules - at least on the server side. It's a little thing, but I really like it. I first saw it over in this Gulp + Browserify starter kit.

Thanks to the Heroku Button, this thing is cake to get running somewhere out there. Free Heroku is like the Raspberry PI of the cloud. I'm starting to think that anyone who's into indiewebish self-hosting concepts should really be taking a look at this.

I've also been really into Gulp recently, but so far I don't need it here. I'm gratuitously wasting memory and cycles by processing resources on the fly through the app server rather than generating as static assets. Maybe I'll change my mind on that after I've tinkered for awhile.

Anyway, now I guess I should actually start making this thing do stuff.

blog comments powered by Disqus
Random thoughts for 2014 Oct 27  Previous Random thoughts for 2014 Oct 23 Next