Api setup
It gives information about how to set up the API and its environment variables.
Last updated
It gives information about how to set up the API and its environment variables.
Last updated
As you can see from the above images we have API Directory that has all the rest API we build to run CMS.
You need to add .env
file on the project directory and you need to create and add all required variable on the .env file
Let me explain to you the uses of all the credentials that you need to add-in .env
just run the following command to install all required dependencies.
npm install
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 the JWT secret key for validation of the token
STRIPE SECRET KEY We using stripe as a 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 an image kit for images storage as it provides more flexibility with images and it can optimize on the fly to keep our app performance hight. You need public and private key for this. Once you create an account on the 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 the 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 the 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 an account on The Twilio website and from their dashboard, you will get the required credentials to 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.
To setup demo data in your product, you need to run the following command on the 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.