|
| 1 | +--- |
| 2 | +title: Setup |
| 3 | +description: Learn how to install and configure Nuxt Studio to edit your content in production with GitHub authentication. |
| 4 | +navigation: |
| 5 | + title: Setup |
| 6 | + icon: i-lucide-settings |
| 7 | +seo: |
| 8 | + title: Nuxt Studio Setup Guide |
| 9 | + description: Learn how to install and configure the self-hosted Nuxt Studio module for your Nuxt Content website. Edit content in production with GitHub authentication. |
| 10 | +--- |
| 11 | + |
| 12 | +::tip{to="https://nuxt.studio/docs/setup"} |
| 13 | +This documentation covers only the new open-source Nuxt Studio module. |
| 14 | +Click here to view the documentation for the legacy standalone platform. |
| 15 | +:: |
| 16 | + |
| 17 | +## Install |
| 18 | + |
| 19 | +Add the Nuxt Studio module to your project: |
| 20 | + |
| 21 | +::code-group |
| 22 | +```bash [pnpm] |
| 23 | +pnpm add nuxt-studio |
| 24 | +``` |
| 25 | + |
| 26 | +```bash [npm] |
| 27 | +npm install nuxt-studio |
| 28 | +``` |
| 29 | + |
| 30 | +```bash [yarn] |
| 31 | +yarn add nuxt-studio |
| 32 | +``` |
| 33 | + |
| 34 | +```bash [bun] |
| 35 | +bun add nuxt-studio |
| 36 | +``` |
| 37 | +:: |
| 38 | + |
| 39 | +Alternatively, use the Nuxt CLI to automatically add the module: |
| 40 | + |
| 41 | +```bash |
| 42 | +npx nuxi module add nuxt-studio |
| 43 | +``` |
| 44 | + |
| 45 | +## Configure |
| 46 | + |
| 47 | +Add the module to your `nuxt.config.ts` and configure your GitHub repository: |
| 48 | + |
| 49 | +```ts [nuxt.config.ts] |
| 50 | +export default defineNuxtConfig({ |
| 51 | + modules: [ |
| 52 | + '@nuxt/content', |
| 53 | + 'nuxt-studio' |
| 54 | + ], |
| 55 | + |
| 56 | + studio: { |
| 57 | + // Studio admin route (default: '/_studio') |
| 58 | + route: '/_studio', |
| 59 | + |
| 60 | + // GitHub repository configuration (required) |
| 61 | + repository: { |
| 62 | + provider: 'github', // only GitHub is currently supported |
| 63 | + owner: 'your-username', // your GitHub username or organization |
| 64 | + repo: 'your-repo', // your repository name |
| 65 | + branch: 'main', // the branch to commit to |
| 66 | + rootDir: '' // optional: if your Nuxt app is in a subdirectory |
| 67 | + } |
| 68 | + } |
| 69 | +}) |
| 70 | +``` |
| 71 | + |
| 72 | +::prose-tip |
| 73 | +If your Nuxt Content application is in a monorepo or subdirectory, specify the `rootDir` option to point to the correct location. |
| 74 | +:: |
| 75 | + |
| 76 | +## Create GitHub OAuth App |
| 77 | + |
| 78 | +Nuxt Studio uses GitHub OAuth for authentication. |
| 79 | + |
| 80 | +::prose-steps |
| 81 | +> If you changed the `route` option in your config, update the callback URL accordingly (the route set instead of `/studio`) |
| 82 | +
|
| 83 | +### Navigate to GitHub Developer Settings |
| 84 | + |
| 85 | +Go to [GitHub Developer Settings](https://github.com/settings/developers) and click **New OAuth App** |
| 86 | + |
| 87 | +### Configure the OAuth Application |
| 88 | + |
| 89 | +Fill in the required fields: |
| 90 | + |
| 91 | +- **Application name**: Your app name |
| 92 | +- **Homepage URL**: Your production website homepage URL |
| 93 | +- **Authorization callback URL**: `https://yourdomain.com/_studio/auth/github`:tip [If you want to try studio on project running in local, you can simply set the callback url to your local url `http://localhost:3000`.] |
| 94 | + |
| 95 | +### Copy Your Credentials |
| 96 | + |
| 97 | +After creating the OAuth app, you'll receive: |
| 98 | + |
| 99 | +- A **Client ID** (visible immediately) |
| 100 | +- A **Client Secret** (click **Generate a new client secret**) |
| 101 | + |
| 102 | +### Set your environment Variables |
| 103 | + |
| 104 | +Add the GitHub OAuth credentials to your deployment platform's environment variables or in your `.env` file in local |
| 105 | + |
| 106 | +```bash [.env] |
| 107 | +STUDIO_GITHUB_CLIENT_ID=your_github_client_id |
| 108 | +STUDIO_GITHUB_CLIENT_SECRET=your_github_client_secret |
| 109 | +``` |
| 110 | +:: |
| 111 | + |
| 112 | +## Deployment |
| 113 | + |
| 114 | +::warning |
| 115 | +The new Nuxt Studio module requires a server-side route for authentication. |
| 116 | +While static generation remains supported with [Nuxt hybrid rendering](https://nuxt.com/docs/4.x/guide/concepts/rendering#route-rules), your site must be **deployed on a platform that supports server-side rendering (SSR)**. |
| 117 | +:: |
| 118 | + |
| 119 | +### Accessing Studio |
| 120 | + |
| 121 | +After deployment, access the Studio interface by navigating to your configured route (default: `/_studio`): |
| 122 | + |
| 123 | +1. Click **Login with GitHub** if it does not directly redirect to the OAuth app authorization page |
| 124 | +2. Authorize the OAuth application |
| 125 | +3. You'll be redirected back to Studio, ready to edit your content |
| 126 | + |
| 127 | +::prose-note |
| 128 | +Secure OAuth-based login with **Google** should be available quickly in the Beta release. |
| 129 | +:: |
| 130 | + |
| 131 | +## Development mode |
| 132 | + |
| 133 | +Nuxt Studio includes an **experimental** development mode that enables real-time file system synchronization: |
| 134 | + |
| 135 | +```ts [nuxt.config.ts] |
| 136 | +export default defineNuxtConfig({ |
| 137 | + studio: { |
| 138 | + development: { |
| 139 | + sync: true // Enable development mode |
| 140 | + } |
| 141 | + } |
| 142 | +}) |
| 143 | +``` |
| 144 | + |
| 145 | +When enabled, Nuxt Studio will: |
| 146 | + |
| 147 | +- ✅ Write changes directly to your local `content/` directory |
| 148 | +- ✅ Write media changes to your local `public/` directory |
| 149 | +- ❌ Listen for file system changes and update the editor |
| 150 | +- ❌ Commit changes to your repository (use your classical workflow instead) |
0 commit comments