Giter Site home page Giter Site logo

ericleimar / nodejs-account-boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from futurestudio/nodejs-account-boilerplate

0.0 1.0 0.0 929 KB

Boilerplate for new node.js projects with account handling and REST API

Home Page: http://futurestud.io

License: MIT License

CSS 65.00% JavaScript 24.54% HTML 10.46%

nodejs-account-boilerplate's Introduction

wercker status

nodejs-account-boilerplate

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):

  • Accounts

    • Create new account
      • E-Mail/Password
      • 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)
  • Environment-based database access

    • set a different DB for development than production (or any stage you want)
  • Full test coverage

  • Internationalization

    • 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

API

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.

Stack

You need the following core technologies to run nodejs-account-boilerplate:

  • NodeJS
  • MongoDB

Besides the core technologies it uses major components (this list is very likely incomplete):

The website is based on the Modern Business template.

Install

You have install NodeJS dependencies before usage

git clone [email protected]:fs-opensource/nodejs-account-boilerplate.git
cd nodejs-account-boilerplate
npm install

Configure MongoDB server connection

nano server/settings/db.js

Configure E-Mail smtp server connection

nano server/settings/email.js

Start NodeJS server

node server

If everything is set up correctly, visit

localhost:3000

Tests

The provided functions are thoroughly tested. Run

mocha test

for our provided tests.

REST API

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
Host: localhost:3000
Content-Type: application/json

{ 
  "email":"[email protected]",
  "phone":"0123456789",
  "password":"password"
}

A full API documentation is available on Github at /docs/api-docs

nginx

In case you're running the boilerplate on a nginx server, you might need to change the Underscores in Headers setting to on:

underscores_in_headers 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.

Contributions

We very warmly welcome any contributions. If it's bugs, feature requests or implementation, we enjoy feedback :)

License

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.

nodejs-account-boilerplate's People

Contributors

peitek avatar marcuspoehls avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.