This repository is configured for zero-configuration deployment to Vercel with full WebContainer API support.
- Node.js 18.18.0 or higher
- pnpm 8.15.6
- Vercel account (free tier works)
- GitHub account
- Repository forked and cloned
- Dependencies installed (
pnpm install) - Build successful (
pnpm build) - Tests passing (
pnpm test) - Vercel configuration created
- CI/CD pipeline configured
- Environment variables documented
- HTTPS enforced
- Cross-Origin Isolation enabled (COOP/COEP headers)
- Service Workers enabled
- WebAssembly support enabled
- CDN caching configured
- Security headers configured
- Immutable asset caching
- Zero-downtime deployment
- Automatic rollback capability
npm i -g vercelvercel loginvercel linkvercel --prodThe repository includes a complete CI/CD pipeline that:
- Quality Checks - Runs linting and tests
- Build - Compiles all packages and documentation
- Deploy - Pushes to Vercel production on main branch
- Preview - Creates preview deployments for PRs
Add these secrets to your GitHub repository:
- Go to Settings → Secrets and variables → Actions
- Add the following secrets:
| Secret Name | Description | How to Get |
|---|---|---|
VERCEL_TOKEN |
Vercel authentication token | Create token |
VERCEL_ORG_ID |
Your Vercel organization ID | Run vercel link and check .vercel/project.json |
VERCEL_PROJECT_ID |
Your Vercel project ID | Run vercel link and check .vercel/project.json |
git add .
git commit -m "feat: deploy to production"
git push origin mainThe pipeline will automatically:
- Run quality checks
- Build the application
- Deploy to Vercel production
- Generate deployment summary
{
"installCommand": "pnpm install --frozen-lockfile",
"buildCommand": "pnpm install && pnpm build",
"outputDirectory": "docs/tutorialkit.dev/dist",
"devCommand": "pnpm docs"
}-
Install Dependencies
pnpm install --frozen-lockfile
-
Build Core Packages
pnpm build
Builds all packages in the monorepo:
@tutorialkit/astro@tutorialkit/react@tutorialkit/runtime@tutorialkit/theme@tutorialkit/types
-
Build Documentation Site
pnpm docs:build
Compiles the Astro-based documentation site with:
- Type checking
- Asset optimization
- Static site generation
- Header configuration
docs/tutorialkit.dev/dist/
├── _astro/ # Optimized assets (CSS, JS)
├── assets/ # Static assets
├── guides/ # Documentation pages
├── reference/ # API reference
├── _headers # Security headers
└── index.html # Entry point
Required for WebContainer API:
{
"Cross-Origin-Embedder-Policy": "require-corp",
"Cross-Origin-Opener-Policy": "same-origin"
}{
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "strict-origin-when-cross-origin"
}/assets/*- Static assets/_astro/*- Astro build artifacts*.js,*.css,*.woff2, etc. - Static files
Cache-Control: public, max-age=31536000, immutable
Cache-Control: public, max-age=0, must-revalidate
Service-Worker-Allowed: /
NODE_VERSION=18.18.0
PNPM_VERSION=8.15.6
NODE_OPTIONS=--max-old-space-size=4096
ASTRO_TELEMETRY_DISABLED=1
ENABLE_EXPERIMENTAL_COREPACK=1CROSS_ORIGIN_EMBEDDER_POLICY=require-corp
CROSS_ORIGIN_OPENER_POLICY=same-origin# Build production version
pnpm build
pnpm docs:build
# Preview locally
pnpm --filter=tutorialkit.dev preview- Open browser DevTools
- Check Console for errors
- Verify headers:
fetch(window.location.href).then(r => { console.log(r.headers.get('cross-origin-embedder-policy')); console.log(r.headers.get('cross-origin-opener-policy')); });
navigator.serviceWorker.getRegistrations().then(registrations => {
console.log('Service Workers:', registrations);
});Automatically enabled for:
- Page views
- Performance metrics
- Web Vitals (LCP, FID, CLS)
- Error tracking
Access via:
- Vercel Dashboard → Deployments → [Your Deployment] → Build Logs
- GitHub Actions → Workflow runs → Build job
- Go to Deployments
- Find previous successful deployment
- Click ⋯ → Promote to Production
vercel rollback- Revert the commit:
git revert HEAD git push origin main
- Pipeline will auto-deploy the reverted version
Issue: Out of memory during build
# Solution: Increase Node.js memory
NODE_OPTIONS=--max-old-space-size=8192 pnpm buildIssue: pnpm version mismatch
# Solution: Use exact version
pnpm install -g pnpm@8.15.6Issue: SharedArrayBuffer not available
Solution: Verify COOP/COEP headers are set correctly
Issue: Service Worker registration failed
Solution: Ensure HTTPS is enabled and SW cache headers are correct
Issue: Vercel deployment timeout
# Solution: Increase function timeout in vercel.json
{
"functions": {
"maxDuration": 60
}
}- Lighthouse Score: 95+ (all categories)
- First Contentful Paint: < 1.5s
- Time to Interactive: < 3.5s
- Largest Contentful Paint: < 2.5s
- Cumulative Layout Shift: < 0.1
- ✅ Zero-downtime deployment
- ✅ Automatic HTTPS
- ✅ Global CDN distribution
- ✅ Immutable builds
- ✅ Instant rollback
- ✅ Preview deployments
- ✅ Environment isolation
- ✅ Security headers
- ✅ Performance optimization
- ✅ Error tracking
- ✅ Analytics integration
Status: ✅ Production Ready
Last Updated: 2026-01-29
Deployment Target: Vercel
Framework: Astro + WebContainer API