3.0.1 • Published 10 months ago

nano-app v3.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

npm publish size stars npm total downloads

Node App

nano-app is a command-line application, here you can easily create your node.js project structure.

Installation

Install my-project with npm

  npx nano-app my-project
  cd my-project

It will create a directory called my-project inside the current folder. Inside that directory, it will generate the initial project structure and install the transitive dependencies:

my-project
├── package.json
├── package-lock.json
├── .prettierrc
├── .prettierignore
├── .gitignore
├── .env.production
├── .env.development
├── .babelrc
├── node_modules
└── src
    ├── config
        ├── cloudinary.js
        ├── database.js
        ├── passport.js
        └── sendEmail.js
    ├── controllers
        └── authController.js
    ├── middlewares
        ├── authorizedUser.js
        └── google.js
    ├── models
        ├── auditLogs.js
        ├── userRoleMaps.js
        ├── users.js
        └── validations.js
    ├── routes
        ├── authRouter.js
        └── router.js
    ├── utils
        ├── errors
            └── globalErrorHandler.js
        ├── responses
            ├── sendData.js
            ├── sendMessage.js
            └── sendResponse.js
        ├── templates
            ├── forgotMail.js
            └── signUpMail.js
        ├── createJWT.js
        └── createMFA.js
    ├── app.js
    └── server.js

Features

  • ES6+ configuration (Babel)
  • Better error handling
  • Clean code structure
  • Google authentication (Passport strategy)
  • Email authentication with OTP verification (Sent mail using Google Gmail)
  • Implement MFA using speakeasy
  • MFA QR code images stored in Cloudinary
  • Forgot Password via mail
  • Modern data validation using Joi
  • Forgot password mail template
  • OTP validation mail template

Environment Variables

To run this project, you will need to add the following environment variables to your .env.development (Development mode) or .env.production (Production mode) file

  • DB_NAME
  • DB_USER
  • DB_PASS
  • HOST
  • SCHEMA

If you want to store MFA QR code at Cloudinary

  • CLOUD_NAME
  • CLOUD_KEY
  • CLOUD_SECRET

If you want to use google login Google console

  • GOOGLE_CLIENT_ID
  • GOOGLE_CLIENT_SECRET
  • GOOGLE_CALLBACK_URL

If you want to use email verification

  • EMAIL
  • EMAIL_PASS (App password)

API Reference

Google Log In

  Redirect /api/v1/auth/google

For google login you need to set your FrontEnd URL at .env.development or .env.production FRONT_END

Sign Up

  POST /api/v1/auth/signup
BodyTypeDescription
f_namestringRequired. Your first name
l_namestringRequired. Your last name
emailstringRequired. Your email
phonestringRequired. Your phone number
passwordstringRequired. Your password

Sign In

  POST /api/v1/auth/signin
BodyTypeDescription
emailstringRequired. Your email
passwordstringRequired. Your password

Resent OTP

  POST /api/v1/auth/resent-otp
BodyTypeDescription
emailstringRequired. Your email

Verify OTP

  POST /api/v1/auth/verify-otp
BodyTypeDescription
emailstringRequired. Your email
otpstringRequired. Your otp

Verify MFA

  POST /api/v1/auth/verify-mfa
BodyTypeDescription
idintRequired. Your user id
tokenstringRequired. Your mfa token

Forgot Password

  POST /api/v1/auth/forgot-password
BodyTypeDescription
emailstringRequired. Your email

Reset Password

  POST /api/v1/auth/reset-password
BodyTypeDescription
reset_linkstringRequired. Reset link
passwordstringRequired. Your password

Get Profile

  GET /api/v1/auth/profile
ParameterTypeDescription
AuthorizationstringRequired. Your JWT token

Run Locally

Install dependencies

  npm install

Start the server

  npm run dev

Deployment

To deploy this project run

  npm run start

Usage/Examples

npx nano-app api

Part 1

Part 2

Part 3

Demo

Insert gif or link to demo

Demo Video

Tech Stack

Server: Node, Express

Authors

Feedback

If you have any feedback, please reach out to us at morolswediu@gmail.com

Support

For support, email morolswediu@gmail.com

License

MIT

If you like, Give a star ⭐

2.0.13

10 months ago

3.0.1

10 months ago

3.0.0

10 months ago

2.0.12

10 months ago

2.0.11

10 months ago

2.0.7

10 months ago

2.0.6

10 months ago

2.0.9

10 months ago

2.0.10

10 months ago

2.0.8

10 months ago

1.2.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.0

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago