How apps work
Your app runs on separate servers, not on Ghost’s. Ghost shows it inside Admin and lets it work with your site, but it never runs your app’s code on its own servers. That helps keep your data safe, whatever apps you use.
What your app’s backend does
- Only answers Ghost’s challenge. Many apps only need a page that talks to Ghost, like a calendar, a tag tidier, or a dashboard. Everything they need comes from Ghost. Their backend does one thing: It proves to Ghost that the app is yours (see App identity). Ghost’s examples include it.
- Also stores data or runs other tasks. Some apps need to keep their own data, connect to another service like Typeform or LinkedIn, or do work on a schedule. They need a server of their own. You run it, not Ghost. See Apps with their own server.
How your app talks to Ghost
Your app’s page talks to Ghost Admin through the app SDK, a small library in your page. Ghost’s examples already include it.
Your app also serves a manifest, a JSON file that tells Ghost its name, description, icon, who made it, where it wants to appear, and the scopes it needs. Ghost reads it when you install the app, and again each time you open it.
How Ghost knows it’s your app
Your app signs its manifest with an identity key that only you hold, and Ghost remembers that key when a site installs the app. Your app’s backend proves it holds a second key, the backend key, by answering a challenge from Ghost. So every deployed app has a backend, even one that only serves a page. App identity explains both keys, and what happens when one changes.
What your app learns
When your app opens, Ghost tells it:
- The site’s address, title, timezone, and language
- The person using it, by ID and role
- Whether Admin is in light or dark mode
- Which screen of your app to show
What your app can do
- Read and change content: Posts, pages, and tags. It can also read staff users, tiers, newsletters, and the site’s logo, icon, and other public details. It declares which of these it needs in its manifest (see Access).
- Send people elsewhere in Ghost: Open a post, a page, a member, or the list of apps.
- Move between its own screens: Ghost keeps the address bar in sync, so back and forward, bookmarks, and shared links all work.
- Follow light and dark mode as people switch.
What’s off limits
To help keep publishers’ data safe while apps are new, Ghost keeps these off limits:
- Changing code injection
- Reaching members, settings, or anything that creates API keys
See What apps can reach for the full list.
What limits your app’s requests
Each request from your app’s page has to pass two checks:
- The approved scopes: Your app declares the scopes it needs in its manifest. An Administrator approves them when they install the app, and again when a new version asks for more.
- The role of the person using it: Your app’s page acts as the person who has it open, and Ghost records its changes under their name. It never does more than they could do in Ghost themselves.
Only the site’s Owner and Administrators can open apps for now, and their role allows everything the scopes cover, so in practice the approved scopes decide what your app can do.
Ghost refuses a request that needs a scope the site didn’t approve. Your app can always read the site’s public details, such as its title and logo. While apps are in beta, apps can make only the calls listed in Which scope a call needs.
When someone opens your app, Ghost issues a token for it: A credential that lets your app’s requests reach Ghost, limited to the approved scopes. Ghost Admin holds the token, makes your app’s fetch calls with it, and renews it while the app stays open, without reloading your page. Your code calls the SDK’s fetch and never sees the token. Ghost refuses its calls once the app is uninstalled, or the person signs out or is suspended. If the person stops being the Owner or an Administrator, the app closes the next time Ghost Admin renews its token, and until then their new role limits what it can do. Issuing these tokens requires Ghost’s new auth engine (see Get your site ready for apps).
Your app’s backend will get a token of its own. It carries every approved scope, with no person’s role to limit it, so your backend can keep working when nobody has the app open, for things like scheduled tasks. These tokens are coming (see Where your app uses its scopes).
Older Ghost sites
If a site’s Ghost version doesn’t support something your app asks for, Ghost returns an unsupported error instead of doing something unexpected. Your app can then work around it.