This starter uses SvelteKit 2 for the frontend and Sanity to handle its content.
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.
The following commands are meant to be run in both the /app and /studio folders.
npm install to install dependenciesnpx -y sanity@latest init --env, this will:.env file with appropriate variablessanity init --env if you have the CLI installed)/app folder with PUBLIC_, they should be PUBLIC_SANITY_DATASET and PUBLIC_SANITY_PROJECT_ID.npm run dev to start the development serverYour 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.
VirtualTourPageBlocks and VirtualTourItem documentThe schema for the VirtualTourPageBlocks and VirtualTourItem document are defined in the /studio/schemas folder. You can add more documents and schemas to the Studio to suit your needs.
The Virtual Tour is controlled by the file app/src/lib/Virtual.svelte which uses the Manual mode using textureX/textureY coordinate system. This can be changed to yaw/pitch or GPS mode using the guide on the Official Plugin Website
The nodes are configured in Client Mode. The Virtual Tour by itself in the new Viewer({ ... }) can be configured with more options using Standard Configurations and Advanced Configuration Options. This will be helpful in customizing the viewer's page.
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:
npm install in the repository root to install dependenciesnode remove-typescript.mjs to strip all types from both the /app and /studio foldersIf 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.
You can deploy the Sanity Studio by running sanity deploy in the /studio repository, provided you have the @sanity/cli installed globally.