decocms / decocms/apps-start

Add Magento commerce app port to @decocms/apps-start

Open
#60 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Summary

@decocms/apps-start ships VTEX and Shopify ports today (per the package README and folder layout). There is no Magento port, even though deco-cx/apps has a mature Magento integration that powers multiple production sites.

This blocks migration of Magento-based Fresh storefronts to TanStack Start: deco-migrate deletes the legacy magento/ folder's imports but the new src/setup/commerce-loaders.ts has nothing to map them to, so cart / user / wishlist / PDP / PLP loaders break post-migration.

Source to port

deco-cx/apps, folder magento/ — 60 TypeScript files, structurally identical to apps/vtex/ (mod.ts, manifest.gen.ts, loaders/, actions/, hooks/, middleware.ts, utils/clientGraphql, utils/client, utils/transform.ts, utils/cache.ts).

Key entry points to port (≈54 generic files):

  • mod.ts — App definition with configureMagento + middleware
  • loaders/cart.ts, loaders/user.ts, loaders/wishlist.ts, loaders/proxy.ts
  • loaders/product/detailsPage.ts, loaders/product/listingPage.ts, loaders/product/list.ts
  • loaders/routes/*
  • actions/{cart,newsletter,product,wishlist}/*
  • hooks/{useCart,useUser,useWishlist}.ts (refactor to react-query like vtex/hooks/)
  • utils/clientGraphql/*, utils/client/*, utils/{transform,cache,graphql,cart}.ts

Required adaptations (Deno → Node)

  • $fresh/server.ts imports → TanStack/React equivalents
  • deco/* imports → @decocms/start/* and @decocms/apps-start/commerce
  • Drop .ts extension from relative imports
  • Replace Deno std/cache LRU with npm:lru-cache (mirror pattern in apps-start/vtex/utils/fetchCache.ts)
  • Wrap loaders/actions in createServerFn
  • Cookies via @decocms/apps-start/commerce helpers

CRITICAL: preserve ExtensionOf pattern

The existing Magento app accepts extensions?: ExtensionOf<T>[] on key loaders (loaders/extensions/cart, loaders/extensions/product/{detailsPage,listingPage,list}). This is how sites plug in third-party features (Livelo points, Amasty reviews, etc.) without forking the app.

Please port this pattern intact. The first consumer (granadobr-tanstack) will keep Granado-specific extensions (Livelo + Amasty) in src/apps/magento-granado/ locally — that only works if the generic Magento loaders accept and apply extensions[].

Context

Sites blocked on this:

  • granadobr-tanstack (Granado, Brazilian cosmetics) — repo: deco-sites/granadobr-tanstack
  • Future Magento migrations across the deco fleet

Companion framework issue: decocms/deco-start — Platform magento missing from migrate's enum.

Happy to send a PR — let me know the preferred patch granularity (one big PR vs split per area).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the source deco-cx/apps/magento/ folder with the existing apps/vtex/ port, starting at mod.ts, the commerce loaders, actions, hooks, and utilities named in the issue. Check the TanStack/Node adaptations and apps-start/vtex/utils/fetchCache.ts first. Done means a Magento app port works in @decocms/apps-start, including the ExtensionOf pattern for cart and product loaders.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, react, typescript
Domain
backend-api-design, full-stack
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.