Because docmd generates a high-performance static website, it can be hosted on any environment that serves HTML. Simply run the build command and deploy the output directory (Default: site/).
docmd build
Hosting Providers
The recommended method is using GitHub Actions to automate your deployments on every push.
Create .github/workflows/deploy.yml:
name: Deploy docmd
on:
push:
branches: ["main"]
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '22' }
- run: npx @docmd/core build
- uses: actions/upload-pages-artifact@v3
with: { path: ./site }
- uses: actions/deploy-pages@v4
- Connect your repository to Vercel.
- In the project Build Settings:
- Framework Preset:
Other - Build Command:
npx @docmd/core build - Output Directory:
site
- Framework Preset:
- Deploy. Vercel automatically detects the static output and serves it globally.
- Import your project from GitHub/GitLab/Bitbucket.
- Configure your build settings:
- Build command:
npx @docmd/core build - Publish directory:
site
- Build command:
- Click Deploy site. Netlify’s CDN will handle the routing and asset delivery.
- Create a new project in the Cloudflare Dashboard under Pages.
- Connect your git provider and select your repository.
- Configure the build settings:
- Framework preset:
None - Build command:
npx @docmd/core build - Build output directory:
site
- Framework preset:
- Save and Deploy.
- Install the Firebase CLI:
npm install -g firebase-tools. - Build your site:
npx @docmd/core build. - Run
firebase init hostingand select your project. - Set the public directory to
site. - Configure as a single-page app:
Yes(this handles the 404 behavior). - Deploy using
firebase deploy.
For traditional web servers (NGINX, Apache, IIS):
- Generate the site:
npx @docmd/core build. - Upload the contents of the
site/folder to your server via SFTP, SCP, or your preferred CI/CD tool. - Ensure your server is configured to serve
index.htmlfor directories (the default for most).
For self-hosting within a containerized environment, you can use a simple Nginx-based Dockerfile:
# Build Stage
FROM node:22-alpine AS builder
WORKDIR /app
COPY . .
RUN npx @docmd/core build
# Serve Stage
FROM nginx:alpine
COPY --from=builder /app/site /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
SPA Routing Considerations
docmd implements a micro-SPA router that handles internal navigation smoothly. Unlike React-based SPAs, every page in docmd is generated as its own index.html file on the filesystem. This means:
- No Rewrite Rules: You don’t need to configure
index.htmlrewrites on your server for most platforms. - Deep Linking: Direct access to URLs like
/guide/setupworks out of the box because the server finds/guide/setup/index.html.
Production Checklist
- Site URL: Ensure the
urlproperty is set in yourdocmd.config.js. This is critical for generating correct canonical tags, sitemaps, and social preview images. - Redirects: If you are migrating from another tool, use the
redirectsconfig to maintain your SEO rankings. - Analytics: Enable the
analyticsplugin to track user engagement and search queries. - AI Ingress: Enable the
llmsplugin to generatellms.txt. This allows AI agents to ingest your documentation more efficiently, providing better answers to your users.
docmd automatically generates a 404.html in your output directory. Most hosting providers (GitHub Pages, Netlify, Vercel) will automatically use this file when a user hits a missing route.