---
name: ghost-apps-setup
description: Gets a computer ready to build Ghost apps, once. Use when someone asks to set up for building Ghost apps.
---

# Set up to build Ghost apps

Ghost apps run on the builder's own hosting and show up inside Ghost Admin. These instructions get this computer ready once: Tools, and a connection to their Ghost site. They don't set up hosting. Apps run on this computer while they're being built, and hosting comes later, when the person wants an app to work while this computer is off ([Deployment](https://tryghost.github.io/Apps/deployment.md)). The person may be new to these tools. Explain each step in plain words, and never assume they know terms like Worker, tunnel, manifest, or auth engine.

The rest of Ghost's docs for building apps are indexed at <https://tryghost.github.io/Apps/llms.txt>.

## Before you start

Show the person this plan and wait for their OK:

1. Check the tools and skills on this computer, and install what's missing.
2. Pick the Ghost site to build on, and check it's ready for apps.
3. Run the Hello world example on this computer, in its own Git repository, install it on that site, and check it, to prove it all works. They may need to sign in to Ghost along the way.
4. Optionally, connect GitHub so their apps can be saved there.

## Step 1: Tools

- Check for Node.js 22 or later, pnpm 12.7 or later, and Git. Run `pnpm --version` from the home folder.
- If something's missing or too old, say what it is and why it's needed, and ask before installing it.
- On Windows, work inside WSL. Stop until they've opened the project there.
- Check `git config --global user.name` and `git config --global user.email`. If either is empty, ask the person for it and set it with `git config --global`.
- Install the skills, once for this computer. `build-ghost-app` teaches you how to build and check an app. Shade is the design system Ghost Admin is built with, and its skills teach you to build app screens that look and behave like the rest of Ghost Admin.

Explain this in plain words and ask before installing:
`npx skills@1.7.4 add TryGhost/Ghost/clients/shade/skills --skill '*' -g`
`npx skills@1.7.4 add TryGhost/Apps/skills --skill build-ghost-app -g`

Check that `build-ghost-app-ui` and `build-ghost-app` are among the installed skills.

## Step 2: Their Ghost site

Apps open on a site that runs Ghost's `better-auth` auth engine, which needs MySQL, with Apps on when Ghost started, and on Ghost 6.80 or later ([Get your site ready for apps](https://tryghost.github.io/Apps/getting-started.md#get-your-site-ready-for-apps)). While apps are in private beta, they're for developers who run Ghost themselves. Ask where their Ghost site runs:

