Conversation
- Resolve site URL via STOREFRONT_URL and RAILWAY_PUBLIC_DOMAIN before localhost - Add sitemapLocales (default da) so /en is omitted until English launches - Document NEXT_PUBLIC_SITE_URL in env.template; update openmemory sitemap note Made-with: Cursor
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 45 minutes and 20 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis change introduces a new Changes
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/storefront/src/lib/site-url.ts`:
- Line 8: The inferred host strings returned in this module aren't being
normalized with the existing stripTrailingSlash helper, which allows inputs with
trailing slashes to produce double-slash URLs; update every place that returns
an inferred host (the functions that currently compute/return inferred host
values) to pass the host through stripTrailingSlash before returning or
concatenating, and when concatenating with paths ensure you trim leading slashes
from the path portion so you always join a normalized host from
stripTrailingSlash(...) with a path that does not start with a slash.
In `@apps/storefront/src/lib/sitemap-build.ts`:
- Around line 183-184: The code coerces any non-"en" row.locale into "da" (via
const loc = row.locale === "en" ? "en" : "da"), which can incorrectly map
unknown/malformed locales into Danish URLs; update the logic in sitemap-build
(where loc and sitemapLocaleSet are used) to first validate row.locale against
an explicit allowlist of supported locales (e.g., ["en","da"]) and skip entries
whose locale is not in that allowlist before applying sitemapLocaleSet.has(loc)
or mapping; ensure the same change is applied to the analogous branch around the
second occurrence (the block referenced near where loc is reassigned/used around
line ~205) so only known locales are processed and unknown locales are skipped.
In `@openmemory.md`:
- Line 52: Update the documentation to include the final localhost fallback in
the canonical URL precedence chain by noting that getStorefrontSiteUrl()
(implemented in apps/storefront/src/lib/site-url.ts) will fall back to
"http://localhost:3000" if NEXT_PUBLIC_SITE_URL, STOREFRONT_URL, VERCEL_URL and
RAILWAY_PUBLIC_DOMAIN are all absent; revise the sitemap/canonical description
on line 52 to list that localhost fallback so the runbook/debug behavior matches
the actual implementation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4f5d6e40-3c86-43ee-a5ed-0bf6fb37a4af
📒 Files selected for processing (5)
apps/storefront/env.templateapps/storefront/src/i18n/config.tsapps/storefront/src/lib/site-url.tsapps/storefront/src/lib/sitemap-build.tsopenmemory.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Typecheck Storefront
🧰 Additional context used
📓 Path-based instructions (8)
apps/storefront/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
apps/storefront/**/*.{ts,tsx,js,jsx}: Storefront app inapps/storefrontshould be a Next.js customer UI with i18n routes that composes data from both Medusa and Payload CMS
Customer-facing URLs must follow the Storefront routing pattern with locale prefixes (/da/...,/en/...)
Files:
apps/storefront/src/i18n/config.tsapps/storefront/src/lib/sitemap-build.tsapps/storefront/src/lib/site-url.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/code-structure.mdc)
**/*.{ts,tsx}: Treat files > ~400 lines in one .tsx as tech debt — split before adding features
Use interface for object shapes in TypeScript; keep near usage or in *.types.ts files
Avoid any type in TypeScript; use unknown + narrowing or Zod-inferred types where validated
Prefer as const objects + union type over enums unless enum is required by an external API
Prefer direct imports from the module you need (e.g.@/components/ui/button) to avoid pulling large barrels into client bundlesDefine a type for const functions when possible
**/*.{ts,tsx}: Use interfaces for object shapes in TypeScript; write functional components with typed props
Avoid enums; preferas constobjects combined with union types
Do not useanytype; useunknownwith type narrowing or Zod-inferred types for validated data
Files:
apps/storefront/src/i18n/config.tsapps/storefront/src/lib/sitemap-build.tsapps/storefront/src/lib/site-url.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/front-end-cursor-rules.mdc)
**/*.{js,jsx,ts,tsx}: Use early returns whenever possible to make the code more readable
Use descriptive variable and function/const names
Use const instead of function declarations, for example 'const toggle = () =>'
Don't use semicolons
Files:
apps/storefront/src/i18n/config.tsapps/storefront/src/lib/sitemap-build.tsapps/storefront/src/lib/site-url.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/nextjs-react-typescript-cursor-rules.mdc)
**/*.{ts,tsx,js,jsx}: Use concise, technical TypeScript; write functional and declarative code; avoid classes
Prefer modularization over duplication; use descriptive names likeisLoading,hasError
Use thefunctionkeyword for pure functions; write declarative JSX
Files:
apps/storefront/src/i18n/config.tsapps/storefront/src/lib/sitemap-build.tsapps/storefront/src/lib/site-url.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/nextjs-react-typescript-cursor-rules.mdc)
**/*.{tsx,ts}: File layout: place exported component first, then subcomponents, helpers, static content, types. Followcode-structure.mdcfor file size and splitting decisions
Favor named exports for components
Default to Server Components in Next.js; use'use client'only for interactivity, browser APIs, or third-party widgets like Stripe; keep client boundaries small
Usenext/dynamicfor heavy or below-the-fold components
Usenuqslibrary for managing URL state and search parameters
Do not fetch data on the client when the server can perform the fetch; avoid duplicating fetches in layouts and pages without usingReact.cache()
Files:
apps/storefront/src/i18n/config.tsapps/storefront/src/lib/sitemap-build.tsapps/storefront/src/lib/site-url.ts
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/security.mdc)
Do not log or echo secrets; redact secrets in examples and documentation
Files:
apps/storefront/src/i18n/config.tsapps/storefront/src/lib/sitemap-build.tsapps/storefront/src/lib/site-url.ts
apps/storefront/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/storefront-next.mdc)
apps/storefront/src/**/*.{ts,tsx}: Talk to Medusa via@medusajs/js-sdkand the shared client insrc/lib/medusa.ts(publishable key,NEXT_PUBLIC_MEDUSA_BACKEND_URL)
Custom store endpoints: usemedusa.client.fetchor SDK extensions consistently; do not scatter rawfetchURLs without a single base pattern
Payload/content: use existinglib/payload-*.tshelpers; passlocale(da/en) for localized APIs
Parallelize independent loads: start async work thenPromise.allto avoid sequential waterfalls
Choose cache explicitly:cache: 'no-store'vsrevalidatevs static per data freshness needs
Followcode-structure.mdcfor file structure and organization: line budgets, splitting steps/hooks/types, React/TypeScript hygiene
Files:
apps/storefront/src/i18n/config.tsapps/storefront/src/lib/sitemap-build.tsapps/storefront/src/lib/site-url.ts
**/lib/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/code-structure.mdc)
**/lib/**/*.{ts,tsx}: Pure utilities / mappers (lib/.ts) should be ≤ ~400 lines; split by domain (cart-.ts, checkout-*.ts)
Write pure helpers (formatting, mapping) using function keyword with single responsibility for easy unit testing
Files:
apps/storefront/src/lib/sitemap-build.tsapps/storefront/src/lib/site-url.ts
🧠 Learnings (14)
📚 Learning: 2026-04-15T16:59:15.305Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/payload-cms.mdc:0-0
Timestamp: 2026-04-15T16:59:15.305Z
Learning: Applies to apps/cms/**/payload.config.ts : Configure locales `da` (default) and `en` with fallback matching `payload.config.ts`. Localized fields belong in collection/global configs; API consumers use `?locale=` query parameter as documented.
Applied to files:
apps/storefront/src/i18n/config.tsapps/storefront/src/lib/sitemap-build.ts
📚 Learning: 2026-04-15T16:59:32.095Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/storefront-next.mdc:0-0
Timestamp: 2026-04-15T16:59:32.095Z
Learning: Applies to apps/storefront/src/**/*.{ts,tsx} : Payload/content: use existing `lib/payload-*.ts` helpers; pass `locale` (`da` / `en`) for localized APIs
Applied to files:
apps/storefront/src/i18n/config.tsapps/storefront/src/lib/sitemap-build.tsopenmemory.md
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Applies to apps/storefront/**/*.{ts,tsx,js,jsx} : Customer-facing URLs must follow the Storefront routing pattern with locale prefixes (`/da/...`, `/en/...`)
Applied to files:
apps/storefront/src/i18n/config.tsapps/storefront/src/lib/sitemap-build.tsapps/storefront/src/lib/site-url.tsopenmemory.md
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Applies to apps/storefront/**/*.{ts,tsx,js,jsx} : Storefront app in `apps/storefront` should be a Next.js customer UI with i18n routes that composes data from both Medusa and Payload CMS
Applied to files:
apps/storefront/src/i18n/config.tsapps/storefront/src/lib/sitemap-build.tsapps/storefront/env.templateopenmemory.md
📚 Learning: 2026-04-15T16:59:32.095Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/storefront-next.mdc:0-0
Timestamp: 2026-04-15T16:59:32.095Z
Learning: Applies to apps/storefront/src/**/*.{ts,tsx} : Talk to Medusa via `medusajs/js-sdk` and the shared client in `src/lib/medusa.ts` (publishable key, `NEXT_PUBLIC_MEDUSA_BACKEND_URL`)
Applied to files:
apps/storefront/src/lib/sitemap-build.tsapps/storefront/env.templateopenmemory.md
📚 Learning: 2026-04-15T16:58:38.430Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/code-structure.mdc:0-0
Timestamp: 2026-04-15T16:58:38.430Z
Learning: Applies to **/(page|layout).{ts,tsx} : Place async loaders in lib/ or getXxxData.ts; keep page.tsx as composition + generateMetadata, not 200 lines of fetch/transform
Applied to files:
apps/storefront/src/lib/sitemap-build.ts
📚 Learning: 2026-04-15T16:59:32.095Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/storefront-next.mdc:0-0
Timestamp: 2026-04-15T16:59:32.095Z
Learning: Applies to apps/storefront/src/**/*.{ts,tsx} : Custom store endpoints: use `medusa.client.fetch` or SDK extensions consistently; do not scatter raw `fetch` URLs without a single base pattern
Applied to files:
apps/storefront/src/lib/sitemap-build.tsapps/storefront/src/lib/site-url.ts
📚 Learning: 2026-04-15T16:59:22.553Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/security.mdc:0-0
Timestamp: 2026-04-15T16:59:22.553Z
Learning: Applies to .env* : Keep server-only secrets in server components, route handlers, or server actions — never use `NEXT_PUBLIC_*` prefix unless intentionally public (e.g., publishable key)
Applied to files:
apps/storefront/env.template
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Marketing copy, SEO text, layout content, navigation, footer, and homepage sections must be sourced from Payload only; reference Medusa entities by ID/handle where needed and do not duplicate commerce state in CMS
Applied to files:
openmemory.md
📚 Learning: 2026-04-15T16:59:32.095Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/storefront-next.mdc:0-0
Timestamp: 2026-04-15T16:59:32.095Z
Learning: Ecommerce UX: align with storefront skill references when building cart, checkout, PLP, PDP
Applied to files:
openmemory.md
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Applies to apps/cms/**/*.{ts,tsx,js,jsx} : CMS app in `apps/cms` should implement Payload for managing pages, articles, navigation, homepage, and editorial product copy with live preview to storefront
Applied to files:
openmemory.md
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Applies to apps/commerce/**/*.{ts,tsx,js,jsx} : Commerce app in `apps/commerce` should implement Medusa for handling carts, orders, payments, subscriptions, shipping, and product catalog for sale
Applied to files:
openmemory.md
📚 Learning: 2026-04-15T16:58:24.041Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2026-04-15T16:58:24.041Z
Learning: Prices, inventory, cart, checkout, orders, subscriptions, and shipping options must be sourced from Medusa only
Applied to files:
openmemory.md
📚 Learning: 2026-04-15T16:59:32.095Z
Learnt from: CR
Repo: eskoubar95/guapo PR: 0
File: .cursor/rules/storefront-next.mdc:0-0
Timestamp: 2026-04-15T16:59:32.095Z
Learning: Applies to apps/storefront/src/**/*.{ts,tsx} : Follow `code-structure.mdc` for file structure and organization: line budgets, splitting steps/hooks/types, React/TypeScript hygiene
Applied to files:
openmemory.md
🔇 Additional comments (3)
apps/storefront/src/i18n/config.ts (1)
11-16: Good separation of routing locales vs sitemap locales.This keeps runtime locale support intact while safely controlling what gets indexed.
apps/storefront/src/lib/sitemap-build.ts (1)
216-216: Nice change to generate route entries directly fromsitemapLocales.This keeps static/catalog URL generation aligned with indexing policy.
apps/storefront/env.template (1)
4-7: Env guidance update is clear and deployment-friendly.The comments now make canonical URL precedence explicit and reduce risk of localhost leaking into SEO URLs.
- Normalize inferred origins with stripTrailingSlash (multi-slash trim) - Skip Payload sitemap rows unless locale passes isValidLocale (da|en) - Document localhost fallback in openmemory canonical chain Made-with: Cursor
Summary
STOREFRONT_URLandRAILWAY_PUBLIC_DOMAINwhenNEXT_PUBLIC_SITE_URL/ Vercel env is missing, avoidinglocalhostinsitemap.xml. Sitemap lists da only viasitemapLocalesuntil /en is ready for indexing.stagingsince last promotion.Test plan
/sitemap.xmluseshttps://guapo.store(setNEXT_PUBLIC_SITE_URLon the storefront Railway service)Deployment / ops
NEXT_PUBLIC_SITE_URL=https://guapo.storeon the storefront Railway service and redeploy so canonical URLs are explicit.Rollback
mainor redeploy previous production image if issues arise.Made with Cursor
Summary by CodeRabbit
Improvements
Documentation