Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/0xchriswilder/journey/llms.txt

Use this file to discover all available pages before exploring further.

This guide covers how to build and deploy the FHEVM Developer Bootcamp platform to production hosting services.

Overview

The bootcamp is a static single-page application (SPA) built with Vite, React, and TypeScript. It can be deployed to any static hosting service including Netlify, Vercel, GitHub Pages, or AWS S3.
The entire application runs client-side with no backend required. All student progress is stored locally using Zustand with localStorage persistence.

Prerequisites

Before deploying, ensure you have:
  • Node.js 18+ installed
  • npm or bun package manager
  • Git repository with the bootcamp source code
  • Account on your chosen hosting platform

Build Process

Development Build

1

Install Dependencies

Install all required packages:
npm install
Or with bun:
bun install
2

Run Development Server

Start the local development server:
npm run dev
The app will be available at http://localhost:8080.
The dev server is configured in vite.config.ts to run on port 8080 with IPv6 support (host: "::")
3

Test Locally

Verify all features work:
  • Navigation through curriculum
  • Progress tracking persistence
  • Quiz functionality
  • Instructor mode toggle
  • Dark mode theme switching
  • Internationalization (language switcher)

Production Build

1

Configure Environment Variables

Create a .env file based on .env.example:
.env
# Network Configuration
VITE_RPC_URL=https://devnet.zama.ai
VITE_CHAIN_ID=8009
VITE_NETWORK_NAME=Zama Devnet

# Contract Addresses
VITE_CONTRACT_ADDRESS=0x0000000000000000000000000000000000000000
VITE_USE_MOCKS=true

# UI Configuration
VITE_COMICY_FONT_URL=https://example.com/path/to/comicy.ttf

# App Metadata
VITE_APP_NAME=FHEVM Developer Bootcamp
VITE_APP_DESCRIPTION=Learn to build confidential applications on Zama Protocol
VITE_GITHUB_REPO=https://github.com/zama-ai/fhevm-bootcamp
All environment variables must be prefixed with VITE_ to be accessible in the frontend.
2

Build for Production

Create an optimized production build:
npm run build
This compiles TypeScript, bundles assets, and outputs to the dist/ directory.Build configuration in vite.config.ts:
  • React SWC plugin for fast compilation
  • Node.js polyfills for crypto libraries
  • Path aliases (@./src)
  • Global shims for Buffer, process, global
3

Build Slides (Optional)

If you’re using the Marp presentation slides:
npm run build:slides
This converts Markdown slides in public/slides/ to HTML using Marp CLI.
4

Preview Production Build

Test the production build locally:
npm run preview
This serves the dist/ folder to verify the build works correctly.

Deployment Options

Option 1: Netlify

1

Install Netlify CLI

npm install -g netlify-cli
2

Login to Netlify

netlify login
3

Initialize Site

netlify init
Follow the prompts to:
  • Create a new site or link to existing
  • Set build command: npm run build
  • Set publish directory: dist
4

Deploy

netlify deploy --prod

Option 2: Vercel

1

Install Vercel CLI

npm install -g vercel
2

Login and Deploy

vercel
Follow the prompts. Vercel auto-detects Vite and configures correctly.
3

Set Environment Variables

vercel env add VITE_RPC_URL
vercel env add VITE_CHAIN_ID
# ... add all VITE_* variables
Or configure in the Vercel dashboard under Settings → Environment Variables.
4

Production Deployment

vercel --prod

Option 3: GitHub Pages

1

Update vite.config.ts

Add the base path for your repository:
vite.config.ts
export default defineConfig({
  base: '/fhevm-bootcamp/', // Replace with your repo name
  // ... rest of config
});
2

Install gh-pages

npm install --save-dev gh-pages
3

Add Deploy Script

In package.json:
package.json
{
  "scripts": {
    "deploy": "npm run build && gh-pages -d dist"
  }
}
4

Deploy

npm run deploy
This builds and pushes the dist/ folder to the gh-pages branch.
5

Enable GitHub Pages

In your repository:
  1. Go to Settings → Pages
  2. Set source to gh-pages branch
  3. Save
Your site will be available at https://<username>.github.io/<repo>/

Option 4: AWS S3 + CloudFront

1

Create S3 Bucket

aws s3 mb s3://fhevm-bootcamp
aws s3 website s3://fhevm-bootcamp --index-document index.html --error-document index.html
2

Upload Build

npm run build
aws s3 sync dist/ s3://fhevm-bootcamp --delete
3

Configure CloudFront (Optional)

For HTTPS and CDN:
  1. Create CloudFront distribution
  2. Set origin to S3 bucket
  3. Configure custom error response: 404 → 200 → /index.html (for SPA routing)
  4. Add SSL certificate via ACM

Environment Variables Reference

