Start a new Studio site
Use this page when you don't have an app yet. It takes you from an empty folder to a template deployed on your site, and each step links to the page that explains it. If you already have an app, start at Set up Studio instead.
The example is the Blog project. Its site runs at http://localhost:3106, and the Blog post template shows the post AI 101 at /blog/ai-101.
Prerequisites
- Node.js 18 or later.
- A stack ready for Studio: an environment, a language and a delivery token. See Prerequisites.
What this is and what you get
Choose how your template pages render before you start, because it decides how they fetch the layout. Server rendering is the default. See CSR or SSR.
| Server rendering (default) | Client rendering | |
|---|---|---|
| Start from | An empty Next.js app | The example site, or an empty Next.js app |
| Where the layout is fetched | On the server. See Render on the server. | In the browser. See Render on the client. |
Either way, you end with a section on the canvas, a template on its own address, and one deploy on your live site.
Start with server rendering
Create the app
-
Create a Next.js app with the App Router and TypeScript:
npx create-next-app@latest blog-site --typescript --appcd blog-siteKeep the default answers to the other questions.
-
Run it on the port your environment's URL uses:
npm run dev -- -p 3106Your app answers at
http://localhost:3106. This step shows only the Next.js start page.
Set up Studio in it
Follow these pages in order. Each one names the file it changes.
| Step | Page | In your new app |
|---|---|---|
| 1 | Create a project | The Blog project and its Compositions content type |
| 2 | Configure your project | Environment local with the URL http://localhost:3106, English, and Canvas URL /canvas |
| 3 | CSR or SSR | Server rendering |
| 4 | Install the Delivery SDK | The stack your app fetches content with |
| 5 | Install Live Preview | Live Preview on that stack |
| 6 | Install the Studio SDK | studioSdk.init, loaded from app/layout.tsx |
| 7 | Mount the section preview route | app/canvas/page.tsx with <StudioCanvas /> |
| 8 | Wire template preview routes | app/[[...slug]]/page.tsx with <StudioComponent /> |
| 9 | Render on the server | Fetch the layout in the route, on the server |
Then check it, as in Check that it works.
Start with client rendering
Start from the example site
The Blog example site is a small Vite app that renders on the client. It already has the canvas at /canvas, the Blog post template at /blog/{{entry.slug}}, and the example's components registered. It needs a stack with the Blog example's content.
- Create the Blog project and configure it, as in Create a project and Configure your project.
- Download and run the example site, as in Run the example site.
- Make it yours: replace the components in
src/componentsandsrc/register.tsxwith your own. See Register a component.
Or create an empty app
- Create the app and run it on port 3106, as in Create the app.
- Follow the server-rendering steps in Set up Studio in it, with two changes:
- In step 3, choose client rendering.
- In step 9, use Render on the client instead of Render on the server.
Check that it works
Run your app, then check each of these. Verify your setup end to end walks through them.
- A section opens on the canvas, served by your
/canvasroute. - The Blog post template opens at
/blog/ai-101, served by your template route. - An address no template matches, such as
/blog/no-such-post, answers 404. See Send a 404 when no template matches. - After Deploy, the template shows on your site in the environment you deployed to.
Without an app
Studio's Playground canvas lets you build templates before your app exists, but sections, Enable Freeform Feature and Deploy need your site. See Try Studio without an app.