diff --git a/.env.template b/.env.template
index 9d2f8f1bf..9e42e2f31 100644
--- a/.env.template
+++ b/.env.template
@@ -1,3 +1,6 @@
+# Available providers: bigcommerce, shopify
+COMMERCE_PROVIDER=bigcommerce
+
BIGCOMMERCE_STOREFRONT_API_URL=
BIGCOMMERCE_STOREFRONT_API_TOKEN=
BIGCOMMERCE_STORE_API_URL=
diff --git a/README.md b/README.md
index 885c95e85..941b1699b 100644
--- a/README.md
+++ b/README.md
@@ -29,67 +29,16 @@ Next.js Commerce integrates out-of-the-box with BigCommerce and Shopify. We plan
## Considerations
- `framework/commerce` contains all types, helpers and functions to be used as base to build a new **provider**.
-- **Providers** live under `framework`'s root folder and they will extend Next.js Commerce types and functionality.
-- **Features API** is to ensure feature parity between the UI and the Provider. The UI should update accordingly and no extra code should be bundled. All extra configuration for features will live under `features` in `commerce.config.json` and if needed it can also be accessed programatically.
+- **Providers** live under `framework`'s root folder and they will extend Next.js Commerce types and functionality (`framework/commerce`).
+- We have a **Features API** to ensure feature parity between the UI and the Provider. The UI should update accordingly and no extra code should be bundled. All extra configuration for features will live under `features` in `commerce.config.json` and if needed it can also be accessed programatically.
- Each **provider** should add its corresponding `next.config.js` and `commerce.config.json` adding specific data related to the provider. For example in case of BigCommerce, the images CDN and additional API routes.
- **Providers don't depend on anything that's specific to the application they're used in**. They only depend on `framework/commerce`, on their own framework folder and on some dependencies included in `package.json`
-- We recommend that each **provider** ships with an `env.template` file and a `[readme.md](http://readme.md)` file.
-
-## Provider Structure
-
-Next.js Commerce provides a set of utilities and functions to create new providers. This is how a provider structure looks like.
-
-- `product`
- - usePrice
- - useSearch
- - getProduct
- - getAllProducts
-- `wishlist`
- - useWishlist
- - useAddItem
- - useRemoveItem
-- `auth`
- - useLogin
- - useLogout
- - useSignup
-- `customer`
- - useCustomer
- - getCustomerId
- - getCustomerWistlist
-- `cart`
- - useCart
- - useAddItem
- - useRemoveItem
- - useUpdateItem
-- `env.template`
-- `provider.ts`
-- `commerce.config.json`
-- `next.config.js`
-- `README.md`
## Configuration
### How to change providers
-First, update the provider selected in `commerce.config.json`:
-
-```json
-{
- "provider": "bigcommerce",
- "features": {
- "wishlist": true
- }
-}
-```
-
-Then, change the paths defined in `tsconfig.json` and update the `@framework` paths to point to the right folder provider:
-
-```json
-"@framework": ["framework/bigcommerce"],
-"@framework/*": ["framework/bigcommerce/*"]
-```
-
-Make sure to add the environment variables required by the new provider.
+Open `.env.local` and change the value of `COMMERCE_PROVIDER` to the provider you would like to use, then set the environment variables for that provider (use `.env.template` as the base).
### Features
@@ -103,7 +52,6 @@ Every provider defines the features that it supports under `framework/{provider}
- You'll see a config file like this:
```json
{
- "provider": "bigcommerce",
"features": {
"wishlist": false
}
@@ -114,15 +62,9 @@ Every provider defines the features that it supports under `framework/{provider}
### How to create a new provider
-We'd recommend to duplicate a provider folder and push your providers SDK.
+Follow our docs for [Adding a new Commerce Provider](framework/commerce/new-provider.md).
-If you succeeded building a provider, submit a PR so we can all enjoy it.
-
-## Work in progress
-
-We're using Github Projects to keep track of issues in progress and todo's. Here is our [Board](https://github.com/vercel/commerce/projects/1)
-
-People actively working on this project: @okbel & @lfades.
+If you succeeded building a provider, submit a PR with a valid demo and we'll review it asap.
## Contribute
@@ -132,11 +74,15 @@ Our commitment to Open Source can be found [here](https://vercel.com/oss).
2. Create a new branch `git checkout -b MY_BRANCH_NAME`
3. Install yarn: `npm install -g yarn`
4. Install the dependencies: `yarn`
-5. Duplicate `.env.template` and rename it to `.env.local`.
-6. Add proper store values to `.env.local`.
+5. Duplicate `.env.template` and rename it to `.env.local`
+6. Add proper store values to `.env.local`
7. Run `yarn dev` to build and watch for code changes
-8. The development branch is `canary` (this is the branch pull requests should be made against).
- On a release, `canary` branch is rebased into `master`.
+
+## Work in progress
+
+We're using Github Projects to keep track of issues in progress and todo's. Here is our [Board](https://github.com/vercel/commerce/projects/1)
+
+People actively working on this project: @okbel & @lfades.
## Troubleshoot
diff --git a/commerce.config.json b/commerce.config.json
new file mode 100644
index 000000000..08ea78814
--- /dev/null
+++ b/commerce.config.json
@@ -0,0 +1,6 @@
+{
+ "features": {
+ "wishlist": true,
+ "customCheckout": false
+ }
+}
diff --git a/framework/bigcommerce/.env.template b/framework/bigcommerce/.env.template
index 43e85c046..2b91bc095 100644
--- a/framework/bigcommerce/.env.template
+++ b/framework/bigcommerce/.env.template
@@ -1,3 +1,5 @@
+COMMERCE_PROVIDER=bigcommerce
+
BIGCOMMERCE_STOREFRONT_API_URL=
BIGCOMMERCE_STOREFRONT_API_TOKEN=
BIGCOMMERCE_STORE_API_URL=
diff --git a/framework/bigcommerce/README.md b/framework/bigcommerce/README.md
index 2609b1544..7f62a5f3f 100644
--- a/framework/bigcommerce/README.md
+++ b/framework/bigcommerce/README.md
@@ -1,45 +1,34 @@
-# Table of Contents
+# Bigcommerce Provider
-- [BigCommerce Storefront Data Hooks](#bigcommerce-storefront-data-hooks)
- - [Installation](#installation)
- - [General Usage](#general-usage)
- - [CommerceProvider](#commerceprovider)
- - [useLogin hook](#uselogin-hook)
- - [useLogout](#uselogout)
- - [useCustomer](#usecustomer)
- - [useSignup](#usesignup)
- - [usePrice](#useprice)
- - [Cart Hooks](#cart-hooks)
- - [useCart](#usecart)
- - [useAddItem](#useadditem)
- - [useUpdateItem](#useupdateitem)
- - [useRemoveItem](#useremoveitem)
- - [Wishlist Hooks](#wishlist-hooks)
- - [Product Hooks and API](#product-hooks-and-api)
- - [useSearch](#usesearch)
- - [getAllProducts](#getallproducts)
- - [getProduct](#getproduct)
- - [More](#more)
+**Demo:** https://bigcommerce.demo.vercel.store/
-# BigCommerce Storefront Data Hooks
+With the deploy button below you'll be able to have a [BigCommerce](https://www.bigcommerce.com/) account and a store that works with this starter:
-> This project is under active development, new features and updates will be continuously added over time
+[](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fcommerce&project-name=commerce&repo-name=commerce&demo-title=Next.js%20Commerce&demo-description=An%20all-in-one%20starter%20kit%20for%20high-performance%20e-commerce%20sites.&demo-url=https%3A%2F%2Fdemo.vercel.store&demo-image=https%3A%2F%2Fbigcommerce-demo-asset-ksvtgfvnd.vercel.app%2Fbigcommerce.png&integration-ids=oac_MuWZiE4jtmQ2ejZQaQ7ncuDT)
-UI hooks and data fetching methods built from the ground up for e-commerce applications written in React, that use BigCommerce as a headless e-commerce platform. The package provides:
+If you already have a BigCommerce account and want to use your current store, then copy the `.env.template` file in this directory to `.env.local` in the main directory (which will be ignored by Git):
-- Code splitted hooks for data fetching using [SWR](https://swr.vercel.app/), and to handle common user actions
-- Code splitted data fetching methods for initial data population and static generation of content
-- Helpers to create the API endpoints that connect to the hooks, very well suited for Next.js applications
-
-## Installation
-
-To install:
-
-```
-yarn add storefront-data-hooks
+```bash
+cp framework/bigcommerce/.env.template .env.local
```
-After install, the first thing you do is: set your environment variables in `.env.local`
+Then, set the environment variables in `.env.local` to match the ones from your store.
+
+## Contribute
+
+Our commitment to Open Source can be found [here](https://vercel.com/oss).
+
+If you find an issue with the provider or want a new feature, feel free to open a PR or [create a new issue](https://github.com/vercel/commerce/issues).
+
+## Troubleshoot
+
+
+I already own a BigCommerce store. What should I do?
+
+First thing you do is: set your environment variables
+
+
+.env.local
```sh
BIGCOMMERCE_STOREFRONT_API_URL=<>
@@ -50,331 +39,21 @@ BIGCOMMERCE_STORE_API_CLIENT_ID=<>
BIGCOMMERCE_CHANNEL_ID=<>
```
-## General Usage
+If your project was started with a "Deploy with Vercel" button, you can use Vercel's CLI to retrieve these credentials.
-### CommerceProvider
+1. Install Vercel CLI: `npm i -g vercel`
+2. Link local instance with Vercel and Github accounts (creates .vercel file): `vercel link`
+3. Download your environment variables: `vercel env pull .env.local`
-This component is a provider pattern component that creates commerce context for it's children. It takes config values for the locale and an optional `fetcherRef` object for data fetching.
+Next, you're free to customize the starter. More updates coming soon. Stay tuned.
-```jsx
-...
-import { CommerceProvider } from '@bigcommerce/storefront-data-hooks'
+
-const App = ({ locale = 'en-US', children }) => {
- return (
-
- {children}
-
- )
-}
-...
-```
-
-### useLogin hook
-
-Hook for bigcommerce user login functionality, returns `login` function to handle user login.
-
-```jsx
-...
-import useLogin from '@bigcommerce/storefront-data-hooks/use-login'
-
-const LoginView = () => {
- const login = useLogin()
-
- const handleLogin = async () => {
- await login({
- email,
- password,
- })
- }
-
- return (
-