API Setup
Here, it gives information about how to add credentials to the project, installing dependencies, and information of all environment variables.
As you can see above images we have API Directory that has all the rest API we build to run CMS.
ADD CREDENTIAL TO PROJECT
You need to add .env
file on the project directory and you need to create and add all required variable on .env file
Let me explain you the uses of all the credentials that you need to add in .env
Installing dependencies
just run following command to install all required dependencies.
npm install
Information of all Environment variables
MongoDB URL MongoDB we use for all the data storage and above .env file, you can see we have 2 MongoDB link. development and production. You can keep both database different or if want to keep both same can keep MongoDB URL same in both Environments.
SECRET Add 32 digit random string which will use for JWT secret key for validation of the token
STRIPE SECRET KEY We using stripe as payment gateway and if you want to use stripe, create a secret key from your stripe account and add in this variable. If not, leave as blank.
IMAGE KIT We use image kit for images storage as it provides more flexibility with images and it can optimize in the fly to keep our app performance hight. You need public and private key for this. Once you create an account on image kit get both the key and image kit id.
One Signal It's one of the leaders in Push notification service provider and you can use their services in the future for marketing and promotional PUSH as well. Once you create an account with one signal get App ID and secret key. Create two separate App ID and secret key. one for the user app and another for the delivery app. You can use one for both apps.
API URL You need to set the API deployed URL for email verification. It should be same on which domain or IP, API is deployed
SENDGRID
Sendgrid used to trigger any email in-app. You can integrate this with other Email service providers like SES etc but that required some basic changes in your backend nodeJS code. Once you create the SENDGRID account get an API key and add it above. In SENDGRID_FROM add email id from which you want to send an email to your customer. e.g. info@yourdomainname.com
TWILIO
We use twilio to send OTP to mobile number while registration. You need to create account on twilio website and from their dashboard you will get required credentials put it on create .env file.
SENDINBLUE We use Sendinblue as an alternative to Twilio and Sendgrid to send messages and emails. so you will need any one of them either twilio and sendgrid or just sendinblue.
SETUP DEMO DATA
To setup demo data in your product, you need to run following command on project directory.
npx ts-node mongodb-seeding.ts
After running this, it will ask you
Enter the Mongo DB connection uri string:
you need to pass here your MongoDB URL in which database you want to reset data. again it will ask you
Is it for production? (production/staging):
you need to just press enter here.
After that, it will reset data in your MongoDB database as our demo.
Last updated