This starter uses Remix for the frontend and Sanity to handle its content.
- How to fetch content as data from the Sanity Content Lake
- How to render block content with Portable Text
- A Sanity Studio to create and edit content
- How to crop and render images with Sanity Image URLs
Note
This starter features an
/appand a/studiofolder. The/appfolder contains the frontend code, and the/studiofolder contains the Sanity Studio code.This is not a monorepo setup. We put them both in one repository for the sake of simplicity. You might want to have separate repositories for each of the folders, to make it easier to deploy the app and the studio separately.
- Node.js (v14.18 or later)
- Sanity CLI (optional)
The following commands are meant to be run in both the /app and /studio folders.
npm installto install dependenciesnpm create sanity@latest init --env, this will:
- ask you to select or create a Sanity project and dataset
- output a
.envfile with appropriate variables - (or use
sanity init --envif you have the CLI installed)
npm run devto start the development server
Your Remix app should now be running on http://localhost:3000/ and Studio on http://localhost:3333/.
Feel free to move each of the folders to their own location and check them into version control.
- Visit the Studio and create and publish a new
Postdocument - Visit the App and refresh the page to see your content rendered on the page
The schema for the Post document is defined in the /studio/schemas folder. You can add more documents and schemas to the Studio to suit your needs.
If you do not wish to use TypeScript, we've included a remove-typescript.mjs file in the root of this repository.
To run this file, you must:
- Run
npm installin the repository root to install dependencies - Run
node remove-typescript.mjsto strip all types from both the/appand/studiofolders
If you intend to use TypeScript or have stripped TypeScript, you can safely delete all files in the repository root that isn't /studio or /app.
The /app and /studio folders are meant to be deployed separately.
Feel free to deploy the App to whichever hosting provider you prefer. We recommend Vercel.
You can deploy the Sanity Studio by running sanity deploy in the /studio repository, provided you have the @sanity/cli installed globally.