title: Best approach for designing framework for badge assigning system
body: <p>I am currently designing one education site.</p>
  
  <p>For this we need to assign some badges to user based on their activity (like stackoverflow).</p>
  
  <p>I was looking for a framework for this. Any one have any idea, how this can be done? Table design etc. </p>
  
  <p>Issues which I could think of with this are :</p>
  
  <ol>
  <li>We may have large number of badges, so on each action of user we can not check all badges and check if any badge can be assigned</li>
  <li>On adding a new badge and criteria for this, I dont want to change the existing code to handle this (can we have some generic solution?)</li>
  <li>Which db should I choose (lets say if my framework in like, it raises the event when criteria for one badge satisfies and these rules are created in  DB(like sql). or can I go for nosql db (like mongodb as my rest of the project is in mongodb )  </li>
  </ol>
  
  <p>My initial search gave me following things</p>
  
  <ol>
  <li>rule engine  -> will result in very tedious task  <a href="https://stackoverflow.com/questions/1049233/database-architecture-for-badge-system-arbitrary-criteria-mysql-php">Database Architecture for &quot;Badge&quot; System &amp; Arbitrary Criteria (MySQL/PHP)</a></li>
  <li>One project  -> <a href="http://drupal.org/project/user_badges" rel="nofollow noreferrer">http://drupal.org/project/user_badges</a> ( not able to understand it properly) </li>
  <li>people are saying your table structure should be like this and this ..and all ..
  <a href="https://stackoverflow.com/questions/522943/best-way-to-store-badge-criteria">Best way to store Badge criteria?</a>
  <a href="https://stackoverflow.com/questions/8364187/creating-badges-for-my-site-best-way-to-store-user-badges-using-php">Creating &quot;Badges&quot; for my site, best way to store user badges? Using PHP</a></li>
  </ol>