This project uses a Yarn monorepo with two primary workspaces:
- webs: A Gatsby site (front-end).
- studio: A Sanity Content Studio (schema and content management).
Because pushing directly to main
is impossible, changes must be managed through issues, feature branches, and pull requests (PRs). This workflow ensures clarity, collaboration, and minimal downtime when integrating changes.
-
Clone the repo
git clone <your-repo-url>
-
Install dependencies (in the root folder)
cd hof-gatsby-sanity yarn install
-
Verify Yarn is installed
yarn --version
Before making any changes, create a GitHub issue describing the task or feature:
-
Create an issue:
- Provide a clear title and description of the task, including any affected areas (
webs
,studio
, or both).
- Provide a clear title and description of the task, including any affected areas (
-
Create a branch off the issue:
git checkout -b feat/<issue-number>-<short-description>
- Example:
feat/42-add-new-schema-field
- Example:
-
Navigate to
webs
cd webs yarn develop
- The Gatsby dev (development) server runs at http://localhost:8000.
-
Edit code in the
webs
folder.- Changes appear automatically (hot reload).
-
Navigate to
studio
cd studio yarn dev
- The Studio runs at http://localhost:3333.
-
Schema or content updates
- Edit files in
studio/schemas
and see changes in the local Studio.
- Edit files in
If schema changes in Sanity require corresponding updates in Gatsby, handle them together in a single feature branch.
-
Create a branch off the issue:
git checkout -b feat/<issue-number>-<description>
- Example:
feat/15-update-schema-and-frontend
- Example:
-
Edit the schema in
studio
:- Make the necessary updates and test locally:
cd studio yarn dev
- Make the necessary updates and test locally:
-
Update Gatsby in
webs
:- Adjust GraphQL queries/components to match the schema changes.
- Test by running
yarn develop
inwebs
.
-
Commit changes (both
studio
andwebs
):git add . git commit -m "Update schema and front-end for issue <#>"
-
Push and open a PR:
git push origin feat/<issue-number>-<description>
- Open a PR linking back to the issue.
-
Merge and Deploy:
- After the PR is approved:
- Merge into
main
. - Redeploy the GraphQL schema:
cd studio yarn deploy-graphql
- Deploy the updated Gatsby site.
- Merge into
- After the PR is approved:
If changes only affect the Studio:
-
Create an issue and branch:
git checkout -b feat/<issue-number>-<studio-description>
-
Edit schema or content structures in
studio
:- Run
yarn dev
and test locally.
- Run
-
Commit and push:
git add . git commit -m "Studio-only changes for issue <#>" git push origin feat/<issue-number>-<studio-description>
-
Open a PR, merge, and redeploy the GraphQL schema if necessary:
yarn deploy-graphql
If changes only affect the Gatsby site:
-
Create an issue and branch:
git checkout -b feat/<issue-number>-<webs-description>
-
Edit code in
webs
:- Run
yarn develop
and test locally.
- Run
-
Commit and push:
git add . git commit -m "Webs-only changes for issue <#>" git push origin feat/<issue-number>-<webs-description>
-
Open a PR, merge, and deploy the updated Gatsby site.
If the production environment has updates needed in development:
-
Update production data in the live Studio.
-
Clone production into development:
cd studio yarn clone
- This exports the production dataset and imports it into the development dataset.
-
Restart local environments to ensure all data is up to date.
-
Use Issues for Every Task
- Before starting any work, create an issue describing the task or change.
- Reference the issue in your branch name and commit messages.
-
Keep PRs Small and Focused
- Avoid combining unrelated changes in one PR.
-
Test Locally First
- Ensure schema updates and front-end changes are thoroughly tested locally before creating a PR.
-
Deploy in Sync
- Merge schema changes first (or simultaneously) before deploying front-end updates that depend on them.
-
Communicate
- Share changes that could impact other developers, especially schema modifications.
- Gatsby Docs: https://www.gatsbyjs.com/docs/
- Sanity Docs: https://www.sanity.io/docs