All environment variables used in the bootcamp platform:
VITE_RPC_URL
string
required
RPC endpoint for blockchain connections (e.g., https://devnet.zama.ai)
VITE_CHAIN_ID
number
required
Chain ID for the network (e.g., 8009 for Zama Devnet)
VITE_NETWORK_NAME
string
required
Display name for the network (e.g., "Zama Devnet")
VITE_CONTRACT_ADDRESS
string
Default contract address for demos. Use 0x0000... for mock mode.
VITE_USE_MOCKS
boolean
default:"true"
Enable mock contract interactions for testing without blockchain
VITE_COMICY_FONT_URL
string
URL to custom Comicy font file (optional)
VITE_APP_NAME
string
default:"FHEVM Developer Bootcamp"
Application name displayed in title and meta tags
VITE_APP_DESCRIPTION
string
SEO description for the bootcamp
VITE_GITHUB_REPO
string
GitHub repository URL for “View Source” links

Build Optimization

Bundle Size Analysis

Analyze your build size:
npm run build -- --mode analyze
Or use rollup-plugin-visualizer by adding to vite.config.ts:
import { visualizer } from 'rollup-plugin-visualizer';

export default defineConfig({
  plugins: [
    // ... existing plugins
    visualizer({ open: true })
  ]
});

Performance Tips

The bootcamp already uses React Router lazy loading for pages. Further split large components:
const ContractExplorer = lazy(() => import('@/components/lesson/ContractExplorer'));
  • Compress images before adding to public/
  • Use WebP format for better compression
  • Serve fonts from CDN (already configured for Telegraf)
Configure cache headers in your hosting:Netlify (netlify.toml):
[[headers]]
  for = "/assets/*"
  [headers.values]
    Cache-Control = "public, max-age=31536000, immutable"
Vercel (vercel.json):
{
  "headers": [
    {
      "source": "/assets/(.*)",
      "headers": [
        {
          "key": "Cache-Control",
          "value": "public, max-age=31536000, immutable"
        }
      ]
    }
  ]
}

Continuous Deployment

Automated Deploys with Git

Most platforms support automatic deployment on git push:
1

Connect Repository

Link your Git repository in the hosting dashboard
2

Configure Branch

Set production branch (usually main or master)
3

Enable Auto-Deploy

Every push to the production branch triggers a build and deploy
4

Preview Deploys (Optional)

Enable preview deployments for pull requests to test changes before merging

GitHub Actions Example

.github/workflows/deploy.yml
name: Deploy to Production

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '18'
          cache: 'npm'
      
      - name: Install dependencies
        run: npm ci
      
      - name: Build
        run: npm run build
        env:
          VITE_RPC_URL: ${{ secrets.VITE_RPC_URL }}
          VITE_CHAIN_ID: ${{ secrets.VITE_CHAIN_ID }}
          VITE_NETWORK_NAME: ${{ secrets.VITE_NETWORK_NAME }}
      
      - name: Deploy to Netlify
        uses: nwtgck/actions-netlify@v2
        with:
          publish-dir: './dist'
          production-deploy: true
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

Troubleshooting

Problem: Refreshing any route except / returns 404.Solution: Ensure your hosting is configured for SPA routing:
  • Netlify: Check public/_redirects exists with /* /index.html 200
  • Vercel: Add vercel.json with rewrites configuration
  • GitHub Pages: Use hash router or configure 404.html
Problem: import.meta.env.VITE_* is undefined.Solution:
  1. Ensure variables are prefixed with VITE_
  2. Rebuild after changing .env
  3. For hosting platforms, set variables in the dashboard
  4. Check variables are set in build environment, not just runtime
Problem: Build size is too large.Solution:
  1. Check for duplicate dependencies: npm dedupe
  2. Analyze bundle: npm run build -- --mode analyze
  3. Remove unused Radix UI components
  4. Use dynamic imports for heavy components
Problem: Build succeeds locally but fails on hosting.Solution:
  1. Check Node.js version matches (18+)
  2. Ensure lock file is committed (package-lock.json)
  3. Check build logs for missing environment variables
  4. Try npm ci instead of npm install locally

Custom Domain Setup

After deploying, configure a custom domain:
  1. Go to Site settings → Domain management
  2. Click “Add custom domain”
  3. Follow DNS configuration instructions
  4. Netlify auto-provisions SSL via Let’s Encrypt

Monitoring and Analytics

Add Analytics

Integrate analytics in index.html:
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>
Or use Plausible for privacy-friendly analytics:
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>

Error Monitoring

Add Sentry for error tracking:
npm install @sentry/react
src/main.tsx
import * as Sentry from "@sentry/react";

Sentry.init({
  dsn: "YOUR_SENTRY_DSN",
  environment: import.meta.env.MODE,
});

Next Steps

After deployment:
  1. Customize branding and content
  2. Set up instructor access
  3. Review the student experience
  4. Monitor analytics and user feedback

Need Help?

Open an issue on GitHub for deployment support