- Notifications
You must be signed in to change notification settings - Fork6
Set up a modern node.js api service by running one command.
License
jinnatul/nano-app
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
nano-app is a command-line application, here you can easily create your node.js project structure.
Install my-project with npm
npx nano-app my-projectcd 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
- 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
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 atCloudinary
CLOUD_NAME
CLOUD_KEY
CLOUD_SECRET
If you want to use google loginGoogle console
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET
GOOGLE_CALLBACK_URL
If you want to use email verification
EMAIL
EMAIL_PASS
(App password)
Redirect /api/v1/auth/google
For google login you need to set yourFrontEnd URL
at .env.development or .env.production [FRONT_END
]
POST /api/v1/auth/signup
Body | Type | Description |
---|---|---|
f_name | string | Required. Your first name |
l_name | string | Required. Your last name |
email | string | Required. Your email |
phone | string | Required. Your phone number |
password | string | Required. Your password |
POST /api/v1/auth/signin
Body | Type | Description |
---|---|---|
email | string | Required. Your email |
password | string | Required. Your password |
POST /api/v1/auth/resent-otp
Body | Type | Description |
---|---|---|
email | string | Required. Your email |
POST /api/v1/auth/verify-otp
Body | Type | Description |
---|---|---|
email | string | Required. Your email |
otp | string | Required. Your otp |
POST /api/v1/auth/verify-mfa
Body | Type | Description |
---|---|---|
id | int | Required. Your user id |
token | string | Required. Your mfa token |
POST /api/v1/auth/forgot-password
Body | Type | Description |
---|---|---|
email | string | Required. Your email |
POST /api/v1/auth/reset-password
Body | Type | Description |
---|---|---|
reset_link | string | Required. Reset link |
password | string | Required. Your password |
GET /api/v1/auth/profile
Parameter | Type | Description |
---|---|---|
Authorization | string | Required. Your JWT token |
Install dependencies
npm install
Start the server
npm run dev
To deploy this project run
npm run start
npx nano-app api
Insert gif or link to demo
nano-app.mp4
Server: Node, Express
If you have any feedback, please reach out to us atmorolswediu@gmail.com
For support, emailmorolswediu@gmail.com
If you like, Give a star ⭐
About
Set up a modern node.js api service by running one command.