This is a coupon manager app built with the BigCommerce NextJS Sample App. This app enables users to view, bulk generate, and bulk export coupon codes for Coupon Promotions.
This app is provided as-is with no guarantees.
To get the app running locally, follow these instructions:
- Use Node 10+ and NPM 7+
- Install npm packages
npm install
- Add and start ngrok. Note: use port 3000 to match Next's server.
npm install ngrok
ngrok http 3000
- Register a draft app.
- For steps 5-7, enter callbacks as
'https://{ngrok_id}.ngrok.io/api/{auth||load||uninstall}'
. - Get
ngrok_id
from the terminal that's runningngrok http 3000
. - e.g. auth callback:
https://12345.ngrok.io/api/auth
- For steps 5-7, enter callbacks as
- Copy .env-sample to
.env
.- If deploying on Heroku, skip
.env
setup. Instead, enterenv
variables in the Heroku App Dashboard underSettings -> Config Vars
.
- If deploying on Heroku, skip
- Replace client_id and client_secret in .env (from
View Client ID
in the dev portal). - Update AUTH_CALLBACK in
.env
with thengrok_id
from step 5. - Enter a jwt secret in
.env
.- JWT key should be at least 32 random characters (256 bits) for HS256
- Specify DB_TYPE in
.env
- If using Firebase, enter your firebase config keys. See Firebase quickstart
- If using MySQL, enter your mysql database config keys (host, database, user/pass and optionally port). Note: if using Heroku with ClearDB, the DB should create the necessary
Config Var
, i.e.CLEARDB_DATABASE_URL
.
- Start your dev environment in a separate terminal from
ngrok
. Ifngrok
restarts, update callbacks in steps 4 and 7 with the new ngrok_id.npm run dev
- Install the app and launch.