Skip to main content

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 fromAn empty Next.js appThe example site, or an empty Next.js app
Where the layout is fetchedOn 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​

  1. Create a Next.js app with the App Router and TypeScript:

    npx create-next-app@latest blog-site --typescript --app
    cd blog-site

    Keep the default answers to the other questions.

  2. Run it on the port your environment's URL uses:

    npm run dev -- -p 3106

    Your 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.

StepPageIn your new app
1Create a projectThe Blog project and its Compositions content type
2Configure your projectEnvironment local with the URL http://localhost:3106, English, and Canvas URL /canvas
3CSR or SSRServer rendering
4Install the Delivery SDKThe stack your app fetches content with
5Install Live PreviewLive Preview on that stack
6Install the Studio SDKstudioSdk.init, loaded from app/layout.tsx
7Mount the section preview routeapp/canvas/page.tsx with <StudioCanvas />
8Wire template preview routesapp/[[...slug]]/page.tsx with <StudioComponent />
9Render on the serverFetch 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.

  1. Create the Blog project and configure it, as in Create a project and Configure your project.
  2. Download and run the example site, as in Run the example site.
  3. Make it yours: replace the components in src/components and src/register.tsx with your own. See Register a component.

Or create an empty app​

  1. Create the app and run it on port 3106, as in Create the app.
  2. 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 /canvas route.
  • 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.

Report a problem with this page