Deploy
Deploy MDXLD applications to production
Deploy
Deploy your MDXLD applications to Cloudflare, Vercel, or Netlify with zero configuration.
Quick Deploy
Deploy to Cloudflare (default):
mdxe deployDeploy to specific platform:
mdxe deploy --target vercel
mdxe deploy --target netlifyAuthentication
Using DO_TOKEN
Set your API token as an environment variable:
export DO_TOKEN=your-token-here
mdxe deployUsing OAuth
Authenticate via OAuth.do:
mdxe login
mdxe deployOAuth provides secure authentication without storing tokens locally.
Deployment Options
Production Deployment
Deploy to production:
mdxe deploy --productionCustom Domain
Deploy with custom domain:
mdxe deploy --domain example.comPreview Deployment
Deploy preview (default):
mdxe deployPreview deployments get a unique URL like https://preview-abc123.do
Cloudflare Workers
MDXLD deploys to Cloudflare Workers Static Assets (not Cloudflare Pages, which is deprecated).
mdxe deploy --target cloudflareFeatures:
- Global edge network
- Instant cache purging
- Automatic HTTPS
- DDoS protection
- Zero cold starts
See: Cloudflare Workers Static Assets
Build Before Deploy
The deploy command automatically builds your application:
mdxe deploy
# Runs: mdxe build
# Then: deploys to target platformTo build separately:
mdxe build
mdxe deploy --skip-buildEnvironment Variables
Set environment variables for deployment:
mdxe deploy --env DO_TOKEN=xxx --env API_URL=https://api.doOr use .env file:
# .env
DO_TOKEN=your-token-here
API_URL=https://api.doDeployment Targets
Cloudflare
mdxe deploy --target cloudflare- Edge computing platform
- Global CDN
- Static assets with Workers
- Automatic SSL
Vercel
mdxe deploy --target vercel- Edge network
- Automatic previews
- Git integration
- Serverless functions
Netlify
mdxe deploy --target netlify- Continuous deployment
- Edge functions
- Form handling
- Identity management
Continuous Deployment
GitHub Actions
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm
- run: pnpm install
- run: pnpm test
- run: mdxe deploy --production
env:
DO_TOKEN: ${{ secrets.DO_TOKEN }}Publishing to .do Platform
Publish your MDX documents to the .do platform:
mdxdb publishThis makes your documents available via:
- API:
https://api.do/your-collection/your-doc - SDK:
$.YourCollection.get('your-doc') - MCP:
mcp.do/your-collection/your-doc
Publish Options
# Publish all documents
mdxdb publish
# Publish specific type
mdxdb publish --type BlogPost
# Publish as draft
mdxdb publish --draft
# Schedule publication
mdxdb publish --schedule "2024-12-25T00:00:00Z"Rollback
Rollback to previous deployment:
mdxe rollbackList previous deployments:
mdxe deployments listRollback to specific deployment:
mdxe rollback abc123Deployment Status
Check deployment status:
mdxe statusView deployment logs:
mdxe logsCustom Build Configuration
Customize the build process:
// mdxe.config.ts
export default {
build: {
outDir: 'dist',
minify: true,
sourcemap: true,
target: 'worker'
},
deploy: {
target: 'cloudflare',
domain: 'example.com'
}
}Post-Deploy Verification
After deployment, verify:
- Site loads: Visit deployment URL
- MDX renders: Check MDX documents display correctly
- Types work: Verify
$typediscrimination works - API calls: Test calls to .do platform
- Authentication: Verify OAuth/token auth works
Troubleshooting
Build Fails
mdxe build --verboseDeploy Fails
mdxe deploy --verbose --debugInvalid Token
mdxe login # Re-authenticate
mdxe deploy