Jieren Chen 41174b3cc5
f
2024-09-23 19:12:25 -04:00
2024-04-17 21:54:09 -05:00
2024-09-23 19:11:06 -04:00
2024-09-23 19:11:06 -04:00
2024-09-23 18:54:22 -04:00
f
2024-09-23 19:12:25 -04:00
2023-04-17 22:00:47 -05:00
2023-04-17 22:00:47 -05:00
2024-09-23 19:11:06 -04:00
2024-08-13 13:33:05 -05:00
2024-08-13 13:33:05 -05:00
2024-09-23 18:54:22 -04:00

Next.js x Fourthwall

Deploy with Vercel

A high-perfomance, server-rendered Next.js App Router ecommerce application.

Create a store, get a storefront token

A storefront token is a public access token that allows you to pull product data from your Fourthwall store. To get a storefront token:

  1. Set up a store on Fourthwall.

  2. Make some products and set up a collection.

  3. (optional) Style your store for the checkout flow.

  4. After you have signed up, get a storefront token.

  5. Fill out the environment variables below in .env.local.

NEXT_PUBLIC_FW_API_URL="https://api.fourthwall.com"

NEXT_PUBLIC_FW_COLLECTION="<the handle of your collection>" # Example: launch. This is available at the details page for the collection. See below for more details.
NEXT_PUBLIC_FW_STOREFRONT_TOKEN="<your storefront token>" # Example: ptkn_...
NEXT_PUBLIC_FW_CHECKOUT="<your store url>" # Example: vercel-shop.fourthwall.com. Used for checkout

NEXT_PUBLIC_VERCEL_URL="<the url of your vercel site>" # Example: fw-commerce.vercel.app. This is used for sitemap.xml + robots.txt.

Develop locally

You will need to use the environment variables defined in .env.example to run Next.js Commerce. It's recommended you use Vercel Environment Variables for this, but a .env.local file is all that is necessary.

Note: You should not commit your .env.local file or it will expose secrets that will allow others to use your Fourthwall store.

  1. Install Vercel CLI: npm i -g vercel
  2. Link local instance with Vercel and GitHub accounts (creates .vercel directory): vercel link
  3. Download your environment variables: vercel env pull
pnpm install
pnpm dev

Your app should now be running on localhost:3000.

Deploying

vercel # Initializes the project
vercel env add NEXT_PUBLIC_FW_API_URL # Will prompt you for the value
vercel env add NEXT_PUBLIC_FW_COLLECTION
vercel env add NEXT_PUBLIC_FW_STOREFRONT_TOKEN
vercel env add NEXT_PUBLIC_FW_CHECKOUT
vercel env add NEXT_PUBLIC_VERCEL_URL

vercel --prod # Deploys to production

Resources

Description
clone of nextjs commerce (vercel) for a nice ecommerce site based in js.
Readme 2.6 GiB
Languages
TypeScript 99.2%
CSS 0.7%
JavaScript 0.1%