{"_id":"@acmekit/product","_rev":"2-7433f767661e5782c8d907db1e218daa","name":"@acmekit/product","dist-tags":{"latest":"2.13.2"},"versions":{"2.13.1":{"name":"@acmekit/product","version":"2.13.1","author":{"name":"AcmeKit"},"license":"MIT","_id":"@acmekit/product@2.13.1","maintainers":[{"name":"deuxego","email":"vladosprut@gmail.com"}],"homepage":"https://github.com/acmekit/acmekit#readme","bugs":{"url":"https://github.com/acmekit/acmekit/issues"},"dist":{"shasum":"db969959e9260e29967efffd4a1429617feec33c","tarball":"https://registry.npmjs.org/@acmekit/product/-/product-2.13.1.tgz","fileCount":143,"integrity":"sha512-v844k9RJLpH9DHSG1ZpFW+U6KugqxcG96ds+62mKWai8biUOo9ZkymJiIA+UhwTorMcfaTbmccex6RbQ3qLB2g==","signatures":[{"sig":"MEUCIHMLzI2/KccR0k5pVzPqZ7Vg4rtq1hyeXeBPF1PbovGpAiEA5SDkO16dqYc0xn4b2jsHWHP0PhwA8j2UEjwBaaXaPhQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":940441},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=20"},"scripts":{"test":"../../../node_modules/.bin/jest --bail --forceExit --testPathPattern=src","build":"yarn run -T rimraf dist && yarn run -T tsc --build && npm run resolve:aliases","watch":"yarn run -T tsc --build --watch","watch:test":"yarn run -T tsc --build tsconfig.spec.json --watch","migration:up":"MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:up","orm:cache:clear":"MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm cache:clear","resolve:aliases":"yarn run -T tsc --showConfig -p tsconfig.json > tsconfig.resolved.json && yarn run -T tsc-alias -p tsconfig.resolved.json && yarn run -T rimraf tsconfig.resolved.json","migration:create":"MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:create","test:integration":"../../../node_modules/.bin/jest --passWithNoTests --bail --forceExit --testPathPattern=\"integration-tests/__tests__/.*\\.spec\\.ts\"","migration:initial":"MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:create --initial"},"_npmUser":{"name":"deuxego","email":"vladosprut@gmail.com"},"repository":{"url":"git+https://github.com/acmekit/acmekit.git","type":"git","directory":"packages/modules/product"},"_npmVersion":"10.9.3","description":"AcmeKit Product module","directories":{},"_nodeVersion":"22.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@acmekit/framework":"2.13.1","@acmekit/test-utils":"2.13.1"},"peerDependencies":{"@acmekit/framework":"2.13.1"},"_npmOperationalInternal":{"tmp":"tmp/product_2.13.1_1769891028870_0.39068276465081553","host":"s3://npm-registry-packages-npm-production"}},"2.13.2":{"name":"@acmekit/product","version":"2.13.2","description":"AcmeKit Product module","main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=20"},"repository":{"type":"git","url":"git+https://github.com/acmekit/acmekit.git","directory":"packages/modules/product"},"publishConfig":{"access":"public"},"author":{"name":"AcmeKit"},"license":"MIT","scripts":{"watch":"yarn run -T tsc --build --watch","watch:test":"yarn run -T tsc --build tsconfig.spec.json --watch","resolve:aliases":"yarn run -T tsc --showConfig -p tsconfig.json > tsconfig.resolved.json && yarn run -T tsc-alias -p tsconfig.resolved.json && yarn run -T rimraf tsconfig.resolved.json","build":"yarn run -T rimraf dist && yarn run -T tsc --build && npm run resolve:aliases","test":"../../../node_modules/.bin/jest --bail --forceExit --testPathPattern=src","test:integration":"../../../node_modules/.bin/jest --passWithNoTests --bail --forceExit --testPathPattern=\"integration-tests/__tests__/.*\\.spec\\.ts\"","migration:initial":"MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:create --initial","migration:create":"MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:create","migration:up":"MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:up","orm:cache:clear":"MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm cache:clear"},"devDependencies":{"@acmekit/framework":"2.13.2","@acmekit/test-utils":"2.13.2"},"peerDependencies":{"@acmekit/framework":"2.13.2"},"_id":"@acmekit/product@2.13.2","bugs":{"url":"https://github.com/acmekit/acmekit/issues"},"homepage":"https://github.com/acmekit/acmekit#readme","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-CxUuPl9za+xXaxO0fWtIaqBSmcRqzmoV3qsqdN+hyKNjHTSqu8H6voBXzwJQw4gdwOxMvvQ9cioRDlGcqfwoQw==","shasum":"eec81593af59f5cbde4b09817f3e57a22be5934e","tarball":"https://registry.npmjs.org/@acmekit/product/-/product-2.13.2.tgz","fileCount":143,"unpackedSize":940441,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAI3siX+hiWRHEkUo9rIrsYtHlST1wVSxjzs0MC9E8RFAiAofhcPsKeHKbZzwXJpR+7zbnd2Ar03ErQISQLWE4ncSg=="}]},"_npmUser":{"name":"deuxego","email":"vladosprut@gmail.com"},"directories":{},"maintainers":[{"name":"deuxego","email":"vladosprut@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/product_2.13.2_1769892727566_0.7367305504703128"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-31T20:23:48.790Z","modified":"2026-01-31T20:52:07.826Z","2.13.1":"2026-01-31T20:23:49.034Z","2.13.2":"2026-01-31T20:52:07.714Z"},"bugs":{"url":"https://github.com/acmekit/acmekit/issues"},"author":{"name":"AcmeKit"},"license":"MIT","homepage":"https://github.com/acmekit/acmekit#readme","repository":{"type":"git","url":"git+https://github.com/acmekit/acmekit.git","directory":"packages/modules/product"},"description":"AcmeKit Product module","maintainers":[{"name":"deuxego","email":"vladosprut@gmail.com"}],"readme":"# Product Module\n\nThe Product Module gives you access Products, Variants, Categories, and more through a standalone package that can be installed and run in Next.js functions and other Node.js compatible runtimes.\n\n[Product Module documentation](https://docs.acmekit.com/v2/resources/commerce-modules/product) | [AcmeKit Website](https://acmekit.com/) | [AcmeKit Repository](https://github.com/acmekit/acmekit)\n\n> The Product Module is currently in beta. The beta version comes with limited functionality, primarily centered around retrieving products. In the official version, the product module will be fully-fledged and on par with the product functionality in our core package.\n\n---\n\n## Installing and using it in Next.js\n\n### Prerequisites\n\n- [Next.js project](https://nextjs.org/docs/pages/api-reference/create-next-app)\n\n1\\. Run the following command in your project\n\n```bash\nnpm install @acmekit/product\n```\n\n2\\. Add Database URL to your environment variables\n\n```bash\nDATABASE_URL=<URL_GOES_HERE>\n```\n\n3\\. Apply database migrations\n\n> If you are using an existing AcmeKit database, you can skip this step. This step is only applicable when the module is used in isolation from a full AcmeKit setup\n\nBefore you can run migrations, add in your `package.json` the following scripts:\n\n```json\n\"scripts\": {\n    //...other scripts\n    \"product:migrations:run\": \"acmekit-product-migrations-up\",\n    \"product:seed\": \"acmekit-product-seed ./seed-data.js\"\n},\n```\n\nThe first command runs the migrations, and the second command allows you to optionally seed your database with demo products.\n\nFor the second command to work, you'll need to add the dummy seed data to the root of your Next.js project:\n\n<details>\n  <summary>Seed file</summary>\n\n```js\nconst productCategoriesData = [\n  {\n    id: \"category-0\",\n    name: \"category 0\",\n    parent_category_id: null,\n  },\n  {\n    id: \"category-1\",\n    name: \"category 1\",\n    parent_category_id: \"category-0\",\n  },\n  {\n    id: \"category-1-a\",\n    name: \"category 1 a\",\n    parent_category_id: \"category-1\",\n  },\n  {\n    id: \"category-1-b\",\n    name: \"category 1 b\",\n    parent_category_id: \"category-1\",\n    is_internal: true,\n  },\n  {\n    id: \"category-1-b-1\",\n    name: \"category 1 b 1\",\n    parent_category_id: \"category-1-b\",\n  },\n]\n\nconst productsData = [\n  {\n    id: \"test-1\",\n    title: \"product 1\",\n    status: \"published\",\n    descriptions: \"Lorem ipsum dolor sit amet, consectetur.\",\n    tags: [\n      {\n        id: \"tag-1\",\n        value: \"France\",\n      },\n    ],\n    categories: [\n      {\n        id: \"category-0\",\n      },\n    ],\n  },\n  {\n    id: \"test-2\",\n    title: \"product\",\n    status: \"published\",\n    descriptions: \"Lorem ipsum dolor sit amet, consectetur.\",\n    tags: [\n      {\n        id: \"tag-2\",\n        value: \"Germany\",\n      },\n    ],\n    categories: [\n      {\n        id: \"category-1\",\n      },\n    ],\n  },\n]\n\nconst variantsData = [\n  {\n    id: \"test-1\",\n    title: \"variant title\",\n    sku: \"sku 1\",\n    product: { id: productsData[0].id },\n  },\n  {\n    id: \"test-2\",\n    title: \"variant title\",\n    sku: \"sku 2\",\n    product: { id: productsData[1].id },\n  },\n]\n\nmodule.exports = {\n  productCategoriesData,\n  productsData,\n  variantsData,\n}\n```\n\n</details>\n\nThen run the first and optionally the second command to migrate and seed the database:\n\n```bash\nnpm run product:migrations:run\n# optionally\nnpm run product:seed\n```\n\n4\\. Adjust Next.js config\n\nNext.js uses Webpack for compilation. Since quite a few of the dependencies used by the product module are not Webpack optimized, you have to add the product module as an external dependency.\n\nTo do that, add the serverComponentsExternalPackages option in `next.config.js`:\n\n```js\n/** @type {import('next').NextConfig} */\n\nconst nextConfig = {\n  experimental: {\n    serverComponentsExternalPackages: [\"@acmekit/product\"],\n  },\n}\n\nmodule.exports = nextConfig\n```\n\n5\\. Create API Route\n\nThe product module is ready for use now! You can now use it to create API endpoints within your Next.js application.\n\nFor example, create the file `app/api/products/route.ts` with the following content:\n\n```ts\nimport { NextResponse } from \"next/server\"\n\nimport { initialize as initializeProductModule } from \"@acmekit/product\"\n\nexport async function GET(request: Request) {\n  const productService = await initializeProductModule()\n\n  const data = await productService.list()\n\n  return NextResponse.json({ products: data })\n}\n```\n\n6\\. Test your Next.js application\nTo test the endpoint you added, start your Next.js application with the following command:\n\n```\nnpm run dev\n```\n\nThen, open in your browser the URL `http://localhost:3000/api/products`. If you seeded your database with demo products, or you’re using a AcmeKit database schema, you’ll receive the products in your database. Otherwise, the request will return an empty array.\n","readmeFilename":"README.md"}