EN

@core / shipping

1.0.1 ▾
verifiedMIT
GitHub

Shipping zones and rates (flat, weight, order value, free over X) with delivery estimates and tracking URLs

Code8 filesContext~445 tokensscan passed

Install

$genpm add @core/shipping

What you get

  • Source in src/lib/shipping/, 8 files. (24.2 kB)
  • AI rules in src/lib/shipping/AGENTS.md, plus IDE rule files.
  • Resolves @core/cart, @core/contracts, @core/db, @core/money for you.

README

@core/shipping

genpm license

Shipping zones and rates (flat, weight, order value, free over X) with delivery estimates and tracking URLs

A GenPM module: source code + AI rules + MCP config, injected into your project instead of hidden in node_modules. The code lands in src/lib/shipping, pinned to a verified commit, and you own it.

Install

genpm add @core/shipping

No genpm yet? curl -fsSL https://genpm.net/install.sh | sh (macOS/Linux), irm https://genpm.net/install.ps1 | iex (Windows), or one-off with npx @genpm-net/cli add @core/shipping.

Or let your AI agent do it: run genpm mcp setup once, then ask "add @core/shipping with genpm" in Claude Code, Cursor, VS Code, Windsurf, Codex or Gemini CLI. It shows you a dry-run plan before writing anything.

What it does

Shipping zones (ISO country lists, * = rest of world) and rates per zone: flat price, weight and order-value ranges, free shipping over an amount (after discounts) and delivery estimates in days. Registers the shipping step (order 200) of the @core/cart totals pipeline and builds tracking URLs for common carriers. No label purchase or live carrier quotes. Tables: shipping_zones, shipping_rates.

Setup

After genpm add, follow these steps (your AI agent finds the same steps in src/lib/shipping/AGENTS.md and can do them for you):

  1. Migrations as in src/lib/db/AGENTS.md. Import this module at startup (it registers the totals step).
  2. Create zones and rates in the admin (...shippingAdminResources() in src/genpm/admin.ts, permissions shipping:read|update).
  3. At checkout, store the country and the chosen rate on the cart: setCartMeta(cart.id, { country: 'ES', shippingRateId }); list options with ratesFor(totals, country) and show minDays–maxDays before payment.
  4. Tracking: trackingUrl(carrier, number) when marking an order shipped (@core/orders).
  5. Verify: a cart with country ES gets the cheapest Spanish rate; one over the free threshold pays 0.

What's inside

Paths are relative to src/lib/shipping.

  • index.ts — public API: upsertZone, upsertRate, ratesFor, zoneFor, trackingUrl, CARRIERS, shippingAdminResources.
  • shipping.ts — rules and the totals step. admin.ts — admin resources. schema.ts — tables.

At a glance

Security

GenPM installs a 40-character commit SHA (never a branch), verifies an Ed25519-signed manifest, never runs install scripts and scans AI rules for prompt injection. Details: genpm.net/docs/security.

License

MIT — see LICENSE. Browse the full catalog at genpm.net.

Report @core/shipping

Sign in with GitHub to report a package.