├── public
└── .gitkeep
├── studio
├── plugins
│ └── .gitkeep
├── config
│ ├── @sanity
│ │ ├── data-aspects.json
│ │ ├── form-builder.json
│ │ ├── default-layout.json
│ │ └── default-login.json
│ └── .checksums
├── static
│ ├── .gitkeep
│ └── favicon.ico
├── tsconfig.json
├── README.md
├── sanity.json
├── schemas
│ └── schema.js
└── package.json
├── renovate.json
├── .gitignore
├── lerna.json
├── pages
└── index.jsx
├── vercel.json
├── package.json
└── README.md
/public/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/studio/plugins/.gitkeep:
--------------------------------------------------------------------------------
1 | User-specific packages can be placed here
2 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "config:base"
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/studio/config/@sanity/data-aspects.json:
--------------------------------------------------------------------------------
1 | {
2 | "listOptions": {}
3 | }
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .vercel
2 | .next
3 | public/studio
4 | studio/dist
5 | node_modules
6 |
--------------------------------------------------------------------------------
/lerna.json:
--------------------------------------------------------------------------------
1 | {
2 | "packages": [
3 | "studio"
4 | ],
5 | "version": "0.0.0"
6 | }
7 |
--------------------------------------------------------------------------------
/pages/index.jsx:
--------------------------------------------------------------------------------
1 | export default function HomePage() {
2 | return
Welcome to Next.js!
3 | }
4 |
--------------------------------------------------------------------------------
/studio/config/@sanity/form-builder.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": {
3 | "directUploads": true
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/studio/static/.gitkeep:
--------------------------------------------------------------------------------
1 | Files placed here will be served by the Sanity server under the `/static`-prefix
2 |
--------------------------------------------------------------------------------
/vercel.json:
--------------------------------------------------------------------------------
1 | {
2 | "rewrites": [{ "source": "/studio/(.*)", "destination": "/studio/index.html" }]
3 | }
4 |
--------------------------------------------------------------------------------
/studio/config/@sanity/default-layout.json:
--------------------------------------------------------------------------------
1 | {
2 | "toolSwitcher": {
3 | "order": [],
4 | "hidden": []
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/studio/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sanity-io/sanity-nextjs-vercel-example/HEAD/studio/static/favicon.ico
--------------------------------------------------------------------------------
/studio/config/@sanity/default-login.json:
--------------------------------------------------------------------------------
1 | {
2 | "providers": {
3 | "mode": "append",
4 | "redirectOnSingle": false,
5 | "entries": []
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/studio/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | // Note: This config is only used to help editors like VS Code understand/resolve
3 | // parts, the actual transpilation is done by babel. Any compiler configuration in
4 | // here will be ignored.
5 | "include": ["./node_modules/@sanity/base/types/**/*.ts", "./**/*.ts", "./**/*.tsx"]
6 | }
7 |
--------------------------------------------------------------------------------
/studio/config/.checksums:
--------------------------------------------------------------------------------
1 | {
2 | "#": "Used by Sanity to keep track of configuration file checksums, do not delete or modify!",
3 | "@sanity/default-layout": "bb034f391ba508a6ca8cd971967cbedeb131c4d19b17b28a0895f32db5d568ea",
4 | "@sanity/default-login": "6fb6d3800aa71346e1b84d95bbcaa287879456f2922372bb0294e30b968cd37f",
5 | "@sanity/form-builder": "b38478227ba5e22c91981da4b53436df22e48ff25238a55a973ed620be5068aa",
6 | "@sanity/data-aspects": "d199e2c199b3e26cd28b68dc84d7fc01c9186bf5089580f2e2446994d36b3cb6"
7 | }
8 |
--------------------------------------------------------------------------------
/studio/README.md:
--------------------------------------------------------------------------------
1 | # Sanity Clean Content Studio
2 |
3 | Congratulations, you have now installed the Sanity Content Studio, an open source real-time content editing environment connected to the Sanity backend.
4 |
5 | Now you can do the following things:
6 |
7 | - [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
8 | - [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
9 | - [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
10 |
--------------------------------------------------------------------------------
/studio/sanity.json:
--------------------------------------------------------------------------------
1 | {
2 | "root": true,
3 | "project": {
4 | "name": "Sanity Studio",
5 | "basePath": "/studio"
6 | },
7 | "api": {
8 | "projectId": "PLACEHOLDER-SEE-README",
9 | "dataset": "PLACEHOLDER-SEE-README"
10 | },
11 | "plugins": [
12 | "@sanity/base",
13 | "@sanity/components",
14 | "@sanity/default-layout",
15 | "@sanity/default-login",
16 | "@sanity/desk-tool"
17 | ],
18 | "env": {
19 | "development": {
20 | "plugins": [
21 | "@sanity/vision"
22 | ]
23 | }
24 | },
25 | "parts": [
26 | {
27 | "name": "part:@sanity/base/schema",
28 | "path": "./schemas/schema"
29 | }
30 | ]
31 | }
32 |
--------------------------------------------------------------------------------
/studio/schemas/schema.js:
--------------------------------------------------------------------------------
1 | // First, we must import the schema creator
2 | import createSchema from 'part:@sanity/base/schema-creator'
3 |
4 | // Then import schema types from any plugins that might expose them
5 | import schemaTypes from 'all:part:@sanity/base/schema-type'
6 |
7 | // Then we give our schema to the builder and provide the result to Sanity
8 | export default createSchema({
9 | // We name our schema
10 | name: 'default',
11 | // Then proceed to concatenate our document type
12 | // to the ones provided by any plugins that are installed
13 | types: schemaTypes.concat([
14 | {type: 'document', name: 'blogPost', fields: [{type: 'string', title: 'Title'}, {type: 'text', title: 'Body'}]}
15 | ])
16 | })
17 |
--------------------------------------------------------------------------------
/studio/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sanity-nextjs-example-studio",
3 | "private": true,
4 | "version": "1.0.0",
5 | "description": "",
6 | "main": "package.json",
7 | "author": "Bjørge Næss ",
8 | "license": "UNLICENSED",
9 | "scripts": {
10 | "start": "sanity start",
11 | "test": "sanity check"
12 | },
13 | "keywords": [
14 | "sanity"
15 | ],
16 | "dependencies": {
17 | "@sanity/base": "^2.0.6",
18 | "@sanity/components": "^2.0.6",
19 | "@sanity/core": "^2.0.5",
20 | "@sanity/default-layout": "^2.0.6",
21 | "@sanity/default-login": "^2.0.5",
22 | "@sanity/desk-tool": "^2.0.6",
23 | "@sanity/vision": "^2.0.5",
24 | "prop-types": "^15.6",
25 | "react": "^16.14.0",
26 | "react-dom": "^16.14.0"
27 | },
28 | "devDependencies": {}
29 | }
30 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sanity-nextjs-vercel-example",
3 | "version": "0.0.0",
4 | "private": true,
5 | "description": "A bare bones example of a Vercel-deployable project with a Next.js frontend and a Sanity Studio on /studio",
6 | "devDependencies": {
7 | "concurrently": "^5.3.0",
8 | "lerna": "^3.22.1"
9 | },
10 | "scripts": {
11 | "dev": "concurrently \"next --port $PORT\" \"cd studio && sanity start\"",
12 | "build": "echo 'Building Sanity to public/studio' && cd studio && sanity build ../public/studio -y && cd .. && next build",
13 | "start": "vercel dev",
14 | "postinstall": "lerna bootstrap"
15 | },
16 | "keywords": [],
17 | "author": "Sanity.io ",
18 | "license": "MIT",
19 | "dependencies": {
20 | "@sanity/cli": "^2.0.5",
21 | "next": "^9.5.5",
22 | "react": "^17.0.0",
23 | "react-dom": "^17.0.0"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Sanity + Next.js + Vercel example
2 |
3 | > A bare bones example of a Vercel-deployable project with a Next.js frontend and a Sanity Studio on /studio
4 |
5 | ## Getting started
6 |
7 | 1. Clone repo
8 | ```
9 | git clone https://github.com/sanity-io/sanity-nextjs-examle
10 | ```
11 | 1. Install dependencies
12 | ```
13 | npm install
14 | ```
15 | 1. Setup Sanity
16 | ```
17 | cd studio && sanity init
18 | ```
19 | This will prompt you if you want to reconfigure the project. Answer yes and follow instructions to create a new project.
20 | 1. Setup Vercel deployment
21 | ```
22 | vercel
23 | ```
24 | When asked about build settings, make sure to use `npm run dev` as the development command
25 |
26 | ## Notes
27 | In development (using `npm run dev`)
28 | - The Next.js application will run on https://localhost:3000
29 | - The Sanity Studio dev server will run on http://localhost:3333/studio
30 |
31 | In production (`using vercel`)
32 | - The Next.js application will be available on `https://`
33 | - The Sanity Studio will be accessible on `https:///studio`
34 |
--------------------------------------------------------------------------------