Deployment
JustDocs can be deployed to any static hosting platform. Here are the most popular options:
Vercel
Deploy to Vercel with zero configuration:
npm install -g vercel
vercel
Or connect your GitHub repository to Vercel for automatic deployments.
Netlify
Deploy to Netlify:
- Build your site:
npm run build - Drag and drop the
distfolder to Netlify - Or connect your Git repository for continuous deployment
GitHub Pages
Deploy to GitHub Pages:
# .github/workflows/deploy.yml
name: Deploy to GitHub Pages
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install
- run: npm run build
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
Cloudflare Pages
- Connect your repository to Cloudflare Pages
- Set build command:
npm run build - Set output directory:
dist
Custom Server
For custom servers, build and serve the static files:
npm run build
# Serve the dist directory with any static file server
Environment Variables
Configure environment variables for different environments:
# .env.production
PUBLIC_SITE_URL=https://yourdomain.com
PUBLIC_ANALYTICS_ID=your-analytics-id
Build Optimization
Optimize your build for production:
// astro.config.mjs
export default defineConfig({
build: {
inlineStylesheets: 'auto'
},
vite: {
build: {
minify: 'terser'
}
}
});