Deploy to Netlify
ACMS works with Netlify for both static sites and serverless applications. This guide covers deploying your ACMS-powered application to Netlify.
Prerequisites
Section titled “Prerequisites”- A Netlify account
- Your application working locally with
acms dev - A production storage adapter configured in
acms.config.ts
Configuration
Section titled “Configuration”import { defineConfig } from '@useacms/client';import { localFile, githubGist } from '@useacms/cli/adapters';
export default defineConfig({ dev: localFile({ path: './acms.json' }), production: githubGist({ token: process.env.GITHUB_TOKEN, gistId: process.env.GITHUB_GIST_ID, }), strategy: 'build-time',});Deployment Steps
Section titled “Deployment Steps”1. Push Content
Section titled “1. Push Content”Upload your local content to the production adapter:
acms push2. Set Environment Variables
Section titled “2. Set Environment Variables”In the Netlify dashboard under Site Settings > Environment Variables, add:
GITHUB_TOKENGITHUB_GIST_ID
Or whatever credentials your chosen adapter requires.
3. Configure Build
Section titled “3. Configure Build”In netlify.toml:
[build] command = "npm run build" publish = "dist" # Adjust for your framework
[build.environment] NODE_VERSION = "20"4. Deploy
Section titled “4. Deploy”netlify deploy --prodOr connect your Git repository for automatic deployments.
Content Update Workflow
Section titled “Content Update Workflow”- Edit content locally or via the dashboard.
- Run
acms pushto upload to the production adapter. - Trigger a Netlify rebuild via the dashboard, CLI, or build webhook.
- New content is live.
Build Webhooks
Section titled “Build Webhooks”Create a build webhook in Netlify (Site Settings > Build & deploy > Build hooks) and trigger it after pushing content:
acms push && curl -X POST https://api.netlify.com/build_hooks/your-hook-idFramework-Specific Configuration
Section titled “Framework-Specific Configuration”Next.js
Section titled “Next.js”[build] command = "next build" publish = ".next"Install the Netlify Next.js plugin for full Next.js support.
[build] command = "astro build" publish = "dist"SvelteKit
Section titled “SvelteKit”[build] command = "vite build" publish = "build"Use the @sveltejs/adapter-netlify adapter.
Next Steps
Section titled “Next Steps”- Explore Storage Adapters for production
- Learn about the Hosted SaaS platform