Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next.js Commerce refresh. #966

Merged
merged 3 commits into from
Apr 18, 2023
Merged

Next.js Commerce refresh. #966

merged 3 commits into from
Apr 18, 2023

Conversation

leerob
Copy link
Member

@leerob leerob commented Apr 18, 2023

We're making some updates to Next.js Commerce. Everything prior to this PR marks what we're calling v1 as a point in time to be able to reference and still use going into the future. The current architecture of Commerce is a multi-vendor, interoperable solution, including:

All features can be toggled on or off, and it's easy to change between commerce providers. To support this, we needed to create a "commerce metaframework" where providers could confirm to an API spec to add support for Next.js Commerce. While this worked and was successful for v1, we have different design goals and ambitions for v2.

What You Need To Know

  • v1 will not be updated moving forward. If you need to reference v1, you will still be able to clone and deploy the version tagged at this release.
  • v2 will be shifting to be a single provider vs. provider agnostic. Other providers are welcome to fork this repository and swap out the underlying lib/ implementation that connects to the selected commerce provider (Shopify). This architecture was chosen to reduce the surface area of the codebase, remove the intermediate metaframework layer for provider-interoperability, and enable usage with the latest Next.js and React features.
  • We will be sharing more about v2 in the future as we continue to iterate before the marked release.

Thank you so much! 🎉

@vercel
Copy link

vercel bot commented Apr 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
commerce-bigcommerce ❌ Failed (Inspect) Apr 18, 2023 2:58am
commerce-commercejs ❌ Failed (Inspect) Apr 18, 2023 2:58am
commerce-kibocommerce ❌ Failed (Inspect) Apr 18, 2023 2:58am
commerce-local ❌ Failed (Inspect) Apr 18, 2023 2:58am
commerce-ordercloud ❌ Failed (Inspect) Apr 18, 2023 2:58am
commerce-saleor 🔄 Building (Inspect) Apr 18, 2023 2:58am
commerce-shopify ❌ Failed (Inspect) Apr 18, 2023 2:58am
commerce-spree ❌ Failed (Inspect) Apr 18, 2023 2:58am
commerce-swell ❌ Failed (Inspect) Apr 18, 2023 2:58am
commerce-vendure 🔄 Building (Inspect) Apr 18, 2023 2:58am
salesforce-commerce-cloud ❌ Failed (Inspect) Apr 18, 2023 2:58am

@michaelbromley
Copy link
Contributor

Thanks for providing some clarity on the status of the project. Over at Vendure we have been getting quite a lot of support questions about the status of this repo. It has been clear for a while that v1 had hit a bit of a dead end.

I think the decision you took makes sense - being platform agnostic is theoretically good but in practice any one project will only ever use a single backend, so all the abstraction required to make it agnostic is immediately just unwanted bloat that over-complicates the architecture. I think this is also what Vue Storefront also eventually learned.

There's still going to be demand for Next.js in the Vendure community of course, but we might go with building our own starter kit tailored to our APIs, like we did with our existing Remix, Qwik & Angular starters. But I'll be keeping an eye on this repo still to see to what degree it makes sense to recommend to our users to fork and adapt it for their Vendure projects.

@megetron
Copy link

Thank you for the update. I must admit that I am not as fond of this decision. I appreciate the performance and architecture of the frontend Next.js Commerce, as well as the ability to choose the backend. Removing this option means I am now forced to use the Shopify solution, which is not the one I currently use.

However, I am hopeful that the "lib" folder's architecture will allow me to replace the GraphQL queries with those I already use on v1. This would make replacing the "lib" a simple copy-and-paste process with some code replacements.

I look forward to your future updates regarding the v2 version.

@loan-laux
Copy link

I agree with @megetron. I hope that the lib folder will be easily swappable. At Trellis, we love Next Commerce and we use it a lot for BigCommerce projects. It's a shame that it's going to become Shopify-only without support for third-party connectors. The platform-agnostic concept was the whole point of the project initially.

It almost makes me want to fork and keep maintaining the v1... How hard can it be to make it work nicely with Next.js 13? I imagine it would be quite the effort if Vercel themselves decided against it.

@manovotny
Copy link
Collaborator

We understand that the new direction will come with mixed feelings. @michaelbromley is right. Being platform agnostic is theoretically good, but typically comes with a more complex architecture to allow the flexibility. That was evident with v1. As you can see, this PR removed close to 150k lines of code while only adding 6k.

The goals of the new template are to:

  • Provide a singular focused template (we chose Shopify) to clearly and concisely demonstrate how to create a best in class ecommerce experience.
  • Demonstrate Next.js’s latest features, such as App Router, RSC (React Server Components), Suspense, Route Handlers, Edge functions, new fetching and caching paradigms, Metadata, dynamic OG images, and more.
  • Include missing real-world ecommerce features such as out of stocks, order history, cross variant / option availability (aka. Amazon style), dynamically driving all content and features via the provider (ie. collections, menus, pages, etc.), and more.

As for supporting other providers, that’s where Vercel’s Template Marketplace comes in. We recommend and welcome templates that will produce the same goals listed above.

loan-laux pushed a commit to TrellisCommerce/next-commerce-bigcommerce that referenced this pull request May 11, 2023
We're making some updates to Next.js Commerce. Everything prior to this commit marks what we're calling [`v1`](https://github.com/vercel/commerce/releases/tag/v1) as a point in time to be able to reference and still use going into the future. The current architecture of Commerce is a multi-vendor, interoperable solution, including:

- [Shopify](https://shopify.vercel.store/)
- [Swell](https://swell.vercel.store/)
- [BigCommerce](https://bigcommerce.vercel.store/)
- [Vendure](https://vendure.vercel.store/)
- [Saleor](https://saleor.vercel.store/)
- [Ordercloud](https://ordercloud.vercel.store/)
- [Spree](https://spree.vercel.store/)
- [Kibo Commerce](https://kibocommerce.vercel.store/)
- [Commerce.js](https://commercejs.vercel.store/)
- [SalesForce Cloud Commerce](https://salesforce-cloud-commerce.vercel.store/)

All features can be toggled on or off, and it's easy to change between commerce providers. To support this, we needed to create a ["commerce metaframework"](https://github.com/vercel/commerce/blob/d1d9e8c4343e70d72df6e00ec95f6ea4efbb7c54/packages/commerce/new-provider.md) where providers could confirm to an API spec to add support for Next.js Commerce. While this worked and was successful for `v1`, we have different design goals and ambitions for `v2`.

**What You Need To Know**

- `v1` will not be updated moving forward. If you need to reference `v1`, you will still be able to clone and deploy the version tagged at this release.
- `v2` will be shifting to be a single provider vs. provider agnostic. Other providers are welcome to fork this repository and swap out the underlying `lib/` implementation that connects to the selected commerce provider (Shopify). This architecture was chosen to reduce the surface area of the codebase, remove the intermediate metaframework layer for provider-interoperability, and enable usage with the latest Next.js and React features.
- We will be sharing more about `v2` in the future as we continue to iterate before the marked release.
import { defaultSort, sorting } from 'lib/constants';
import { getProducts } from 'lib/shopify';

export const runtime = 'edge';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for providing an amazing demo.👍

I have a question to ask you.

Could you please explain the rationale behind choosing to use the Edge runtime in this page?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m1nsuplee it provided the fastest experience at the time, though we're now converting the app to use Partial Prerendering (see #1236 for more information).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants