Next.js 드롭쉬핑 키트: 공급사 가져오기, 마진 규칙, 상품 랜딩, 주문 전달, 예외 처리
설치
genpm add @core/kit-dropshipping포함 내용
- src/app/(dropshipping)/에 소스 코드, 파일 10개. (23.4kB)
- src/app/(dropshipping)/AGENTS.md에 AI 규칙, 그리고 IDE 규칙 파일.
- .env.example에 추가되는 환경 변수: PAYMENT_FEE_BPS, PAYMENT_FEE_FIXED, SUPPLIERS_SYNC_CRON, SUPPLIERS_TRACKING_CRON.
- @core/kit-landing, @core/kit-store, @core/pricing, @core/suppliers을(를) 자동으로 해결합니다.
README
이 패키지에는 README가 없습니다.
이것이 AI가 src/app/(dropshipping)에서 작업할 때 읽는 내용 그대로입니다. 그 외에는 컨텍스트에 아무것도 추가되지 않습니다.
@core/kit-dropshipping — rules for AI agents
Purpose
Dropshipping on top of @core/kit-store and @core/kit-landing (kit-cms arrives once through both): connect suppliers,
import products with their cost and a price from margin rules (@core/pricing), single-product landings at /p/<slug>
with direct "buy now" to Stripe, automatic or approved forwarding of paid orders to the supplier, tracking sync,
exceptions for what cannot be automated and an estimated profit widget. Logic lives in @core/suppliers and @core/pricing.
Map
_templates/genpm.md— the exact lines this kit adds to the project'ssrc/genpm/*.ts(generated, always current).p/[slug]/page.tsx— product landing: blocks of the landing with the same slug (optional), "buy now" form and delivery notice._lib/actions.ts—buyNowserver action (single-product cart, country, Stripe Checkout, attribution with consent)._lib/purchase.ts— serverpurchaseevent onpaid(Meta CAPI / TikTok / GA4 MP, only with consent)._components/delivery-notice.tsx— real delivery time, origin country, duties and returns, shown before payment._components/track-view.tsx— clientViewContentevent on/p/<slug>(only with marketing consent)._lib/widgets.ts— profit (7 days, estimated), supplier orders queue, open exceptions._scripts/setup-schedules.ts— schedules cost/stock sync (6 h) and tracking (12 h).
Integration
- @core/kit-store and @core/kit-landing must be integrated first (follow their AGENTS.md).
- Add the lines of
_templates/genpm.mdto the project'ssrc/genpm/*.ts(it says which file and where): imports incommerce.ts(pricing, suppliers and_lib/purchase, which registers the serverpurchaseevent when imported) and the admin resources and widgets. - Migrations for @core/suppliers and @core/pricing.
- Create a price rule (Admin → Price rules) before importing anything; imports fail without one.
- Start with the
manualadapter if there are no API credentials: Admin → Suppliers → new supplier (config:orderEmail,shipsFromas a 2-letter country code) → "Import products from CSV". Version 1.0 ships only themanualadapter; API adapters (CJ, AliExpress) will come as separate packages and will read their credentials from environment variables, never from the supplier config. - Products are imported as drafts: review texts, images (third-party rights) and prices, then activate them.
- Add
<DeliveryNotice product={p} />tosrc/app/(store)/products/[slug]/page.tsxnext to the add-to-cart form. - The person runs
npx tsx "src/app/(dropshipping)/_scripts/setup-schedules.ts";/api/cronmust run every minute. - Verify in Stripe test mode: buy from
/p/<slug>, the order appears in Supplier orders as pending approval, approve it, the supplier receives the order, add tracking, the customer receives the "shipped" email.
Conventions
- Forwarding starts in approval mode; enable
autoForwardper supplier only after a few correct orders. - Prices come from the rules and the cost; when the cost rises and the margin would be negative, the product is paused and an exception opens (never sell at a loss silently).
- The shop is the seller: it handles returns and the 14-day withdrawal right, whatever the supplier does.
Don't
- Don't hide delivery times, origin country or possible import charges until after payment (EU consumer law).
- Don't scrape suppliers or automate against their terms: official APIs or the manual adapter only.
- Don't import reviews without labelling them, invent features or certifications, or use fake urgency (see kit-landing).
# @core/kit-dropshipping — rules for AI agents
## Purpose
Dropshipping on top of @core/kit-store and @core/kit-landing (kit-cms arrives once through both): connect suppliers,
import products with their cost and a price from margin rules (@core/pricing), single-product landings at `/p/<slug>`
with direct "buy now" to Stripe, automatic or approved forwarding of paid orders to the supplier, tracking sync,
exceptions for what cannot be automated and an estimated profit widget. Logic lives in @core/suppliers and @core/pricing.
## Map
- `_templates/genpm.md` — the exact lines this kit adds to the project's `src/genpm/*.ts` (generated, always current).
- `p/[slug]/page.tsx` — product landing: blocks of the landing with the same slug (optional), "buy now" form and delivery notice.
- `_lib/actions.ts` — `buyNow` server action (single-product cart, country, Stripe Checkout, attribution with consent).
- `_lib/purchase.ts` — server `purchase` event on `paid` (Meta CAPI / TikTok / GA4 MP, only with consent).
- `_components/delivery-notice.tsx` — real delivery time, origin country, duties and returns, shown before payment.
- `_components/track-view.tsx` — client `ViewContent` event on `/p/<slug>` (only with marketing consent).
- `_lib/widgets.ts` — profit (7 days, estimated), supplier orders queue, open exceptions.
- `_scripts/setup-schedules.ts` — schedules cost/stock sync (6 h) and tracking (12 h).
## Integration
1. @core/kit-store and @core/kit-landing must be integrated first (follow their AGENTS.md).
2. Add the lines of `_templates/genpm.md` to the project's `src/genpm/*.ts` (it says which file and where): imports in
`commerce.ts` (pricing, suppliers and `_lib/purchase`, which registers the server `purchase` event when imported)
and the admin resources and widgets.
3. Migrations for @core/suppliers and @core/pricing.
4. Create a price rule (Admin → Price rules) before importing anything; imports fail without one.
5. Start with the `manual` adapter if there are no API credentials: Admin → Suppliers → new supplier (`config`:
`orderEmail`, `shipsFrom` as a 2-letter country code) → "Import products from CSV". Version 1.0 ships only the
`manual` adapter; API adapters (CJ, AliExpress) will come as separate packages and will read their credentials from
environment variables, never from the supplier config.
6. Products are imported as drafts: review texts, images (third-party rights) and prices, then activate them.
7. Add `<DeliveryNotice product={p} />` to `src/app/(store)/products/[slug]/page.tsx` next to the add-to-cart form.
8. The person runs `npx tsx "src/app/(dropshipping)/_scripts/setup-schedules.ts"`; `/api/cron` must run every minute.
9. Verify in Stripe test mode: buy from `/p/<slug>`, the order appears in Supplier orders as pending approval, approve
it, the supplier receives the order, add tracking, the customer receives the "shipped" email.
## Conventions
- Forwarding starts in approval mode; enable `autoForward` per supplier only after a few correct orders.
- Prices come from the rules and the cost; when the cost rises and the margin would be negative, the product is paused
and an exception opens (never sell at a loss silently).
- The shop is the seller: it handles returns and the 14-day withdrawal right, whatever the supplier does.
## Don't
- Don't hide delivery times, origin country or possible import charges until after payment (EU consumer law).
- Don't scrape suppliers or automate against their terms: official APIs or the manual adapter only.
- Don't import reviews without labelling them, invent features or certifications, or use fake urgency (see kit-landing).
.genpmignore 적용 후 주입될 정확한 트리입니다. 고정 대상:
// Programa las tareas periódicas del dropshipping en @core/jobs (idempotente).
// Uso (lo ejecuta la persona, con DATABASE_URL): npx tsx "src/app/(dropshipping)/_scripts/setup-schedules.ts"
import '@/genpm';
import { schedule } from '@/lib/jobs';
export async function setupSchedules(): Promise<void> {
await schedule('suppliers.sync', process.env.SUPPLIERS_SYNC_CRON ?? '0 */6 * * *'); // coste y stock cada 6 h
await schedule('suppliers.tracking', process.env.SUPPLIERS_TRACKING_CRON ?? '0 */12 * * *'); // seguimiento cada 12 h
}
// Sin top-level await: tsx compila a CommonJS en proyectos sin "type": "module" (lo normal en Next).
if (process.argv[1]?.endsWith('setup-schedules.ts')) {
setupSchedules().then(() => {
console.log('Scheduled suppliers.sync (every 6 h) and suppliers.tracking (every 12 h). Make sure /api/cron runs every minute.');
process.exit(0);
}, (e) => {
console.error(e);
process.exit(1);
});
}
이 패키지는 MCP 서버를 선언하지 않습니다.
| 버전 | 커밋 | 게시일 | 검사 |
|---|---|---|---|
| 1.0.1 | a15c9c8 | 4시간 전 | 검사 통과 |
- 제안됨
- GenPM은 npm 명령을 제안하고, 동의한 경우에만 실행합니다.
- 사용하는 패키지 (0)
- 아직 이 패키지에 의존하는 공개 패키지가 없습니다.
- 검사
- 검사 통과 · 문제 0건
- 커밋
- v1.0.1 → a15c9c8fd298cfa638e5b677485732213d13a05a · 가져온 뒤 검증됨
- 스크립트
- 없음. GenPM은 패키지 코드를 절대 실행하지 않습니다.
- 라이선스
- MIT
- 품질
- 100/100
- 인정된 라이선스충족
- AGENTS.md에 목적 설명충족
- AGENTS.md에 통합 단계충족
- AGENTS.md에 규칙 또는 금지 사항충족
- 테스트 포함충족
- 보안 검사 통과충족
- 최근 6개월 내 게시충족
- 인증된 게시자충족
- 요약과 키워드충족
- 신고
- 문제가 있나요?