Build & Deployment Guide
Complete guide to building and deploying the Cascadia Marquee website
Build & Deployment Guide
Complete guide to building and deploying the Cascadia Marquee website.
Development Commands
Core Development Commands
Content and registry commands
MDX content is processed by Content Collections automatically when you run pnpm dev or pnpm build (no separate content build script).
Code Quality Commands
Build Process
Development Build
The development server (pnpm dev) starts Next.js with Turbopack. Content Collections compiles MDX when Next starts (via withContentCollections in next.config.ts).
Use pnpm dev:webpack if you need the Webpack dev server instead of Turbopack.
Production Build
The production build (pnpm build) runs:
- Registry generation -
pnpm build:registry - Navigation generation -
pnpm build:navigation - Next.js build -
pnpm build:next(Content Collections processes MDX as part of this step) - Static generation - Pre-renders pages where
generateStaticParamsis defined
Build Output
The build process generates:
Content Processing
Content Collections build
When Next.js starts or builds, @content-collections/next:
- Scans
src/content/**per collection incontent-collections.ts - Validates front matter with Zod schemas
- Compiles MDX (remark/rehype pipeline, Shiki, custom plugins)
- Writes typed exports to
.content-collections/generated - Exposes
allDocs,allPosts,allLegalDocs,allServicesvia thecontent-collectionsimport
MDX processing pipeline
Configuration lives in content-collections.ts and src/lib/content/compile-mdx-for-collections.ts:
Pages render compiled MDX with <Mdx code={doc.mdx} /> and use doc.content for table-of-contents and plain-text exports.
Component Registry Build
The registry build process:
- Scans component directories (charts, examples)
- Generates lazy-loaded imports for each component
- Creates registry index with component metadata
- Enables dynamic component loading
Deployment
Vercel Deployment (Recommended)
The site is configured for automatic deployment on Vercel:
Automatic Deployment
- Main branch → Production deployment
- Pull requests → Preview deployments
- Environment variables configured in Vercel dashboard
Vercel Configuration
Environment Variables
Configure these in Vercel dashboard:
Manual Deployment
Build Locally
Deploy to Other Platforms
Netlify:
Railway:
Docker:
Performance Optimization
Build Optimizations
Next.js Optimizations
Content Optimization
- MDX processing with syntax highlighting
- Image optimization with next/image
- Font optimization with next/font
- Code splitting for better performance
Runtime Optimizations
Static Generation
Dynamic Imports
Image Optimization
Monitoring & Analytics
Google Analytics 4
GA4 loads from src/components/analytics/google-analytics.tsx after the visitor accepts Analytics cookies. Configure NEXT_PUBLIC_GA_MEASUREMENT_ID (and optionally Clarity) in your deployment environment.
For events, consent gating, and GA4 setup, see the Analytics & Tracking guide.
Error Monitoring
Error Boundaries
Security
Environment Variables
- Never commit
.env.localto version control - Use Vercel dashboard for production environment variables
- Rotate keys regularly for security
- Use least privilege for API permissions
Content Security Policy
API Security
Troubleshooting
Build Issues
"Module not found" errors:
Content not building:
Type errors:
Deployment Issues
Environment variables not working:
- Check Vercel dashboard configuration
- Verify variable names match exactly
- Ensure no extra spaces or quotes
Build failing on Vercel:
- Check build logs in Vercel dashboard
- Verify Node.js version compatibility
- Check for memory limits
Images not loading:
- Verify image paths are correct
- Check next/image configuration
- Ensure images are in public directory
Performance Issues
Slow build times:
- Use
--turboflag for development - Check for unnecessary dependencies
- Optimize content processing
Large bundle sizes:
- Use dynamic imports for heavy components
- Analyze bundle with
@next/bundle-analyzer - Remove unused dependencies
Best Practices
Development
- Use development commands for local development
- Test builds locally before deploying
- Keep dependencies updated regularly
- Monitor build performance and optimize as needed
Deployment
- Use automatic deployments for consistency
- Test preview deployments before merging
- Monitor production performance with analytics
- Keep environment variables secure and up-to-date
Maintenance
- Regular security updates for dependencies
- Monitor error rates and performance metrics
- Backup content and configuration
- Document deployment procedures for team members
For questions about build and deployment, check the other documentation sections or contact the development team.