/node-activities-boilerplate

A simple NodeJS activity stream engine built with express, connect, socket.io, redis and mongodb

Primary LanguageJavaScriptApache License 2.0Apache-2.0

node-activities-boilerplate

Latest News

These instructions have been updated to work with CloudFoundry v2

Copyright (c) 2012 VMware, Inc

node-activities-boilerplate is a fork of node-express-boilerplate which is a simple express boilerplate app which does SSO using Facebook, Twitter and GitHub

Instead of raw messaging back and forth between clients and server, node-activities-boilerplate uses activitystrea.ms to send well structured messages(activities) and aggregate them in an Activities MongoDB collection. It also uses Redis' PubSub to notify clients in real time of what changes are happening in the db and has client side logic to update the UI appropriately. This functionality is delivered via the package activity-streams-mongoose

New Features include:

  • Bootstrap as the foundation css
  • Jade Templates which are executable server-side and client-side
  • New Social Networking Look
  • Persistence of activities and streams to MongoDB
  • Real time syndication of stream data using Redis

Core Features include:

  • Bundling socket.io and integrating with the express session store so data can be shared
  • Providing pre-made hooks to authenticate users via facebook/twitter/github
  • An assetmanager that concatenates/mangles/compresses your CSS/JS assets to be as small and fast to deliver as possible, as well as cache busting using MD5 hashes
  • Auto updates of the browser (inline/refresh) as soon as CSS/JS/template-files are changed in order to remove all those annoying “save, tab, refresh” repetitions
  • Notifications to your computer/mobile phone on certain user actions
  • Sane defaults in regards to productions/development environments
  • Logs errors to Airbrakeapp.com in order to track any errors users are encountering
  • Auto matching of urls to templates without having to define a specific route (such as, visiting /file-name/ tries to serve file-name.ejs and fallbacks to index.ejs - this is helpful for quick static info pages)

Install on dev machine

git clone https://github.com/mape/node-express-boilerplate <myproject>
cd <myproject>
npm install
  • Edit siteConfig.js if needed

  • Run locally

node server.js

Install on CloudFoundry

  • Install vmc if you have not already done so
sudo gem install cf
  • Deploy the app to Cloud Foundry
  cf push --nostart

Get keys for all social networks and services

Build your Facebook App at

Build your Twitter App at

Build Github App at

  • Run this command with your keys
export APP_NAME=<your_name>
cf set-env $APP_NAME airbrake_api_key=your_key
cf set-env $APP_NAME github_client_id=github_id
cf set-env $APP_NAME github_client_secret=github_secret
cf set-env $APP_NAME facebook_app_id=fb_id
cf set-env $APP_NAME facebook_app_secret=fb_secret
cf set-env $APP_NAME NODE_ENV=production
cf set-env $APP_NAME twitter_consumer_key=twitter_key
cf set-env $APP_NAME twitter_consumer_secret=twitter_secret
cf set-env $APP_NAME TMP=tmp

Finally

  cf start

License

Apache License

See LICENSE file for more details and node-express-boilerplate app License