Environmental Variables

In designing MERNKIT I wanted the platform to be as plug and play as possible. Therefore, the setup is almost entirely managed by setting environmental variables. For development, you will edit the nodemon.json file. Depending on how you deploy your platform into production you will need to copy this information into a different area. I will share documentation on how to setup MERNKIT on AWS at the end of the section.

Your nodemon.json file will contain the following empty variables that must be filled out. I will put descriptions where your variable value should go.

  • Callback values can be left as is provided you configure Google and Facebook with the same URLs.

  • FRONTEND_URL value can also be left as is in the default configuration.

  • COOKIEDOMAIN should be left as localhost for testing. This should be set as the top level domain so the frontend has access to the cookie sent by the backend if you are using different subdomains for the frontend and backend. For example api.mernkit.com (backend) /app.mernkit.com (frontend)

{
    "env": {
        "PROJECTNAME": "Your Product Name",  
        "DB_USER": "MongoDB Atlas USer",
        "DB_PWD": "MongoDB Atlas Password",
        "DB_NAME": "MongoDB Database Name",
        "KEY": "Encryption Key for JWT", 
        "FACEBOOK_CLIENT_ID":"Client ID for Facebook Auth",
        "FACEBOOK_CLIENT_SECRET":"Secret for Facebook Auth",
        "FACEBOOK_CALLBACK_URL":"/api/users/fb/cb", 
        "GOOGLE_CLIENT_ID":"Client ID for Google",
        "GOOGLE_CLIENT_SECRET": "Client Secret for Google",
        "GOOGLE_CALLBACK_URL": "/api/users/google/cb",
        "FRONTEND_URL":"http://localhost:3000",
        "MAILGUN_APIKEY": "Mailgun API Key",
        "MAILGUN_DOMAIN":"Mailgun domain (see Mailgun website)",
        "MAILGUN_FROM": "See mailgun website",
        "MAILGUN_TEMPLATE_SENDCONF": "Create Mailgun Template and place name here",
        "MAILGUN_TEMPLATE_PWRESET": "Same as above",
        "MAILGUN_TEMPLATE_ADDUSER": "Same as above",
        "COOKIEDOMAIN": "localhost", 
        "STRIPEID": "Stripe Private ID",
        "DEFAULTPRICE": "Default Price ID for trials",
        "TRIALPERIODDAYS": "Number of days you want your default trial to last"
        }
    }

Last updated