Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/christopherliedtke/vuex_nodeexpress_mongodb_wauth_starter
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.
https://github.com/christopherliedtke/vuex_nodeexpress_mongodb_wauth_starter
account-deletion bootstrap4 csurf email-verification express jwt-authentication mongodb mongoose mongoosejs nodejs nodemailer starter-template vue vue-router vue-store vuex
Last synced: about 1 month ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/christopherliedtke/vuex_nodeexpress_mongodb_wauth_starter
- Owner: christopherliedtke
- License: mit
- Created: 2020-06-18T07:49:09.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T09:19:50.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T12:04:27.322Z (about 1 month ago)
- Topics: account-deletion, bootstrap4, csurf, email-verification, express, jwt-authentication, mongodb, mongoose, mongoosejs, nodejs, nodemailer, starter-template, vue, vue-router, vue-store, vuex
- Language: JavaScript
- Homepage:
- Size: 1.65 MB
- Stars: 25
- Watchers: 3
- Forks: 5
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 ButtonThe 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:
```json
{
"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