• Stars
    star
    153
  • Rank 243,368 (Top 5 %)
  • Language
    TypeScript
  • Created about 2 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sanity Studio v3 embedded into a Remix Vite application configured for Vercel hosting with visual editing

Sanity Studio v3 + Remix v2 Template

Batteries-included website template for a content-editable, live-preview enabled Remix website powered by Sanity Studio.

home Page of a Remix website

Sanity Docs | Remix Docs

Installation

From the command line, install this project as a Remix template:

npx create-remix@latest --template SimeonGriggs/sanity-remix-template

After setup, npx sanity@latest init --env will run to populate your .env file with the details of a new or existing Sanity Project's ID and dataset name'.

npm run dev

Now open the Studio at localhost:3000/studio and start authoring content!

Sanity Studio v3

Includes

Useful Sanity examples with a light sprinkling of opinionated patterns

Embedded Studio

Access to Sanity Studio v3 from within the Remix application itself. Now the whole Studio is a component, it lives at the /studio route.

Live preview

Powered by @sanity/preview-kit

Requires a token with viewer permissions in .env, so that live preview links can be shared with guests. Uses an auto-generated, short-lived secret in the dataset to authenticate users to use the token in their session.

Pre-configured Studio

The Studio has been pre-configured with a basic "Record Collection" schema, as well as a basic Desk Structure to include live preview within a view pane.

Portable Text component

Powered by @portabletext/react

This component allows for the customisation and extension of how Portable Text is rendered within your app. The Rich Text field in Sanity is an array of objects. Content as data!

Image URL builder

Powered by @sanity/image-url

The <RecordCover /> component has an example of how to generate a full Sanity CDN asset URL based on just the asset's ID. This is useful as we do not need to resolve the full image document in the query.

Example decorated input

Powered by @sanity/ui

Creating "decorated" inputs has never been easier than in Sanity Studio v3. ./app/sanity/components/Duration.tsx is a 13-line example where a number field type to store duration as seconds can also be visualised in minutes. Minimal developer effort, maximum author impact.

Sanity Client mutation

Powered by @sanity/client

Requires a token with editor permissions in .env. Clicking the like/dislike buttons on a Record's page will trigger a Remix action which will send a mutation to the document. This is an example of how user actions on the site may trigger changes on your Sanity dataset.

Typed and validated responses

Powered by Zod

The results of the Sanity query in ./app/routes/$slug.tsx are parsed with a Zod validator. This ensures that content is always returned in the expected shape at run time, and auto-generates Types which are fed from the loader into useLoaderData().

Dynamic OG Image

The record type generates dynamic open graph images using the ~/routes/resource.og resource route.

Other development choices

  • eslint and Prettier
  • Tailwind CSS with presets by @sanity/demo
  • Tailwind Prose and Prettier plugins

Sanity Studio

Visit https://localhost:3000/studio in your Remix app. You will need to:

  1. Rename .env.template to .env
  2. Set the correct Project ID, Dataset Name and preferred API Version from a project in your Sanity Manage
  3. Add http://localhost:3000 to the CORS settings on that project, with Allow Credentials privileges

Deployment

First, build your app for production:

npm run build

Then run the app in production mode:

npm start

Now you'll need to pick a host to deploy it to.

DIY

If you're familiar with deploying node applications, the built-in Remix app server is production-ready.

Make sure to deploy the output of remix build

  • build/
  • public/build/

Using a Template

When you ran npx create-remix@latest there were a few choices for hosting. You can run that again to create a new project, then copy over your app/ folder to the new project that's pre-configured for your target server.

cd ..
# create a new project, and pick a pre-configured host
npx create-remix@latest
cd my-new-remix-app
# remove the new project's app (not the old one!)
rm -rf app
# copy your app over
cp -R ../my-old-remix-app/app app

More Repositories

1

tints.dev

10-color Palette Generator and API for Tailwind CSS
TypeScript
865
star
2

sanity-nextjs-preview

Sanity Studio Visual Editing examples for Next.js 14 App + Pages routers
TypeScript
82
star
3

simeonGriggs

Blog with content by Sanity.io and Frontend in Remix.run
TypeScript
37
star
4

sanity-remix-preview

Query and live preview of Sanity.io data from within a Remix website
TypeScript
35
star
5

sanity-react-table

Exploration of a bulk-editing interface for Sanity
JavaScript
27
star
6

sanity-schema-generator

UI for generating Sanity.io field schema
JavaScript
25
star
7

sanity-plugin-utils

Handy hooks and clever components for Sanity Studio v3
TypeScript
24
star
8

sanity-backup-s3

Automated backups from Sanity to AWS S3
JavaScript
21
star
9

