

Ask HN: What is your Node.js & MongoDB development setup & procedures? - tsenkov

Please, share the setup for static resources used by your team (Build Server, Staging server etc.) as well as the setup every new developer needs to do when coming to the team (installs, configurations etc).<p>It&#x27;s great if you can share whatever wisdom you consider &quot;hard to get on your own&quot; about the development procedures (unit and integration testing, linting&#x2F;hint-ing) with these particular technologies.<p>If you are willing to go into some details about important topics such as deployment and scaling strategies, this will be cool as well.<p>What front-end frameworks do you use for your web applications using your Node backend (AngularJS, Ember.JS etc)?<p>Links to other resources are also great.<p>Thanks for taking the time to share your mastery.
I hope this will turn into a great online resource for devs just starting to use NodeJS &amp; MongoDB.
======
tsenkov
To kickstart a discussion:

Does anyone use the MEAN stack: mongoDB, ExpressJS, AngularJS and NodeJS?

[http://blog.mongodb.org/post/49262866911/the-mean-stack-
mong...](http://blog.mongodb.org/post/49262866911/the-mean-stack-mongodb-
expressjs-angularjs-and)

I am starting a project and currently I am leaning towards NodeJS with Express
and MongoDB on the server-side and RequireJS(or WireJS) and Knockout on the
client side. I intend to use QUnit for the client app's testing, but have no
idea what should I use for Node testing (unit and load/stress). Since it will
be just me, I will probably setup Jenkins on my own machine for a build
server. I am currently using appfog for staging/testing.

That's pretty much it. (My project includes a mobile part as well, but I guess
this is outside of the scope of this discussion, so I wont get into that.)

~~~
barylen
I'd recommend using Mocha for all unit testing (client and server side).
[http://visionmedia.github.io/mocha/](http://visionmedia.github.io/mocha/)

~~~
tsenkov
Thanks. I've seen Mocha mentioned in this post for Node test-running on
Jenkins: [http://www.johnhamelink.com/testing-nodejs-with-
jenkins](http://www.johnhamelink.com/testing-nodejs-with-jenkins)

I will definitely give it a try.

------
smanuel
Hosting everything on Linode.

nginx as a load balancer (running 4 node processes on different ports as
upstart scripts with respawn) and for serving static files.

Express + Jade (but I do most of the things on the client - calling REST API)

redis as a session store: [https://github.com/visionmedia/connect-
redis](https://github.com/visionmedia/connect-redis)

DB - MongoDb (I also use Mongoose:
[http://mongoosejs.com/](http://mongoosejs.com/))

I also host most of the static resources on S3 and they are served through
CloudFront CDN. At first I used this module (for easier deploying the
resources to S3): [https://github.com/niftylettuce/express-
cdn](https://github.com/niftylettuce/express-cdn) but later I had to rewrite
most of the things to handle my specific requirements (using knox).

Tests (client and server side): Mocha + sinon + chai

CSS: Less + less-middleware

JS: UglifyJS + express-uglify

I'm also running a worker process and a scheduler process. For communication
between the worker, web and scheduler processes - RabbitMQ.

Deploying everything with git push in master (custom github post push hook).
No build server. Have nothing to build.

Client side: jQuery (of course) + AngularJS + custom code for bootstrapping
the SPA.

KnockoutJS - Naaw.

Hope this info helps.

P.S. Authentication: [http://passportjs.org/](http://passportjs.org/)

~~~
tsenkov
Thanks. I guess you do continuous integration manually running tests, if there
is no build server to pull latest commit on your repo and run tests?

~~~
smanuel
It's custom code which pulls the latest commit when github hook hits the
endpoint. It's... a few lines of code.

It's only me working on this so I run the tests before each push but I guess
running the tests on the staging env will be like a few more lines of code. I
s'pose at some point I'd want to keep test results and I'll need a build
server. May be.

Forgot to say that I also deploy everything on heroku (for free) as a staging
environment (before pushing to production).

heroku + mongolab + redis to go.

ah yes, and new relic for monitoring what's happening on live.

~~~
tsenkov
Thanks for your detailed answers.

------
ulisesrmzroche
Look into Brunch.io for the app assembler, and go from there. I like that it's
not opinionated like Yeoman and I choose the rest of the libraries as fashion
comes and goes. For my latest project, I'm running Brunch, Ember, Express,
Mongo. It's awesome.

Brunch comes with its own small express push-server to get you going, but it
can be replaced by overriding the startServer function and going from there.

For auth, passport.

~~~
tsenkov
Thanks, I will definitely check it out.

