{"id":19622182,"url":"https://github.com/commercetools/commercetools-dev-training-connector-template","last_synced_at":"2025-07-17T18:31:34.650Z","repository":{"id":253094355,"uuid":"842441328","full_name":"commercetools/commercetools-dev-training-connector-template","owner":"commercetools","description":"A connector template to be used in commercetools Developer courses","archived":false,"fork":false,"pushed_at":"2025-05-15T11:00:00.000Z","size":140,"stargazers_count":2,"open_issues_count":3,"forks_count":51,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-03T18:12:39.513Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commercetools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-14T11:05:51.000Z","updated_at":"2025-05-15T11:00:03.000Z","dependencies_parsed_at":"2024-08-21T09:24:43.498Z","dependency_job_id":"8de4b90b-2367-41f1-9132-6de57f3bafc2","html_url":"https://github.com/commercetools/commercetools-dev-training-connector-template","commit_stats":null,"previous_names":["commercetools/commercetools-dev-training-connector-template"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/commercetools/commercetools-dev-training-connector-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fcommercetools-dev-training-connector-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fcommercetools-dev-training-connector-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fcommercetools-dev-training-connector-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fcommercetools-dev-training-connector-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commercetools","download_url":"https://codeload.github.com/commercetools/commercetools-dev-training-connector-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fcommercetools-dev-training-connector-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265645360,"owners_count":23804183,"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-11T11:26:28.388Z","updated_at":"2025-07-17T18:31:34.644Z","avatar_url":"https://github.com/commercetools.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://commercetools.com/\"\u003e\n    \u003cimg alt=\"commercetools logo\" src=\"https://unpkg.com/@commercetools-frontend/assets/logos/commercetools_primary-logo_horizontal_RGB.png\"\u003e\n  \u003c/a\u003e\u003c/br\u003e\n  \u003cb\u003eConnect Application Starter Template for Developer Training\u003c/b\u003e\n\u003c/p\u003e\n\n# Connector Overview\n\nThis connector includes three applications: `customer-number-generator-app`, `email-verification-sender-app`, and `email-verification-receiver-app`. Below is an overview and the configuration options for each app.\n\n## Applications\n\n### 1. Customer Number Generator App\n\n**Type:** Service App  \n**Function:** Assigns a unique customer number when a new customer account is created. It includes an API Extension.\n\n### 2. Email Verification Sender App\n\n**Type:** Event App  \n**Function:** Generates a new verification token after the customer account is created. It uses a Subscription to get notified.\n\n### 3. Email Verification Receiver App\n\n**Type:** Service App  \n**Function:** Verifies the token after the customer opens a link embedded in an email containing the verification token.\n\n## Configuration Options\n\nThere are no configuration options required to run applications in this connector.\n\n## Getting Started\n\nMake sure you have the copy of the source code on your local machine. Use GitHub to fork the project to your account. While creating the fork, ensure the repo is public. Otherwise you need to allow the `connect-mu` to access your repo. Then clone the repo onto your machine. There should be a folder created on your machine now. Go into that folder, it should contain 3 application folders.\n\n### Postman Collection API Client\n\nMake sure the API client for Postman has **at least** the following scopes:\n\n- manage_customers\n- manage_api_clients\n- manage_connectors\n- manage_connectors_deployments\n\n### Developing the first application: customer-number-generator-app\n\n1. cd into `customer-number-generator-app` and install the dependencies\n\n```bash\ncd customer-number-generator-app\nyarn\n```\n\n2. Implement missing part in the `src/controllers.customers.controller.ts` to set the customer number to a randomly generated unique value.\n\nAdd the following code to `create` function\n\n```typescript\n// Create the UpdateActions Object to return it to the client\nconst updateAction: UpdateAction = {\n  action: \"setCustomerNumber\",\n  // generate a number between 1000 and 1899\n  customerNumber: String(Math.floor(1000 + Math.random() * 900)),\n};\n\nupdateActions.push(updateAction);\n```\n\n3. Build the application\n\n```bash\nyarn build\n```\n\n4. Configure the `.env` file\n\nBefore we can run this application locally we need client credentials in the `.env` file. Therefore first rename `.env.example` file to `.env`\n\n```bash\nmv .env.example .env\n```\n\nCreate an API Client in Merchant Center for your Composable Commerce project under `Settings-\u003eDeveloper Settings` section. This can be an admin client, i.e has all the permissions. At least you need following in scope:\n\n- manage_customers\n- manage_extensions\n- manage_subscriptions\n- manage_key_value_documents\n\nCopy those values into your `.env` file. So at the end, your `.env` file should have the following environment variables set.\n\n```bash\nCTP_CLIENT_ID=\nCTP_CLIENT_SECRET=\nCTP_PROJECT_KEY=\nCTP_SCOPES=\nCTP_AUTH_URL=\nCTP_API_URL=\n```\n\n5. Run the application\n\nNow, run the application\n\n```bash\nyarn start:dev\n```\n\n6. Test using the Postman Collection\n\nTo test this application locally, use the Postman collection provided.\n\n7. Stop the application\n\nSince every application is running on port 8080, we should stop this server before we can test the others. So please stop the server from the command line by pressing `CTRL + C`.\n\n### Developing the second application: email-verification-sender-app\n\n1. cd into `email-verification-sender-app` and install the dependencies\n\n```bash\ncd email-verification-sender-app\nyarn\n```\n\n2. Build the application\n\n```bash\nyarn build\n```\n\n3. Configure the `.env` file\n\nBefore we can run this application locally we need client credentials in the `.env` file. Therefore first rename `.env.example` file to `.env`\n\n```bash\nmv .env.example .env\n```\n\nYou can reuse the client credentials from the previous step.\nCopy those values into your `.env` file. So at the end, your `.env` file should have the following environment variables set.\n\n```bash\nCTP_CLIENT_ID=\nCTP_CLIENT_SECRET=\nCTP_PROJECT_KEY=\nCTP_SCOPES=\nCTP_AUTH_URL=\nCTP_API_URL=\n```\n\n4. Run the application\n\nNow, run the application\n\n```bash\nyarn start:dev\n```\n\n5. Test using the Postman Collection\n\nTo test this application locally, use the Postman collection provided.\nWhen testing this application, there will be a token generated and logged to the `console`. Please copy this token value for later use.\n\n6. Stop the application\n\nSince every application is running on port 8080, we should stop this server before we can test the others. So please stop the server from the command line by pressing `CTRL + C`.\n\n### Developing the third application: email-verification-receiver-app\n\n1. cd into `email-verification-receiver-app` and install the dependencies\n\n```bash\ncd email-verification-receiver-app\nyarn\n```\n\n2. Build the application\n\n```bash\nyarn build\n```\n\n3. Configure the `.env` file\n\nBefore we can run this application locally we need client credentials in the `.env` file. Therefore first rename `.env.example` file to `.env`\n\n```bash\nmv .env.example .env\n```\n\nYou can reuse the client credentials from the previous step.\nCopy those values into your `.env` file. So at the end, your `.env` file should have the following environment variables set.\n\n```bash\nCTP_CLIENT_ID=\nCTP_CLIENT_SECRET=\nCTP_PROJECT_KEY=\nCTP_SCOPES=\nCTP_AUTH_URL=\nCTP_API_URL=\n```\n\n4. Run the application\n\nNow, run the application\n\n```bash\nyarn start:dev\n```\n\n5. Test using the Postman Collection\n\nTo test this application locally, use the Postman collection provided. When testing this application, paste the `token` value you copied in an earlier step into Postman script.\n\n6. Stop the application\n\nSince every application is running on port 8080, we should stop this server before we can test the others. So please stop the server from the command line by pressing `CTRL + C`.\n\n## Deployment\n\nNow that you have locally tested your connect applications successfully, it is time to deploy them onto your `Composable Commerce` project. For that please commit your changes and push them to your GitHub repo.\n\nOnce you have updated the GitHub repo for your project, create a release tag such as `v0.0.1` and provide the following values in the **Postman Collection Variables** section before using the Postman collection to deploy your connector.\n\n| Variable Name        | Current Value                                    |\n| -------------------- | ------------------------------------------------ |\n| connector-name       | \u0026lt;a name containing your initials\u0026gt;          |\n| connector-staged-key | \u0026lt;unique key for your connector\u0026gt;            |\n| repo-url             | HTTPS or SSH GitHub URL of the GitHub repository |\n| repo-tag             | v0.0.1                                           |\n| creator-email        | \u0026lt;your email address\u0026gt;                       |\n| deployement-key      | \u0026lt;unique key for your deployment\u0026gt;           |\n\n## Clean Up\n\nOnce you have tested your installation, it is time to undeploy the installation. Please run the scripts in the **Clean Up** section of your Postman Collection.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Fcommercetools-dev-training-connector-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommercetools%2Fcommercetools-dev-training-connector-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Fcommercetools-dev-training-connector-template/lists"}