Deployment Guide
Learn how to build and deploy your Ametrine digital garden to production.
Prerequisites
Before deploying, make sure:
- Your site works locally (
bun run dev) - You’ve set
baseUrlinsrc/config.ts - All your content is committed to git
Building for Production
1. Set Base URL
Edit src/config.ts:
export const config: SiteConfig = { baseUrl: "https://your-domain.com", // Your production URL // ... other config}This is required for:
- RSS feed generation
- OG image absolute URLs
- Proper sitemap URLs
2. Run the Build
bun run buildThis command:
- Generates static HTML pages
- Creates the content index
- Generates OG images 1If enabled in config
- Builds the search index
- Outputs everything to
dist/
First build may take longer due to OG image generation. Subsequent builds are faster thanks to caching.
3. Preview the Build
Test the production build locally:
bun run previewVisit http://localhost:4321 to verify everything works.
Deployment Platforms
Choose your preferred hosting platform. All support automatic deployments from Git.
Netlify
Recommended for beginners - Free tier, automatic HTTPS, great performance.
Via Netlify UI
- Push your code to GitHub/GitLab/Bitbucket
- Go to netlify.com
- Click “Add new site” → “Import an existing project”
- Connect your Git repository
- Configure build settings:
- Build command:
bun run buildornpm run build - Publish directory:
dist - Node version: 18 or higher
- Build command:
- Click “Deploy site”
Via netlify.toml
Add netlify.toml to your project root:
[build] command = "bun run build" publish = "dist"
[[redirects]] from = "/*" to = "/index.html" status = 200
[build.environment] NODE_VERSION = "18.14.1"Then:
- Push to GitHub
- Import project on Netlify
- Auto-deploy on every push
Vercel
Excellent for Next.js developers - Zero config, edge network, great DX.
Via Vercel UI
- Push your code to GitHub/GitLab/Bitbucket
- Go to vercel.com
- Click “Add New” → “Project”
- Import your repository
- Vercel auto-detects Astro
- Click “Deploy”
Via vercel.json
Add vercel.json to your project root:
{ "buildCommand": "bun run build", "outputDirectory": "dist", "framework": "astro"}GitHub Pages
Free hosting for public repos - Perfect if your site is already on GitHub.
Setup
- Install the GitHub Pages adapter:
bun add @astrojs/github-pages- Update
astro.config.mjs:
import { defineConfig } from 'astro/config';
export default defineConfig({ site: 'https://username.github.io', base: '/repo-name', // If using project pages // ... other config});- Update
src/config.ts:
baseUrl: "https://username.github.io/repo-name"- Add GitHub Actions workflow (
.github/workflows/deploy.yml):
name: Deploy to GitHub Pages
on: push: branches: [ main ] workflow_dispatch:
permissions: contents: read pages: write id-token: write
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1 - run: bun install - run: bun run build - uses: actions/upload-pages-artifact@v2 with: path: dist
deploy: needs: build runs-on: ubuntu-latest environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - uses: actions/deploy-pages@v2 id: deployment- Enable GitHub Pages in repo settings:
- Go to Settings → Pages
- Source: GitHub Actions
Cloudflare Pages
Fast edge network - Great performance, generous free tier.
Setup
- Push your code to GitHub/GitLab
- Go to pages.cloudflare.com
- Click “Create a project”
- Connect your Git repository
- Configure build:
- Build command:
bun run build - Build output directory:
dist - Environment variable:
NODE_VERSION = 18
- Build command:
- Click “Save and Deploy”
Via Wrangler
For CLI deployment:
npm install -g wranglerwrangler pages project create my-gardenbun run buildwrangler pages publish distCustom Server (VPS/Docker)
For advanced users who want full control.
Using Docker
Create Dockerfile:
FROM node:18-alpine AS builderWORKDIR /appCOPY package.json bun.lockb ./RUN npm install -g bun && bun installCOPY . .RUN bun run build
FROM nginx:alpineCOPY --from=builder /app/dist /usr/share/nginx/htmlEXPOSE 80CMD ["nginx", "-g", "daemon off;"]Build and run:
docker build -t my-garden .docker run -p 80:80 my-gardenUsing Nginx
Build locally and transfer dist/ to your server:
bun run buildrsync -avz dist/ user@server:/var/www/html/Nginx configuration:
server { listen 80; server_name your-domain.com; root /var/www/html; index index.html;
location / { try_files $uri $uri/ /index.html; }
# Cache static assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { expires 1y; add_header Cache-Control "public, immutable"; }}Environment Variables
Some platforms require environment variables:
Node Version
NODE_VERSION=18.14.1Build Command Override
BUILD_COMMAND="bun run build"Custom Base Path
BASE_PATH="/my-garden"Set these in your platform’s dashboard or deployment configuration.
Post-Deployment Checklist
After deploying, verify:
- Homepage loads correctly
- Wikilinks work and navigate properly
- Graph visualization renders
- Search functionality works (Cmd/Ctrl+K)
- Dark mode toggle functions
- Images and assets load
- RSS feed is accessible (
/rss.xml) - OG images generate for social sharing
- Mobile responsive design works
- Analytics tracking (if enabled)
Continuous Deployment
Set up automatic deployments:
Netlify/Vercel/Cloudflare
These platforms automatically deploy when you push to your main branch. No additional setup needed!
GitHub Actions
The workflow above runs on every push to main. Customize the trigger:
on: push: branches: [ main, develop ] # Multiple branches schedule: - cron: '0 0 * * *' # Daily at midnightCustom Domains
Netlify
- Go to Site settings → Domain management
- Click “Add custom domain”
- Follow DNS configuration instructions
Vercel
- Go to Project settings → Domains
- Add your domain
- Configure DNS records
GitHub Pages
- Go to Settings → Pages
- Add custom domain
- Configure DNS:
- A record:
185.199.108.153 - CNAME:
username.github.io
- A record:
Wait 24-48 hours for SSL certificates to provision after adding a custom domain.
Performance Optimization
Enable Compression
Most platforms enable gzip/brotli automatically. Verify with:
curl -H "Accept-Encoding: gzip" -I https://your-site.comCDN Configuration
Platforms like Netlify, Vercel, and Cloudflare include CDN by default. No extra setup needed.
Image Optimization
Ametrine uses Astro’s built-in image optimization. To further optimize:
- Use WebP format for images
- Compress before uploading
- Use appropriate dimensions
Troubleshooting
Build Fails
Check Node version: Must be 18.14.1 or higher
node --versionCheck for errors:
bun run build --verboseRoutes Not Working (404s)
For SPAs: Ensure your platform redirects all routes to index.html
Netlify:
[[redirects]] from = "/*" to = "/index.html" status = 200Vercel: (automatic)
Images Not Loading
Check paths: All image paths should be relative to public/
 # ✓ Correct # ✗ WrongOG Images Not Generating
Verify config:
ogImage: { enable: true, // ...}Check baseUrl is set:
baseUrl: "https://your-domain.com"Search Not Working
Search requires the content index. Verify /static/contentIndex.json exists in dist/.
Monitoring
Uptime Monitoring
Use services like:
- UptimeRobot (free)
- Pingdom
- Better Uptime
Analytics
See Configuration Guide for setup instructions.
Error Tracking
For production error monitoring:
Updating Your Site
To update content:
- Edit markdown files locally
- Test with
bun run dev - Commit and push to Git
- Platform auto-deploys 2If CI/CD is configured
To update Ametrine template:
# Fetch latest template changesgit remote add template https://github.com/brickfrog/ametrinegit fetch templategit merge template/mainNext Steps
Now that your site is deployed:
- Share your garden on social media
- Add more notes and build your knowledge base
- Customize the configuration
- Monitor analytics and engagement
- Join the Ametrine community
Happy gardening!
Links & Context23netlify.comvercel.com
+13 more links
AmetrineWikilinks and Graph
+4 more backlinks
External Links15
Backlinks6
- Ametrine
Digital garden template built with Astro
- Wikilinks and Graph
Master linking and graph visualization in Ametrine
- Quick Start
Get your Ametrine digital garden running in 5 minutes
- Advanced Features
Master search, popovers, activity tracking, and more
- Configuration Guide
Complete guide to customizing Ametrine via config.ts
- Syntax Reference
Quick reference for all Ametrine syntax features