A Deep Dive into Ghost's Modern Tech Stack

Let's peek under the hood and explore the technology that makes Ghost tick. If you're considering Ghost for your publication or you're a developer curious about modern CMS architecture, this one's for you.

A Deep Dive into Ghost's Modern Tech Stack
A Deep Dive into Ghost's Modern Tech Stack

The Foundation: Node.js All the Way Down

Ghost is built entirely on Node.js, and this isn't just a trendy choice, it's a strategic one. Unlike WordPress's PHP heritage or newer headless CMSs that mix languages, Ghost maintains JavaScript consistency throughout the entire stack. This means:

  • Single language proficiency: Your team needs expertise in just one language
  • Shared code between server and client: Validation logic, utilities, and data models can be reused
  • Async performance benefits: Node's event-driven architecture handles concurrent requests beautifully
  • NPM ecosystem access: Tap into the world's largest package repository

Ghost 6.0 now runs on Node.js 22 LTS as part of the officially recommended production stack, embracing modern JavaScript features and performance optimizations. This is a significant jump from earlier versions that supported Node 18.

The Core Architecture

Express.js: The Reliable Workhorse

At its heart, Ghost uses Express.js as its web application framework. This might seem boring compared to flashier alternatives like Fastify or Koa, but it's a mature choice that prioritizes:

  • Battle-tested middleware ecosystem
  • Extensive documentation and community support
  • Predictable request/response patterns
  • Easy debugging and troubleshooting
// Ghost's approach to Express is clean and modular
app.use('/ghost/api', apiRouter);
app.use('/members', membersRouter);
app.use('/', frontendRouter);

Database Layer: SQL Done Right

Ghost uses MySQL 8 as the only supported database in production, with SQLite3 available for development. The database layer uses Knex.js as the query builder and Bookshelf.js as the ORM. This stack might surprise developers expecting PostgreSQL or MongoDB, but it makes sense.

Why MySQL 8?

  • MySQL 8 provides features that are optimal for Ghost installations, including the ability to store JSON, and features that help deliver performance improvements
  • ACID compliance for critical publishing data
  • Complex relational queries for content relationships
  • Proven scalability for publications with millions of posts
  • Easy backup and migration strategies

The Knex + Bookshelf Combo

// Clean migrations with Knex
exports.up = function(knex) {
    return knex.schema.createTable('posts', function(table) {
        table.increments('id').primary();
        table.string('title', 2000);
        table.text('content');
        table.timestamps(true, true);
    });
};

// Elegant models with Bookshelf
const Post = ghostBookshelf.model('Post', {
    tableName: 'posts',
    hasTimestamps: true,
    
    author() {
        return this.belongsTo('User', 'author_id');
    }
});

The Template Engine: Handlebars

