Code Monkey home page Code Monkey logo

alpha-catalyst's Introduction

Catalyst

Warning

  • Catalyst is in development and should not be used in production environments.
  • The experimental with-makeswift version of Catalyst is a work in progress and not ready for feedback. During Catalyst’s Developer Preview, focus on the core Catalyst storefront features.

Catalyst is a composable, fully customizable headless storefront that offers a set of opinionated defaults. It is intended to fit the needs of modern developers, merchants, and shoppers. Catalyst is built with Next.js (nextjs.org) and uses our React.js-based (react.dev) Reactant storefront components.

The Catalyst monorepo contains the following:

Requirements

Node.js

Use Node.js 18+.

You may wish to use Node Version Manager, or nvm (GitHub), to facilitate moving back and forth between different versions of node. You can install nvm using either the instructions at the preceding link or your operating system package manager of choice.

Corepack and pnpm

This project uses corepack (nodejs.org) to install and enable the pnpm (pnpm.io) package manager. Corepack comes bundled with Node 18, so you do not need to install either of these packages on their own.

Catalyst is configured such that pnpm replaces npm. When you enhance your project with additional packages or scripts, be sure to use the pnpm command. For more information, see the pnpm documentation.

Getting Started

  1. Clone the project to your local environment:
git clone [email protected]:bigcommerce/catalyst.git && cd catalyst
  1. To help stay up to date with the latest changes, add the BigCommerce repo to your project as the upstream repository:
git remote add upstream [email protected]:bigcommerce/catalyst.git
  1. Use corepack to enable pnpm, then use pnpm to install project dependencies:
corepack enable pnpm
pnpm install
  1. Set up environment variables.

This repository contains a setup script that generates a local development environment file, .env.local. The environment file contains the authentication credentials and other variables required to connect Catalyst to an existing BigCommerce store. Run the script from the root directory of this repository and follow the prompts:

node scripts/setup.mjs

If you prefer to manually enter your own environment variables, you can run cp .env.example .env.local to get started.

The following table contains a description of each variable in the .env.local file:

Variable Description
BIGCOMMERCE_STORE_HASH The hash visible in the subject store's URL when signed in to the store control panel. The control panel URL is of the form https://store-{hash}.mybigcommerce.com.
BIGCOMMERCE_ACCESS_TOKEN The access token from a store-level API account (BigCommerce Dev Center). The only OAuth scope (BigCommerce Dev Center) required to run Catalyst is Carts read-only.
BIGCOMMERCE_CUSTOMER_IMPERSONATION_TOKEN A bearer token that authorizes server-to-server requests to the GraphQL Storefront API (BigCommerce Dev Center).
BIGCOMMERCE_CDN_HOSTNAME Ensures that the Next.js Image Optimization API is configured to serve external images from BigCommerce. Used in the Next.js Configuration file. For more information, see the Next.js Image Component API Reference (next.js).
BIGCOMMERCE_CHANNEL_ID The channel ID for the Catalyst storefront's dedicated channel.
AUTH_SECRET Used by NextAuth, can be generated by running openssl rand -hex 32 in your terminal.
MAKESWIFT_SITE_API_KEY Only required for the experimental with-makeswift version of Catalyst. When working with the core product, comment out this variable. For more about setting this variable, consult the with-makeswift README.
  1. Optionally, to optimize your workflow, use the following command to configure VSCode with the project-specific settings the Catalyst team has created:
cp .vscode/settings.example.json .vscode/settings.json
  1. Start the Catalyst development server!
pnpm run dev

The dev script runs all packages and apps in watch mode. The following table lists localhost URLs with the default ports. When a port is unavailable, Catalyst uses the next available port. For example, if 3000 is in use, core and with-makeswift will run on 3001 and 3002, respectively.

Process URL with port
Core Catalyst storefront http://localhost:3000
Experimental Makeswift-enabled storefront http://localhost:3001
Reactant Storybook http://localhost:6006

Happy developing! Let us know how things are going in the dedicated Slack channel.

Using the vercel CLI

If you are able to install and use the Vercel CLI (vercel.com) on your local machine, you can use it to pull the environment variables from Vercel. The vercel CLI is not required to run Catalyst locally.

  1. Link the app to your Vercel project

This command will take you through the process of linking the app to your Vercel project.

vercel link
  1. Pull the environment variables from Vercel

This will pull the development environment variables from Vercel and write them to .env.local.

vercel env pull .env.local

If you need to pull the production environment variables for debugging, use the --prod flag.

vercel env pull .env.production --prod

Deploy using Vercel

One common way to deploy a Next.js app for development is to use the Vercel Platform (vercel.com). Consult the Next.js deployment documentation (next.js) for more details.

Resources

Next.js

alpha-catalyst's People

Contributors

chanceaclark avatar deini avatar jorgemoya avatar bc-alexsaiannyi avatar yurytut1993 avatar matthewvolk avatar andrewreifman avatar avattipalli avatar becomevocal avatar christensenep avatar bc-yevhenii-buliuk avatar bookernath avatar dependabot[bot] avatar jairo-bc avatar jmwiese avatar bc-krasnoshapka avatar bc-0dp avatar

Watchers

Glynn Jordan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.