API Setup

Detailed explaination of API config setup.

As you can see 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 root- level folder.

Let me explain to you the uses of all the credential you need to add in .env

# Secret key for jwt token
# Sendgrid for email sending
# Stripe secret key for card payment
# Imagekit for image upload
# Onesignal for user app
# Onesignal for delivery app
# Api deployed url for email verification

Installing dependencies

just run the 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 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 used an image kit for image storage as it provides more flexibility with images and it can optimize in the fly to keep our app performance high. You need public and private keys for this. Once you create an account on the image kit get both the key and image kit id.

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

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


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.