{"id":19312159,"url":"https://github.com/bigcommerce/sample-app-nodejs","last_synced_at":"2025-04-05T17:07:34.650Z","repository":{"id":37784708,"uuid":"336313796","full_name":"bigcommerce/sample-app-nodejs","owner":"bigcommerce","description":"A reference implementation of a BigCommerce single-click app, in Node.JS + Next.js/React","archived":false,"fork":false,"pushed_at":"2024-04-09T18:05:20.000Z","size":1280,"stargazers_count":53,"open_issues_count":3,"forks_count":311,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-04-09T22:25:52.105Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigcommerce.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-02-05T15:39:51.000Z","updated_at":"2024-04-14T17:45:27.410Z","dependencies_parsed_at":"2024-04-14T17:45:06.106Z","dependency_job_id":null,"html_url":"https://github.com/bigcommerce/sample-app-nodejs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fsample-app-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fsample-app-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fsample-app-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fsample-app-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigcommerce","download_url":"https://codeload.github.com/bigcommerce/sample-app-nodejs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369952,"owners_count":20927928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T00:33:19.038Z","updated_at":"2025-04-05T17:07:34.623Z","avatar_url":"https://github.com/bigcommerce.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NextJS Sample App\n\nThis starter app includes all the files necessary to get started with a basic, hello world app. This app uses NextJS, BigDesign, Typescript, and React.\n\n## Running the app in development\n\nTo get the app running locally, follow these instructions:\n\n1. [Use Node 18+ and NPM 8+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm#checking-your-version-of-npm-and-node-js). To check the running versions, use the following commands:\n\n```shell\nnode -v\nnpm -v\n```\n\n2. Clone and/or fork the repo and install npm packages:\n\n```shell\ngit clone git@github.com:bigcommerce/sample-app-nodejs.git my-bigcommerce-app\ncd my-bigcommerce-app\nnpm install\n```\n\n3. To expose your app server using an HTTP tunnel, install [ngrok](https://www.npmjs.com/package/ngrok#usage) globally, then start the ngrok service.\n\nYou can use `npm` to install ngrok:\n\n```shell\nnpm install -g ngrok\n```\n\nAlternatively, MacOS users can use the [homebrew](https://brew.sh/) package manager:\n\n```shell\nbrew install ngrok\n```\n\nStart ngrok on port `3000` to expose the default Next.js server:\n\n```shell\nngrok http 3000\n```\n\n4. Use the BigCommerce [Developer Portal](https://devtools.bigcommerce.com) to [register a draft app](https://developer.bigcommerce.com/api-docs/apps/quick-start#register-the-app). For steps 5-7, enter callbacks as `'https://{ngrok_url}/api/{auth || load || uninstall}'`. Get the `ngrok_url` from the ngrok terminal session.\n\n```shell\nhttps://12345.ngrok-free.app/api/auth # auth callback\nhttps://12345.ngrok-free.app/api/load # load callback\nhttps://12345.ngrok-free.app/api/uninstall # uninstall callback\n```\n\n5. Copy `.env-sample` to `.env`.\n\n```shell\ncp .env-sample .env\n```\n\n6. In the `.env` file, replace the `CLIENT_ID` and `CLIENT_SECRET` variables with the API account credentials in the app profile. To locate the credentials, find the app's profile in the [Developer Portal](https://devtools.bigcommerce.com/my/apps), then click **View Client ID**.\n\n7. In the `.env` file, update the `AUTH_CALLBACK` variable with the `ngrok_url` from step 4.\n\n8. In the `.env` file, enter a secret `JWT_KEY`. To support HS256 encryption, the JWT key must be at least 32 random characters (256 bits).\n\n9. **Configure the data store.** In the `.env` file, specify the `DB_TYPE`.\n\n   \u003e The DB type must be either `firebase` or `mysql`.\n\n   If using Firebase, supply the `FIRE_` config keys listed in the `.env` file. See the [Firebase quickstart (Google)](https://firebase.google.com/docs/firestore/quickstart).\n\n   If using MySQL, supply the `MYSQL_` config keys listed in the `.env` file, then do the initial database migration by running the following npm script:\n\n```shell\nnpm run db:setup\n```\n\n10. Start your dev environment in a dedicated terminal session, **separate from `ngrok`**.\n\n```shell\nnpm run dev\n```\n\n\u003e If `ngrok` expires, update the callbacks in steps 4 and 7 with the new `ngrok_url`. You can learn more about [persisting ngrok tunnels longer (ngrok)](https://ngrok.com/docs/getting-started/#step-3-connect-your-agent-to-your-ngrok-account).\n\n11. Consult our developer documentation to [install and launch the app](https://developer.bigcommerce.com/api-docs/apps/quick-start#install-the-app).\n\n## Production builds\n\nIn production, you must build and run optimized version of the code. Use the following commands to get started:\n\n\u003e When you run the `start` script, specify a port number using the `-p` flag. Otherwise, the process will fail.\n\n```shell\nnpm run build\nnpm run start -p 3000\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigcommerce%2Fsample-app-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigcommerce%2Fsample-app-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigcommerce%2Fsample-app-nodejs/lists"}