Giter Club home page Giter Club logo

christopherliedtke / vuex_nodeexpress_mongodb_wauth_starter Goto Github PK

View Code? Open in Web Editor NEW
25.0 3.0 5.0 1.69 MB

A starter repository for a front-end Vue.js SPA with a Node.js/Express and mongoDB back-end incl. pre-defined authentication, email verification and delete account functionality.

License: MIT License

JavaScript 48.46% HTML 1.03% Vue 47.46% SCSS 3.05%
vue vuex vue-router bootstrap4 nodejs express mongodb mongoose jwt-authentication csurf

vuex_nodeexpress_mongodb_wauth_starter's Introduction

Starter Repository - Vue with VueX, Bootstrap, Node.js/Express, mongoDB with Authentication and Email Verification

A starter repository for a front-end Vue.js SPA with a Node.js/Express and mongoDB back-end incl. pre-defined authentication, email verification and delete account functionality.

Features

  • Register
  • Email verification
  • Login
  • Password reset
  • Delete Account

Front-End

On the front-end Vue has been set up with VueX store and routing including route protection with redirecting. The settings can be expanded further during development. Bootstrap is implemented and can be easily adapted through respective SCSS files.

The starter includes the following views/routes:

  • Home ("/") -> [public]
  • Register ("/register) -> [public]
  • Login ("/login") -> [public]
  • PasswordReset ("/password-reset") -> [public]
  • AccountVerification ("/account/verification") -> [private]
  • AccountVerificationSuccessfull ("/account/verified") -> [private]
  • Account ("/account") -> [private]
  • Dashboard ("/dashboard") -> [private]

and the following components:

  • Header
  • Footer
  • Logout
  • Delete Account Button

The user id, user role and user status are stored in localStorage to be used session persistent on the client side.

Back-End

On the back-end a Node.js/Express server is set up. mongoDB serves as the database for user data and can be expanded further. The following routes are set up:

  • "/api/jobs" -> serves hard coded json-data [public]
  • "/" -> serves basic json; not requested on front-end [public]
  • "/user/data" -> serves hard-coded json-data [private]
  • "/api/auth/..." -> handles user registration [public], login [public], password reset [public], logout [public], account verification [private], account deletion [private]

Private routes are protected through 'check authentication' middleware.

The authentication system has been set up with json web token and persistent cookie session in the backend. The token is stored securely in the cookie. CSRF protection through csurf is set up for production.

Email service is provided through nodemailer.

Set-Up

Prerequisites

  • mongoDB account and database set-up
  • Email hosting [optional]

Steps to set up development environment

  1. Clone and set up repository or directly use repository as template

  2. Run npm install in root and root/client directory.

  3. Add secrets.json in root/server/utils and add secrets and your mongoDB and email hosting data:

    {
        "MDB_URL": "YOUR_MONGODB_URL_WITH_USERNAME_AND_PASSWORD",
        "COOKIE_SESSION_SECRET": "YOUR_SESSION_COOKIE_SECRET",
        "JWT_SECRET": "YOUR_JSONWEBTOKEN_SECRET",
        "EMAIL_HOST": "YOUR_EMAIL_HOST",
        "EMAIL_USERNAME": "YOUR_EMAIL_USERNAME",
        "EMAIL_PW": "YOUR_EMAIL_PASSWORD",
        "EMAIL_PORT": 000
    }
  4. In the default set-up email address verification is obligatory. The default user status after registration is status: "pending". You can change to status: "active" in root/server/utils/models/user.js to omit email address verification.

License

MIT

vuex_nodeexpress_mongodb_wauth_starter's People

Contributors

christopherliedtke avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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