Skip to content

Instantly share code, notes, and snippets.

@ungoldman
Created March 9, 2012 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ungoldman/2005683 to your computer and use it in GitHub Desktop.
Save ungoldman/2005683 to your computer and use it in GitHub Desktop.
better web application architecture: html5/css/js web app + api server + auth server

Highly decoupled functionality

  • API Server
  • Auth Server
  • Web App

All separate codebases

  • User hits web app, redirects to auth server
  • User logs in
  • gets authentication token from auth server gets redirected to web app
  • web app requests data from api
  • api server checks validity of auth token from auth server
    • (auth token expires server-side -- not cookie dependent)
  • api serves data
  • web app renders data

web app is 100% client side (no server-side rendering)

Eric Redmond's example (mongoHQ web app) uses:

  • SCSS
  • Compass
  • Slim
  • CoffeeScript
  • smush_it
  • middleman
  • cloudfront
  • handlebars

Major load balancing/scaling advantages:

  • web app leverages CDN for all static assets
  • offloads all data manipulation to api server
  • offloads all authentication/user mgmt to auth server

! compass generates a sprite sheet for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment