Prepare your monorepo

Sanity is much more than a CMS, and Sanity Studio is just one part of the Content Operating System. Before creating more Sanity-driven applications, let's configure your project files in a way that will better suit the rest of the course material.
Putting multiple applications into a "monorepo" is a popular way of colocating separate-but-related applications.
Configuring a PNPM workspace is a popular standard for monorepos and allows you to install dependencies or start development servers across a number of applications with a single command.
The following files are the minimum you need to create a PNPM workspace.
package.json
file at the root of the project{ "name": "day-one-content-operations", "private": true, "version": "1.0.0", "description": "Day One Content Operations", "scripts": { "dev": "pnpm run --parallel dev", "build": "pnpm run --parallel build" }, "engines": { "node": ">=20.0.0", "pnpm": ">=10.0.0" }}
pnpm-workspace.yaml
file at the root of the projectpackages: - "apps/*"
README.md
file at the root of the project# Day One Content Operations
Applications developed while following lessons on sanity.io/learn
.gitignore
file at the root of the projectnode_modules
You can now run the following command from the root (day-one
) directory to install dependencies across multiple applications:
# in the root directorypnpm install
Or run the following to concurrently run the development servers for all your applications:
# in the root directorypnpm run dev
You only have one application now, but you will create a second one in the next lesson.
While this course will not teach you how to use git, it is expected that you would check this project into a repository and push changes as you work through stages.
When the Sanity CLI created the apps/studio
directory it had git already initialized. But you'll want to version control all files in this monorepo from the root.
Without the following steps the apps/studio
directory would be a "git submodule" and this is a world of complexity and pain for which neither you or I have the appetite for.
.git
directory from the apps/studio
directory# from the "day-one" directoryrm -rf apps/studio/.git
git init
You should now link your local directory to a remote repository using the provider (GitHub, BitBucket, etc) of your choice.
In the following lessons this course assumes you'll also be a good developer citizen and work in branches, not just force-push all your work to main.
The foundation is set, let's add our second app to this monorepo in the following lesson.