Deploy to Other Hosts
Deploy to Other Hosts
Section titled “Deploy to Other Hosts”Netlify is the recommended host for ForgeDocs because it includes Identity and Git Gateway for Decap CMS. But you can deploy ForgeDocs to any static host.
This guide covers deployment to:
- Vercel
- Cloudflare Pages
- Firebase Hosting
- AWS S3 + CloudFront
- cPanel
- VPS (Ubuntu + Nginx)
Each section includes build settings and deployment steps.
Important: Decap CMS requires a Git-based backend with authentication. Netlify Identity + Git Gateway is the easiest setup. Other hosts can use Decap CMS with GitHub OAuth or another backend — but the setup is more involved. If you’re using Decap CMS, Netlify is recommended.
If you’re using Code Only, any static host works.
Common Build Settings
Section titled “Common Build Settings”All static hosts use the same build settings:
| Setting | Value |
|---|---|
| Build command | npm run build |
| Output directory | dist |
| Node version | 18 or 20 |
| Install command | npm install |
Vercel
Section titled “Vercel”Vercel is a popular static host with a generous free tier.
Deploy via GitHub
Section titled “Deploy via GitHub”- Go to vercel.com/new
- Sign in with GitHub
- Click Import next to your
forgedocsrepository - Vercel auto-detects Astro. Verify:
- Framework Preset: Astro
- Build Command:
npm run build - Output Directory:
dist
- Click Deploy
Your site is live at https://your-project.vercel.app.
Connect a Custom Domain
Section titled “Connect a Custom Domain”- Go to your project → Settings → Domains
- Enter your domain
- Follow Vercel’s DNS instructions
Decap CMS on Vercel
Section titled “Decap CMS on Vercel”Vercel does not include Identity or Git Gateway. To use Decap CMS:
- Use GitHub OAuth instead of Git Gateway
- Configure the OAuth app in GitHub settings
- Add
backend: name: githubinconfig.yml
The setup is documented in Decap CMS docs.
Cloudflare Pages
Section titled “Cloudflare Pages”Cloudflare Pages is fast and free, with unlimited bandwidth.
Deploy via GitHub
Section titled “Deploy via GitHub”- Go to dash.cloudflare.com
- Sign in or create an account
- Click Workers & Pages → Create application → Pages → Connect to Git
- Authorize Cloudflare to access GitHub
- Select your
forgedocsrepository - Configure build settings:
- Framework preset: Astro
- Build command:
npm run build - Build output directory:
dist
- Click Save and Deploy
Your site is live at https://your-project.pages.dev.
Connect a Custom Domain
Section titled “Connect a Custom Domain”- Go to your Pages project → Custom domains
- Click Set up a custom domain
- Enter your domain
- Follow Cloudflare’s DNS instructions
Decap CMS on Cloudflare
Section titled “Decap CMS on Cloudflare”Cloudflare does not include Identity or Git Gateway. Use GitHub OAuth instead — same setup as Vercel.
Firebase Hosting
Section titled “Firebase Hosting”Firebase Hosting is Google’s static hosting service.
Prerequisites
Section titled “Prerequisites”- Node.js installed
- A Google account
- Firebase CLI installed:
npm install -g firebase-toolsDeploy Steps
Section titled “Deploy Steps”- Log in to Firebase:
firebase login- Initialize Firebase in your project:
firebase init hostingWhen prompted:
- Project: create a new project or select an existing one
- Public directory:
dist - Single-page app: No
- Set up automatic builds with GitHub: optional
- Overwrite
dist/index.html: No
- Build your site:
npm run build- Deploy:
firebase deployYour site is live at https://your-project.web.app.
Connect a Custom Domain
Section titled “Connect a Custom Domain”- Go to Firebase Console
- Select your project
- Go to Hosting → Add custom domain
- Follow Firebase’s DNS instructions
Decap CMS on Firebase
Section titled “Decap CMS on Firebase”Firebase does not include Identity or Git Gateway. Use GitHub OAuth instead.
AWS S3 + CloudFront
Section titled “AWS S3 + CloudFront”AWS S3 is a low-cost static host. CloudFront adds CDN and HTTPS.
Prerequisites
Section titled “Prerequisites”- An AWS account
- AWS CLI installed and configured
Deploy Steps
Section titled “Deploy Steps”- Build your site:
npm run build- Create an S3 bucket:
aws s3 mb s3://your-bucket-name- Enable static website hosting:
aws s3 website s3://your-bucket-name --index-document index.html --error-document 404.html- Upload files:
aws s3 sync dist/ s3://your-bucket-name --delete- Make files public:
aws s3api put-bucket-policy --bucket your-bucket-name --policy file://policy.jsonCreate policy.json:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::your-bucket-name/*" } ]}- Access your site at:
http://your-bucket-name.s3-website-your-region.amazonaws.comAdd CloudFront (Recommended)
Section titled “Add CloudFront (Recommended)”For HTTPS and global CDN:
- Go to AWS Console → CloudFront → Create distribution
- Origin domain: select your S3 bucket
- Viewer protocol policy: Redirect HTTP to HTTPS
- Default root object:
index.html - Click Create distribution
Decap CMS on AWS
Section titled “Decap CMS on AWS”AWS does not include Identity or Git Gateway. Use GitHub OAuth instead.
cPanel
Section titled “cPanel”cPanel is a control panel used by many shared hosts. It works if your host allows Node.js builds or if you upload the built files.
Option 1 — Upload Built Files
Section titled “Option 1 — Upload Built Files”- Build your site locally:
npm run build- Zip the contents of
dist/:
cd disttar -czf ../forgedocs-build.tar.gz .- Log in to cPanel
- Open File Manager
- Navigate to
public_html/ - Upload
forgedocs-build.tar.gz - Extract it in
public_html/
Your site is live at your domain.
Note: You’ll need to rebuild and re-upload every time you change content.
Option 2 — Node.js App (If Supported)
Section titled “Option 2 — Node.js App (If Supported)”Some cPanel hosts support Node.js apps via Setup Node.js App. If yours does:
-
Go to Setup Node.js App → Create Application
-
Node.js version: 18 or 20
-
Application root:
forgedocs -
Application URL: your domain
-
Application startup file: leave blank
-
Click Create
-
Upload your project files to
forgedocs/ -
Run:
cd forgedocsnpm installnpm run build- Point the document root to
forgedocs/dist/
Decap CMS on cPanel
Section titled “Decap CMS on cPanel”cPanel does not include Identity or Git Gateway. Use GitHub OAuth instead. This requires a backend server for OAuth — either a separate service or a serverless function.
VPS (Ubuntu + Nginx)
Section titled “VPS (Ubuntu + Nginx)”A VPS gives you full control. This guide uses Ubuntu 22.04 and Nginx.
Prerequisites
Section titled “Prerequisites”- A VPS with Ubuntu 22.04
- SSH access
- A domain pointed to your VPS IP
Step 1 — Install Node.js
Section titled “Step 1 — Install Node.js”curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -sudo apt install -y nodejsnode --versionStep 2 — Install Nginx
Section titled “Step 2 — Install Nginx”sudo apt updatesudo apt install -y nginxStep 3 — Clone Your Project
Section titled “Step 3 — Clone Your Project”cd /var/wwwsudo git clone https://github.com/yourusername/forgedocs.gitcd forgedocssudo npm installsudo npm run buildStep 4 — Configure Nginx
Section titled “Step 4 — Configure Nginx”Create a new config file:
sudo nano /etc/nginx/sites-available/forgedocsAdd:
server { listen 80; server_name your-domain.com www.your-domain.com;
root /var/www/forgedocs/dist; index index.html;
location / { try_files $uri $uri/ /404.html; }
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|webp|avif)$ { expires 1y; add_header Cache-Control "public, immutable"; }
gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml;}Enable the site:
sudo ln -s /etc/nginx/sites-available/forgedocs /etc/nginx/sites-enabled/sudo nginx -tsudo systemctl reload nginxStep 5 — Add HTTPS with Let’s Encrypt
Section titled “Step 5 — Add HTTPS with Let’s Encrypt”sudo apt install -y certbot python3-certbot-nginxsudo certbot --nginx -d your-domain.com -d www.your-domain.comFollow the prompts. Certbot auto-renews every 90 days.
Step 6 — Auto-Deploy on Git Push (Optional)
Section titled “Step 6 — Auto-Deploy on Git Push (Optional)”Create a deploy script:
sudo nano /var/www/forgedocs/deploy.shAdd:
#!/bin/bashcd /var/www/forgedocsgit pullnpm installnpm run buildMake it executable:
sudo chmod +x /var/www/forgedocs/deploy.shAdd a GitHub webhook:
- Go to your GitHub repo → Settings → Webhooks
- Add webhook:
https://your-domain.com/deploy - Set a secret
Then create a small Node.js server to handle the webhook, or use a service like webhook.site.
Decap CMS on VPS
Section titled “Decap CMS on VPS”VPS does not include Identity or Git Gateway. Use GitHub OAuth with a small backend — or use Decap CMS with a local backend if you only edit from your own machine.
Which Host Should You Choose?
Section titled “Which Host Should You Choose?”| Host | Free | Decap CMS | Best For |
|---|---|---|---|
| Netlify | Yes | ✅ Easiest | Decap CMS users |
| Vercel | Yes | ⚠️ GitHub OAuth | Next.js/Astro users |
| Cloudflare Pages | Yes | ⚠️ GitHub OAuth | Speed-focused |
| Firebase | Yes | ⚠️ GitHub OAuth | Google ecosystem |
| AWS S3 | No | ⚠️ Complex | Enterprise |
| cPanel | Depends | ❌ | Shared hosting |
| VPS | No | ⚠️ Custom | Full control |
Recommendation: Use Netlify if you’re using Decap CMS. Use Cloudflare Pages or Vercel if you’re using Code Only and want speed.
Common Issues
Section titled “Common Issues”Build succeeds locally but fails on host
Section titled “Build succeeds locally but fails on host”Check Node.js version. Set it to 18 or 20 in your host’s settings.
Site shows 404 on refresh
Section titled “Site shows 404 on refresh”Configure your host to serve 404.html for unknown routes. For Nginx:
error_page 404 /404.html;Assets have wrong paths
Section titled “Assets have wrong paths”Verify site in astro.config.mjs matches your domain. Astro uses this to generate absolute URLs.
CSS/JS not loading
Section titled “CSS/JS not loading”Check the build output directory. It should be dist, not public.
What’s Next
Section titled “What’s Next”Now that you’re deployed, explore the Developer Guide:
Need Help?
Section titled “Need Help?”If you’re stuck:
- Check the FAQ
- Email creativebydre@gmail.com
- For custom work, hire me on Fiverr