Helps display and validate Recaptchas for node.js
JavaScript HTML
Latest commit fd853d2 Apr 19, 2015 @mirhampt Add version note to README
Failed to load latest commit information.
examples make example runnable with express 2.5.x Aug 20, 2012
lib Tiny whitespace cleanup Aug 20, 2012
.gitignore adding .gitignore Aug 8, 2012
.npmignore adding .npmignore Aug 8, 2012
LICENSE Add LICENSE Oct 17, 2010 Add version note to README Apr 19, 2015
package.json Minor version bump Apr 19, 2015
test.js Fix up tests Aug 15, 2012


node-recaptcha renders and verifies Recaptcha captchas.

NOTE: This release currently only supports Recaptcha version 1.


Via git:

$ git clone git:// ~/.node_libraries/node-recaptcha

Via npm:

$ npm install recaptcha


Before you can use this module, you must visit to request a public and private API key for your domain.

Running the Tests

To run the tests for this module, you will first need to install nodeunit. Then, simply run:

$ nodeunit test.js

Customizing the Recaptcha

See these instructions for help customizing the look of Recaptcha. In brief, you will need to add a structure like the following before the form in your document:

<script type="text/javascript">
    var RecaptchaOptions = {
       theme : 'clean',
       lang  : 'en'

Example Using Express


var express  = require('express'),
    Recaptcha = require('recaptcha').Recaptcha;


var app = express.createServer();

app.configure(function() {

app.get('/', function(req, res) {
    var recaptcha = new Recaptcha(PUBLIC_KEY, PRIVATE_KEY);

    res.render('form.jade', {
        layout: false,
        locals: {
            recaptcha_form: recaptcha.toHTML()
});'/', function(req, res) {
    var data = {
        remoteip:  req.connection.remoteAddress,
        challenge: req.body.recaptcha_challenge_field,
        response:  req.body.recaptcha_response_field
    var recaptcha = new Recaptcha(PUBLIC_KEY, PRIVATE_KEY, data);

    recaptcha.verify(function(success, error_code) {
        if (success) {
            res.send('Recaptcha response valid.');
        else {
            // Redisplay the form.
            res.render('form.jade', {
                layout: false,
                locals: {
                    recaptcha_form: recaptcha.toHTML()



form(method='POST', action='.')
  != recaptcha_form

  input(type='submit', value='Check Recaptcha')

Make sure express and jade are installed, then:

$ node app.js