Git Product home page Git Product logo

jdr's Introduction

A minimal SvelteKit site with Sanity Studio

This starter uses SvelteKit for the frontend and Sanity to handle its content.

Featuring

Note

This starter features an /app and a /studio folder. The /app folder contains the frontend code, and the /studio folder 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.

Prerequisities

Getting started

The following commands are meant to be run in both the /app and /studio folders.

  1. npm install to install dependencies
  2. npx -y sanity@latest init --env, this will:
  • ask you to select or create a Sanity project and dataset, use the same Sanity project and dataset in both folders.
  • output a .env file with appropriate variables
  • (or use sanity init --env if you have the CLI installed)
  1. Prefix your environment variables in the SvelteKit /app folder with PUBLIC_, they should be PUBLIC_SANITY_DATASET and PUBLIC_SANITY_PROJECT_ID.
  2. npm run dev to start the development server

Your SvelteKit app should now be running on http://localhost:5173/ and Studio on http://localhost:3333/.

Feel free to move each of the folders to their own location and check them into version control.

Add content

  1. Visit the Studio and create and publish a new Post document
  2. 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.

Removing TypeScript

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:

  1. Run npm install in the repository root to install dependencies
  2. Run node remove-typescript.mjs to strip all types from both the /app and /studio folders

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.

Deployments

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.

jdr's People

Contributors

djuskus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.