- **On this computer, from Ghost's repository:** Ask them to stop Ghost, bring the repository up to date with `git pull` on its `main` branch, and start Ghost again from its folder with `auth__engine=better-auth labs__apps=true pnpm dev`.
- **Nowhere yet, or on this computer with Ghost-CLI's `ghost install local`:** Offer to set up Ghost's repository on this computer, following [Ghost's Quick Start](https://github.com/TryGhost/Ghost/blob/main/docs/README.md#quick-start) and asking before installing anything. Clone the public repository over HTTPS, which needs no GitHub account: `git clone --recurse-submodules https://github.com/TryGhost/Ghost.git`. Stop after Quick Start's install step, `pnpm bootstrap`, and leave out its `pnpm dev`. Start Ghost only with the command above, from its folder. Its development setup brings the MySQL the new engine needs. A Ghost-CLI local install uses SQLite, where Ghost stays on the `legacy` engine and apps never open.
- **A site they host on a server:** It needs Ghost 6.80 or later on MySQL. They update Ghost if needed, such as with `ghost update`, add `"auth": {"engine": "better-auth"}` and `"labs": {"apps": true}` to Ghost's config file, and restart Ghost.
- **A site someone else hosts:** Explain that apps are open only to developers who run Ghost themselves for now, and offer Ghost on this computer as above.

Explain that Ghost asks them to sign in again, once, after the switch to the new engine.

Done when they see **Apps** at `<their site's address>/ghost/#/apps` while signed in. Ghost on this computer is usually at `http://localhost:2368`, and a new one asks them to create the site's owner account first. Handle sign-ins as in Step 3. If they don't see **Apps**, check that Apps is on and they're the Owner or an Administrator, and stop until fixed.

## Step 3: Prove it works

1. Copy the [Hello world example](https://github.com/TryGhost/Apps/tree/main/examples/hello-world) into a new folder with `npx degit TryGhost/Apps/examples/hello-world <folder>`, and give it its own App ID and name in `ghost-app.json`. Keep its `scopes` as they are: `post:browse`, for the posts it lists.
2. Make the folder a Git repository (`git init`), check `.gitignore` lists `.ghost-app/` and `.dev.vars`, and commit the starting point, with a short message in plain words such as "Started hello world". Explain that this keeps a history of the app, so they can get back to any working version, and that the app's keys stay out of it ([App identity](https://tryghost.github.io/Apps/app-identity.md) explains them).
3. Run `pnpm install --allow-build=esbuild --allow-build=workerd`.
4. Start the app for the site from Step 2. It prints the manifest's address and install link:
   - **Ghost on this computer:** Run `pnpm dev`. If Ghost's address isn't `http://localhost:2368`, run `GHOST_URL=<Ghost's address> pnpm dev`.
   - **A hosted site:** Open a tunnel with `npx cloudflared tunnel --url http://localhost:8787`. Explain that its address works only while it's running and changes each time. Run `GHOST_URL=<their site's address> GHOST_APP_TUNNEL_URL=https://….trycloudflare.com pnpm dev` with the tunnel's address.
5. Check it yourself with whatever you have (a built-in browser, a browser extension, or computer control), with its tab in front. Open the link. If Ghost asks for a sign-in, ask the person to sign in in that browser, tell them where to find it, and leave the password to them. When they've signed in, reopen the link in a new tab before drawing conclusions. Click **Install**, tell them what the screen showed, including the access it asked for, and open the app under **Apps**. Give them the link too, and say what you checked.
6. With no browser tool, say so plainly, give them the link, and ask them to open it, click **Install**, and tell you what they see.
7. Done when the app opens under **Apps** and greets their site by name.

If it fails, check the common causes before anything else:

- "404 Page not found" at the install link: Apps aren't turned on for the site. Go back to Step 2.
- The app installs, but Ghost Admin says apps need Ghost's new auth engine: The site runs the `legacy` auth engine. Switch it to `better-auth` as Step 2 says for their kind of site, which restarts Ghost, then open the app under **Apps** again. A Ghost-CLI local install, or a site someone else hosts, can't switch: Set up Ghost's repository as Step 2 offers, and install the app on that Ghost from step 4.
- The app installs, but Ghost Admin says apps open once Ghost restarts: Apps was turned on while Ghost was running. Ask them to restart Ghost, then open the app under **Apps** again.
- Ghost shows a manifest error: Fix the field it names in `ghost-app.json`. If it's `scopes`, check it against [Access](https://tryghost.github.io/Apps/access.md#declare-scopes).
- Ghost can't confirm the app comes from its developer: Match what Ghost Admin says against [Troubleshooting](https://tryghost.github.io/Apps/troubleshooting.md#ghost-cant-confirm-the-app-comes-from-you). With a tunnel, it's usually `GHOST_APP_TUNNEL_URL` missing or set to an old address.
- "Not responding": The app is probably sending headers that stop the page being shown inside Ghost (`X-Frame-Options`, or `frame-ancestors 'self'`).
- Unavailable: The app or the tunnel isn't running, or the address in the link is wrong.

## Rules

- Never ask for, print, or save passwords, API keys, or tokens in the chat or in files you commit. Sign-ins happen in the browser.
- Don't create a Ghost integration or Admin API key. Apps talk to Ghost through the app SDK, as the signed-in staff member, within the scopes their manifest declares.
- Don't change the site's settings.
- Don't set up hosting or create hosting accounts here. That's a separate step, covered in [Deployment](https://tryghost.github.io/Apps/deployment.md).
- Don't reuse an App ID from an example in a real app. Each app needs its own.
- Every app gets its own Git repository from the start. Commit as you go: After each change that works, with a short message in plain words that says what changed. Don't wait to be asked, and don't bundle unrelated changes into one commit.
- Never commit secrets. The app's keys live in `.ghost-app/` and `.dev.vars`, and keys for the app's server in the host's secret settings. Check `.gitignore` leaves them out before the first commit, and never print them.
- Don't push anywhere without asking. Pushing to GitHub is recommended but optional (see below).
- When building or changing an app's screens, use the `build-ghost-app-ui` skill. Don't style the app from scratch.

## After setup

Recommend keeping a copy of their apps on GitHub, as a backup and so hosts can deploy apps from it. If they'd like that, check for the GitHub command line tool (`gh`), ask before installing it, and sign them in with `gh auth login`, which happens in the browser. Offer to push Hello world to a new private repository with `gh repo create … --private --source=. --push`. If they'd rather not, carry on: The local repository is enough.

Tell them what to try next, for example: "Build a Ghost app that shows my scheduled posts on a calendar". Point them to [Getting started](https://tryghost.github.io/Apps/getting-started.md) if they'd like to read more, and to [Deployment](https://tryghost.github.io/Apps/deployment.md) for when they want an app to work while their computer is off.