Ghost themes use Handlebars templating, which might feel antiquated in our React/Vue world, but it's actually brilliant for content-focused sites:

  • Dead simple syntax: Content creators can understand it
  • Logic-less templates: Enforces separation of concerns
  • Built-in helpers: Ghost extends Handlebars with publishing-specific helpers
  • Performance: Server-side rendering without JavaScript overhead
{{#foreach posts}}
<article class="post-card">
    <h2>{{title}}</h2>
    {{#if feature_image}}
        <img src="{{img_url feature_image size="m"}}" alt="{{title}}">
    {{/if}}
    <p>{{excerpt words="30"}}</p>
    <time datetime="{{date format="YYYY-MM-DD"}}">
        {{date format="MMM DD, YYYY"}}
    </time>
</article>
{{/foreach}}

Ghost 6.0: The Social Web Revolution

In version 6.0, Ghost is introducing another new distribution channel: The social web. Now, millions of people can discover, follow, like, and reply to your posts from any supported social web client, including Bluesky, Mastodon, Threads, Flipboard, Ghost, WordPress, Surf, WriteFreely, and many more.

ActivityPub Integration

Ghost 6.0 features Fediverse social integration, using ActivityPub to connect Ghost with many other platforms and tools. This isn't just a bolt-on feature. It's deeply integrated into the platform's architecture, allowing your Ghost property to become a first-class citizen of the decentralized web.

Built-in Analytics with Tinybird

Ghost's built-in analytics, developed in partnership with Tinybird, make it simple to see in real time what works on each traffic channel. This real-time analytics system provides:

  • Traffic source breakdown
  • Content performance metrics
  • Member engagement tracking
  • Social web interaction monitoring

The Modern Content API

Ghost's Content API is a thing of beauty: a RESTful API that also supports:

JAMstack-Ready Architecture

Ghost can operate as a headless CMS, serving content via API to:

  • Next.js or Gatsby frontends
  • Native mobile applications
  • Custom React/Vue/Svelte applications
  • Static site generators
// Fetching content is straightforward
const api = new GhostContentAPI({
    url: 'https://your-site.com',
    key: 'your-content-api-key',
    version: 'v5'
});

const posts = await api.posts.browse({
    limit: 5,
    include: 'tags,authors',
    filter: 'featured:true'
});

GraphQL Support (via integrations)

While Ghost doesn't provide GraphQL out of the box, it integrates beautifully with:

  • Gatsby's GraphQL layer
  • Apollo Server implementations
  • Custom GraphQL resolvers

The Performance Story

Built-in Caching Strategies

Ghost implements sophisticated caching at multiple levels:

  1. Database query caching: Reduces repetitive database hits
  2. HTML fragment caching: Stores rendered template portions
  3. CDN-friendly headers: Proper Cache-Control and ETag headers
  4. Image optimization: Automatic responsive image generation

Assets Pipeline

Ghost handles assets intelligently:

  • Automatic minification: CSS and JavaScript are minified in production
  • Image processing: Sharp library for fast image transformations
  • Lazy loading: Built-in support for native lazy loading
  • WebP support: Automatic WebP generation for modern browsers

The Developer Experience

Local Development

Setting up Ghost locally is refreshingly simple:

# Install Ghost-CLI globally
npm install ghost-cli@latest -g

# Create a new Ghost instance
ghost install local

# Your site is running at http://localhost:2368

Theme Development Workflow

Ghost provides excellent tooling for theme developers:

# GScan validates your theme
gscan my-theme.zip

# Live reload during development
ghost run -D

# Deploy themes via CLI
ghost theme upload my-theme.zip

Testing Infrastructure

Ghost takes testing seriously with:

  • Mocha for test running
  • Should.js for assertions
  • Sinon for stubs and mocks
  • Supertest for API testing

The Deployment Landscape

Production Stack Requirements

The officially recommended production stack is now Ubuntu 24, Node 22, and MySQL 8. This represents a significant modernization from earlier versions:

  • Ubuntu 24 LTS: Latest long-term support for stability
  • Node.js 22: Current active LTS version with modern features
  • MySQL 8: Required for production (no longer supports MySQL 5.7 or MariaDB)

Docker-First Deployment

Ghost is moving to a new official Docker Compose env, and the new Docker installation method is ideal for both developers and self-hosting admins. This shift to containerization reflects modern deployment practices:

# docker-compose.yml example
version: '3.8'
services:
  ghost:
    image: ghost:6-alpine
    environment:
      database__client: mysql
      database__connection__host: db
      database__connection__database: ghost
    volumes:
      - ghost-content:/var/lib/ghost/content
    ports:
      - "2368:2368"
  
  db:
    image: mysql:8
    environment:
      MYSQL_ROOT_PASSWORD: your-password
      MYSQL_DATABASE: ghost
    volumes:
      - mysql-data:/var/lib/mysql

Ghost(Pro) Hosting

Ghost's managed hosting runs on:

  • Google Cloud Platform infrastructure
  • Global CDN via Fastly
  • Automated backups and updates
  • Node.js cluster mode for multi-core utilization

What Makes Ghost's Stack Special?

1. Simplicity Without Sacrifice

Ghost proves you don't need microservices, GraphQL, and Kubernetes to build a performant, scalable CMS. The monolithic architecture is a feature, not a bug.

2. JavaScript Everywhere

The full-stack JavaScript approach reduces context switching and enables powerful code sharing between server and client.

3. Content-First Architecture

Every technical decision, from Handlebars to the Content API, prioritizes content delivery and editorial workflows.

4. Progressive Enhancement

Ghost websites work without JavaScript, then are enhanced with interactive features. This isn't just about accessibility. It's about resilience.

5. API-First Design

The headless capabilities aren't bolted on. They are fundamental to the architecture, making Ghost future-proof.

6. Social Web Native

With Ghost 6.0's ActivityPub integration, your publication becomes part of the open, decentralized web. It isn't locked into any single platform.

Learning Resources for Ghost Development

These resources are invaluable if you'd like to learn more about Ghost and Ghost development:

What's Next?

Ghost 6.0 has already delivered on some exciting promises:

  • ActivityPub support: Now live with full Fediverse integration
  • Real-time analytics: Powered by Tinybird partnership
  • Enhanced Docker support: Official Docker Compose environment

The roadmap ahead hints at:

  • Enhanced edge computing: Better CDN integration
  • AI integrations: Native support for content enhancement
  • Improved developer tools: Making theme and integration development even smoother

Wrapping Up

Ghost's technical stack is a masterclass in pragmatic architecture. It's not chasing the latest trends. It's using proven technologies in smart ways. The result is a platform that's fast, reliable, and genuinely enjoyable to work with.

The leap to Ghost 6.0 shows the team's commitment to staying current while maintaining stability. The move to Node.js 22, MySQL 8, and Docker-first deployment keeps the stack modern without breaking existing setups.

I'm continuously impressed by how Ghost's technical decisions translate into real-world benefits for publishers and developers alike. The stack might not win any "cutting-edge technology" awards, but it wins where it counts: delivering content reliably and efficiently while embracing the open web.

Are you working with Ghost technically? I'd love to hear about your experiences. What surprises you, what challenges you, and what delights you about Ghost's architecture?

Do you want to discuss Ghost's technical architecture or need help with your Ghost implementation? Reach out at hello@phantomstudio.io.