nodejs-account-boilerplate is outdated and currently unmaintained. You can still benefit from the ideas within this code.
We started learn hapi as a learning path for the hapi web framework. Become a hapi hero by following the tutorial series.
You’ll build a complete app from start to finish. From zero to hero!
Check out the Futureflix Starter Kit for more details 📺
This is a boilerplate for new projects based on node.js and MongoDB. It reduces the initial effort so you can start with the fun things, and not implement an account system for the 24th time. It also comes with required basic functionality, like access to the appropriate database based on the node-environment or internationalization.
This boilerplate is still under active development.
It has the following features (might be incompete):
- Create new account
- via facebook (soon)
- Edit account information
- Change password
- Secure forgot password reset
- Session tracking for website
- Blowfish-based password encryption (every password is hashed with an individual salt)
- Create new account
Environment-based database access
- set a different DB for development than production (or any stage you want)
Full test coverage
- the website views (/public/views) display how to offer the website in multiple languages
- the internationalization is currently incomplete, e.g. error message & API returns are currently only in English
The boilerplate does not only provide you with a website and the necessary server functions, it also has a REST API to handle the account related things. Adding new endpoints is fast and easy. Perfect for new projects with mobile apps (or any platform which is able to send HTTP requests and de/serialize JSON).
- Requests are authenticated with a token (not username/password)
- The requests from the REST API and the website run against the same business logic, just the handling is different (see account methods as an example for new endpoints)
A fully functional android app boilerplate which uses the provided APIs is available here.
You need the following core technologies to run nodejs-account-boilerplate:
Besides the core technologies it uses major components (this list is very likely incomplete):
- Express.js - Node.js Web Framework
- Jade - HTML Templating Engine
- EmailJS - Node.js > SMTP Server Middleware
- Bcrypt - For password encryption
- FontAwesome - The iconic font designed for Bootstrap
- Twitter Bootstrap - UI Component & Layout Library
- Mocha - node.js Testing framework
The website is based on the Modern Business template.
You have install NodeJS dependencies before usage
git clone firstname.lastname@example.org:fs-opensource/nodejs-account-boilerplate.git
Configure MongoDB server connection
Configure E-Mail smtp server connection
Start NodeJS server
If everything is set up correctly, visit
The provided functions are thoroughly tested. Run
for our provided tests.
A request to the REST API to signup a new user could look like this (use a tool like postman to quickly test the API):
POST /api/user/signup HTTP/1.1
A full API documentation is available on Github at /docs/api-docs
In case you're running the boilerplate on a nginx server, you might need to change the Underscores in Headers setting to on:
We are using underscores in some header parameters for the API. If you don't turn it on, the headers will be ignored and it won't work as expected.
We very warmly welcome any contributions. If it's bugs, feature requests or implementation, we enjoy feedback :)
The MIT License (MIT)
Copyright (c) 2014 Future Studio (futurestud.io)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.