Skip to content
Souloss
Go back

Deployment Guide: Deploy astro-minimax to Multiple Platforms

A comprehensive guide to deploying your astro-minimax blog to Cloudflare Pages, Vercel, Netlify, Docker, and more.

This guide covers how to deploy your astro-minimax blog to various platforms. astro-minimax generates static sites, so it can be deployed to almost any static hosting service.

Project Types

astro-minimax supports two project types with slightly different deployment configurations:

Project TypeDescriptionCharacteristics
MonorepoClone the repository directlyContains multiple packages, suitable for contributing code
CLI CreatedUse npx @astro-minimax/cli initSingle project, simpler structure

How to Identify Your Project Type

Check if pnpm-workspace.yaml exists in your project root:

flowchart TD
    A[Project Root] --> B{pnpm-workspace.yaml?}
    B -->|Exists| C[Monorepo Type]
    B -->|Not exists| D[CLI Created Type]

    C --> E[Build output: apps/blog/dist/]
    C --> F[wrangler.toml: apps/blog/]

    D --> G[Build output: dist/]
    D --> H[wrangler.toml: project root]

Prerequisites

Before deploying, make sure your blog builds successfully locally:

# Run from project root
pnpm run build
bash

Build output location:

Project TypeBuild Output Directory
Monorepoapps/blog/dist/
CLI Createddist/

If the build fails, run pnpm run dev first to identify and fix errors.


Cloudflare Pages is the recommended platform because astro-minimax’s AI chat feature is built on Cloudflare Workers AI.

Git Integration

  1. Push your code to GitHub / GitLab
  2. Log in to Cloudflare Dashboard → Pages → Create a project
  3. Connect your Git repository
  4. Configure build settings:

Monorepo Type

SettingValue
Framework presetAstro
Build commandpnpm run build
Build output directoryapps/blog/dist
Root directory/ (keep default)
Node.js version22 (set NODE_VERSION=22 in environment variables)

CLI Created Type

SettingValue
Framework presetAstro
Build commandpnpm run build
Build output directorydist
Root directory/ (keep default)
Node.js version22 (set NODE_VERSION=22 in environment variables)
  1. Click Save and Deploy

Environment Variables

If AI chat is enabled, configure in Cloudflare Pages:

VariableDescription
NODE_VERSION22 (recommended)
AI_BINDING_NAMEAI Binding name (defaults to minimaxAI)

AI Binding Configuration

The project includes a wrangler.toml file that defines the AI Binding:

Monorepo Type: File located at apps/blog/wrangler.toml

CLI Created Type: File located at wrangler.toml (project root)

name = "astro-minimax"
pages_build_output_dir = "dist"
compatibility_date = "2026-03-12"
compatibility_flags = ["nodejs_compat"]

[ai]
binding = "minimaxAI"

[[kv_namespaces]]
binding = "CACHE_KV"
id = "your-kv-namespace-id"
toml

Cloudflare Pages automatically detects this configuration and enables Workers AI.

compatibility_flags = ["nodejs_compat"] enables Node.js compatibility mode for proper AI functionality.

Custom Domain

After deployment, add a custom domain in Cloudflare Pages settings. Cloudflare automatically provisions SSL certificates.

Environment Variables

For detailed environment variable configuration, see Cloudflare Environment Variables Guide.


Vercel

Git Integration

  1. Log in to Vercel → New Project → Import Git repository
  2. Configure build settings:

Monorepo Type

SettingValue
Framework presetAstro
Build commandpnpm run build
Output directoryapps/blog/dist
Install commandpnpm install
Root directory. (keep default)

CLI Created Type

SettingValue
Framework presetAstro
Build commandpnpm run build
Output directorydist
Install commandpnpm install
Root directory. (keep default)
  1. Set NODE_VERSION=22 in environment variables
  2. Click Deploy

Notes


Netlify

Git Integration

  1. Log in to Netlify → New site → Import Git repository
  2. Configure build settings:

Monorepo Type

SettingValue
Build commandpnpm run build
Publish directoryapps/blog/dist

CLI Created Type

SettingValue
Build commandpnpm run build
Publish directorydist
  1. Set NODE_VERSION=22 in environment variables
  2. Click Deploy site

netlify.toml (Optional)

Create netlify.toml in the project root for unified configuration:

Monorepo Type:

[build]
  command = "pnpm run build"
  publish = "apps/blog/dist"

[build.environment]
  NODE_VERSION = "22"
toml

CLI Created Type:

[build]
  command = "pnpm run build"
  publish = "dist"

[build.environment]
  NODE_VERSION = "22"
toml

Docker

astro-minimax supports Docker containerized deployment.

Development

Use docker-compose.yml for a quick dev server:

services:
  app:
    image: node:lts
    ports:
      - 4321:4321
    working_dir: /app
    command: pnpm run dev -- --host 0.0.0.0
    volumes:
      - ./:/app
yaml
docker compose up
bash

Production

Use a multi-stage Dockerfile for production images:

Monorepo Type

CLI Created Type

# Build image
docker build -t my-blog .

# Run container
docker run -p 80:80 my-blog
bash

Static File Hosting

astro-minimax generates pure static files and can be deployed to any static file server:

GitHub Pages

  1. Create .github/workflows/deploy.yml:

Monorepo Type:

CLI Created Type:

  1. In repo Settings → Pages, select GitHub Actions as the Source

Self-hosted Server

Upload the build output directory contents to your server’s web root:

Monorepo Type:

rsync -avz apps/blog/dist/ user@server:/var/www/html/
bash

CLI Created Type:

rsync -avz dist/ user@server:/var/www/html/
bash

Deployment Checklist

Before deploying, verify:

Quick Reference

Build Output Directory

Project TypeBuild Output Directory
Monorepoapps/blog/dist
CLI Createddist

wrangler.toml Location

Project TypeFile Path
Monorepoapps/blog/wrangler.toml
CLI Createdwrangler.toml (project root)

FAQ

Build fails: pnpm not found

Ensure the deployment platform supports pnpm. Most platforms need the Node.js version specified in environment variables:

NODE_VERSION=22
plaintext

Search doesn’t work

Pagefind search index is generated during build. Make sure the build command includes the pagefind --site dist step (already included in pnpm run build).

AI chat doesn’t work

The AI chat feature depends on Cloudflare Workers AI. If deploying to other platforms:

  1. Set ai.mockMode to true (shows preset responses only), or
  2. Configure an alternative AI API endpoint


Previous Post
Blog Notification System Configuration Guide
Next Post
astro-minimax Feature Overview

评论区

文明评论,共建和谐社区