sanity-quick-fields

Helper function for simply generating Sanity.io schema fields
JavaScript
17
star
10

sanity-studio-v3-typed-code-examples

Sanity Studio v3: Typed Code Examples
TypeScript
15
star
11

sanity-plugin-availability

Studio v3 exclusive Schema and Custom Input to indicate and rapidly author availability data
TypeScript
14
star
12

sanity-page-builder-for-gatsby

This is an outdated Gatsby and Sanity demo and should not be used.
JavaScript
12
star
13

sanity-plugin-schema-visualizer

Visualize the schema registered to your Sanity Studio
TypeScript
11
star
14

tailwindcss-fraction-widths

Helper for generating fraction classes given a number of columns
TypeScript
9
star
15

showcase-seo-pane

TypeScript
7
star
16

sanity-plugin-user-select-input

Select a User ID from the Project's User Store
JavaScript
6
star
17

superrooster

Super Rooster Website
JavaScript
6
star
18

sanity-plugin-vimeo

Creates a uneditable schema of documents populated by the Vimeo API
JavaScript
5
star
19

sanity-plugin-tasks

Task assignment and management for Sanity documents
TypeScript
5
star
20

showcase-document-internationalization-app

A basic example of creating internationalized documents in Sanity and querying for it with the Next.js 13 app router
TypeScript
5
star
21

tailwindcss-coolhue

Coolhue gradients right in your Tailwind
JavaScript
4
star
22

recipes-sanity-nextjs

Recipes
JavaScript
4
star
23

tailwindcss-react-grid-overlay

A quick Tailwind CSS-based overlay for column grids.
JavaScript
4
star
24

groq-query-builder

Proof of Concept UI for building GROQ Queries from Registered Schema
JavaScript
4
star
25

array-object-select

Custom Sanity Studio v2 UI-based Input Component for faster CRUD on massive Arrays of Objects.
JavaScript
3
star
26

showcase-pagination-remix

Cursor-based pagination with GROQ in Remix
TypeScript
3
star
27

sanity-gatsby-lighthouse-images

Sanity Gatsby Lighthouse Images
JavaScript
3
star
28

sanity-remix-i18next

Exploration of connecting Internationalized Sanity content into a Remix site with i18next
TypeScript
3
star
29

sanity-wordpress-import

An example set of CLI scripts to import tags, categories, users and posts from WordPress into a Sanity Studio
TypeScript
3
star
30

tailwindcss-border-xy

Shorthand for border classes on the X and Y axis
JavaScript
3
star
31

sanity-opinionated-studio

An opinionated starter for Sanity Studio
JavaScript
3
star
32

sanity-plugin-advanced-array

An example implementation for adding copy/paste, multi-select, and inline editing to array fields in Sanity Studio.
TypeScript
3
star
33

create-op-studio

CLI tool for bootstrapping new a Sanity Project with the Sanity Opinionated Studio
JavaScript
2
star
34

gatsby-starter

Highly opinionated, lightly featured Gatbsy starter
JavaScript
2
star
35

workshop-remix-sanity-studio-v3

Example Remix app with embedded Sanity Studio v3 and a simple front-end
CSS
2
star
36

talk-localisation

Demo studio where Markets with unique languages share schema but not content
JavaScript
2
star
37

acf-svg-element-selector

ACF extension to save part of an SVG as a custom field
PHP
2
star
38

sanity-plugin-structure-schema

Create Sanity Desk Structure with a similar syntax to Schema
TypeScript
2
star
39

sanity-plugin-faker

Generate massive amounts of fake structured content
TypeScript
2
star
40

one-million-toggles

Remix website showing off the Sanity Live Content API
TypeScript
1
star
41

remix-live-content

Simple example of Sanity Live Content API on Remix
TypeScript
1
star
42

recipes-remix

I do not recommend that you follow this example
TypeScript
1
star
43

zustand-useContext

Code example of using Zustand + useContext to share and update State between Components.
JavaScript
1
star
44

demo-tasks

Proof of concept / Spike for Task assignment on Sanity.io documents
JavaScript
1
star
45

sanity-graphql-csm

Sanity, GraphQL, Perspectives, Content Source Maps and Overlays
TypeScript
1
star
46

remix-tailwind-typography

The missing starter template for Remix with Tailwind CSS and Typography configured, and absolutely nothing else.
TypeScript
1
star
47

sanity-plugin-tldraw

Draw pictures in your content
TypeScript
1
star
48

lightwork

Lightwork is an unabashedly opinionated stack for building content-editable websites
1
star
49

sanity-astro-example

Example Astro project I made for a tweet.
TypeScript
1
star