1.0.3 • Published 17 days ago

@wishva/create-open-backend v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
17 days ago

Open-Backend-MongoDB

Create Node.js backend with Express and MongoDB with built-in Authentication and Authorization, Security and Error Handling.

  • Open-Backend-MongoDB works on macOS, Windows, and Linux.
  • If something doesn't work please file and issue

Getting Started

Install locally with npm

  npx @wishva/create-open-backend <Repo>

Click here to create a new repository based on this template

Environment Variables

To run this project, you will need to add the following environment variables to your config.env file

PORT: Application port

NODE_ENV: Running Environment

DB_URL: MongoDB Cluster URL (Don't replace password)

DB_PASSWORD: Password of the cluster

JWT_SECRET: JWT Secret Key

JWT_EXPIRES_IN: JWT expiration date in (in days)

JWT_COOKEI_EXPIRES_IN: When sending JWT with a cookie, expiration date in (Accepts only a number)

EMAIL_HOST: Email provider

EMAIL_PORT: SMTP port

EMAIL_USERNAME: Username

EMAIL_PASSWORD: Password

EMAIL_FROM: Sending email address

PASSWORD_RESET_TOKEN_VALID_FOR: in minutes (Accepts a number)

API Reference

Sign Up

  POST /api/v1/auth/signUp
body PropertyTypeIsRequiredDescription
emailstringtrueUnique key of user
passwordstringtrueThis will hash into 2^10
confirmPasswordstringtrueOnly for validation

Sign In

  POST /api/v1/auth/logIn
body PropertyTypeIsRequiredDescription
emailstringtrueUnique key of user
passwordstringtrueMatch using bcrypt

Forget password Send email with the token

  POST /api/v1/auth/forgotPassword
body PropertyTypeIsRequiredDescription
emailstringtrueUnique key of user

Forget password Send email with the token

  PATCH /api/v1/auth/resetPassword/:token
Request ParameterTypeIsRequiredDescription
tokenstringtrueSent with the Email
body PropertyTypeIsRequiredDescription
passwordstringtrueThis will hash into 2^10
confirmPasswordstringtrueOnly for validation

Update password by a logged user

  PATCH /api/v1/auth/resetPassword/
Request HeaderTypeIsRequiredDescription
AuthorizationBearertrueJWT issued at the login
body PropertyTypeIsRequiredDescription
currentPasswordstringtrueMatch using bcrypt
passwordstringtrueThis will hash into 2^10
confirmPasswordstringtrueOnly for validation

License

Create React App is open source software Licensed as MIT