Step-by-Step Deployment Guide
This guide walks you through deploying your Docusaurus site to Vercel, a cloud platform for static sites and serverless functions.
Prerequisites
Before deploying, ensure you have:
- ✅ A Docusaurus site configured and tested locally (see Setup Guide)
- ✅ Your site pushed to a public GitHub repository
- ✅ A Vercel account (free tier available)
Your GitHub repository must be public for Vercel to access it. Private repositories require additional configuration or a paid Vercel plan.
Step 1: Connect to Vercel
Create a Vercel Account
- Go to vercel.com
- Click Sign Up
- Choose Continue with GitHub
- Authorize Vercel to access your GitHub account
Import Your Repository
- From your Vercel dashboard, click Add New → Project
- You'll see a list of your GitHub repositories
- Find your documentation site repository
- Click Import next to the repository name
Step 2: Configure Deployment Settings
Vercel will attempt to auto-detect your framework and settings. Verify the following configuration:
Framework Detection
Setting | Value | Notes |
---|---|---|
Framework Preset | Docusaurus 2+ | Should auto-detect |
Root Directory | . (leave blank) | Only change if Docusaurus is in a subfolder like website/ |
Build Settings
Setting | Value | Notes |
---|---|---|
Build Command | yarn build | Or npm run build if using npm |
Output Directory | build | Should auto-detect |
Install Command | yarn install | Should auto-detect |
If Vercel doesn't auto-detect correctly, you can manually override these settings in the configuration panel.
Environment Variables (Optional)
If your site requires environment variables:
- Scroll to Environment Variables section
- Add key-value pairs (e.g.,
API_KEY=your-key
) - Choose which environments to apply them to (Production, Preview, Development)
Step 4: Deploy
- Review all settings one final time
- Click the Deploy button
- Vercel will begin building your site
What Happens During Deployment
You'll see real-time build logs showing:
- Installing dependencies
- Building your Docusaurus site
- Optimizing assets
- Deploying to Vercel's CDN
The first deployment typically takes 2-5 minutes.
Step 5: Verify Deployment
Once the build completes successfully:
Access Your Live Site
- Vercel provides an automatic domain:
your-project-name.vercel.app
- Click the Visit button or the generated URL
- Your Docusaurus site should load in a new tab
Check Build Logs
If something went wrong:
- Click on the Deployments tab
- Select your deployment
- Click View Build Logs to see detailed error messages
- Green checkmark next to your deployment
- Status shows "Ready"
- Site loads correctly at the provided URL
Step 6: Configure Automatic Deployments
Vercel automatically sets up continuous deployment:
- Every push to your main branch triggers a new production deployment
- Pull requests create preview deployments with unique URLs
- Rollbacks are instant if you need to revert changes
Branch Configuration
By default, Vercel deploys from your main
branch. To change this:
- Go to Project Settings → Git
- Update the Production Branch setting
- Save changes
Step 7: Set Up Custom Domain (Optional)
To use your own domain instead of vercel.app
:
- Go to Project Settings → Domains
- Click Add Domain
- Enter your domain name
- Follow Vercel's instructions to update your DNS records
- Wait for DNS propagation (usually 10-60 minutes)
Vercel automatically provides SSL certificates for all domains.
Deployment Checklist
Use this checklist to ensure a smooth deployment:
- All changes committed and pushed to GitHub
- Site builds successfully locally with
yarn build
- Repository is public on GitHub
- Vercel account connected to GitHub
- Framework preset set to Docusaurus 2+
- Build command is correct (
yarn build
) - Output directory is
build
- Environment variables configured (if needed)
- Deployment completed successfully
- Site accessible at Vercel URL
- Navigation and links working correctly
Next Steps
Now that your site is deployed:
- Monitor your deployments in the Vercel dashboard
- Set up custom domains if desired
- Configure environment variables for different environments
- Review analytics to track site performance
- Check the Troubleshooting Guide if you encounter any issues
Every commit to your repository triggers a new deployment automatically. You can view all deployment history in your Vercel dashboard.