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
# MONGODB URLMONGO_DB_URL_STAGING=<mongo_db_url_development>MONGO_DB_URL_PRODUCTION=<mongo_db_url_production># Secret key for jwt tokenSECRET=<32_digits_random_string># Sendgrid for email sendingSENDGRID_KEY=<sendgrid_api_key>SENDGRID_FROM=<sendgrid_from_email># Stripe secret key for card paymentSTRIPE_SECRET_KEY=<stripe_secret_key># Imagekit for image uploadIMAGEKIT_URL=https://ik.imagekit.io/<imagekit_id>/IMAGEKIT_PUBLIC_KEY=<imagekit_public_key>IMAGEKIT_PRIVATE_KEY=<imagekit_private_key># Onesignal for user appONE_SIGNAL_APP_ID_USER=<onesignal_app_id>ONE_SIGNAL_SECRET_KEY_USER=<onesignal_secret_key># Onesignal for delivery appONE_SIGNAL_APP_ID_DELIVERY=<onesignal_app_id>ONE_SIGNAL_SECRET_KEY_DELIVERY=<onesignal_secret_key># Api deployed url for email verificationAPI_URL_STAGING=<api_deployed_url_development>API_URL_PRODUCTION=<api_deployed_url_production>
just run the following command to install all required dependencies.
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 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.
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.