This is a mono-repo-like experience, you will find the core of hydrogen running in the root directory, you will also find a sanity
instance running inside of the cms
directory powered by next.js
.
Check out Hydrogen docs Get familiar with Remix
- Remix
- Hydrogen
- Oxygen
- Shopify CLI
- ESLint
- Prettier
- GraphQL generator
- TypeScript and JavaScript flavors
- Minimal setup of components and routes
Requirements:
- Node.js version 16.14.0 or higher
*Remember to update .env
with your shop's domain and Storefront API token!
yarn or npm install
This is tricker given the way the Sanity CLI is configured, the easiest method is to generate a new Sanity instance which you can do following this guide and I will explain in a lesson to make it easier.
Once you have the SANITY-CLI installed you can simply navigate to the cms
directory and run sanity init --env .env.local
in the terminal.
You will be asked a series of questions, create a new project, name the project and assign it to your personal sanity or your personal sanity or, from there you can follow the prompts as follows:
? Use the default dataset configuration? Yes
✔ Creating dataset
? Would you like to add configuration files for a Sanity project in this Next.js folder? Yes
? Do you want to use TypeScript? No
? Would you like an embedded Sanity Studio? No
? File /sanity.cli.js already exists. Do you want to overwrite it? No
? Select project template to use Clean project with no predefined schemas
? File /sanity/schema.js already exists. Do you want to overwrite it? No
? File /sanity/env.js already exists. Do you want to overwrite it? No
? File /sanity/lib/client.js already exists. Do you want to overwrite it? No
? File /sanity/lib/image.js already exists. Do you want to overwrite it? No
? Would you like to add the project ID and dataset to your .env.local file? Yes
^^ Mostly override/create the `env.local`` is all you need to do
Once you init a new sanity instance, you can simply take the generate sanity ID and place it in a duplicated .sample.env
file that you should save as .env
and not commit to your repo! We will be deploying the cms to vercel and putting our environment variable there as well so the sanity instance is hosted.