Vercel Deployment Guide
Overview
The CR8 monorepo has two Next.js applications that need separate Vercel deployments:
- DApp (
packages/dapp) - Blockchain interaction interface - Website (
packages/website) - Landing page and documentation
Deployment Steps
For DApp (packages/dapp)
- Go to Vercel Dashboard
- Click "Add New Project"
- Import your GitHub repository:
abhicris/CR8 - Configure the project:
- Framework Preset: Next.js
- Root Directory:
packages/dapp⚠️ IMPORTANT - Build Command: Leave as default (
npm run build) - Output Directory: Leave as default (
.next) - Install Command: Leave empty or set to
npm install(Vercel will handle it)
- Add Environment Variables:
NEXT_PUBLIC_CHAIN_ID=11155111(or your chain ID)NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID= Your WalletConnect project ID
- Click "Deploy"
For Website (packages/website)
- Go to Vercel Dashboard
- Click "Add New Project"
- Import the same GitHub repository:
abhicris/CR8 - Configure the project:
- Framework Preset: Next.js
- Root Directory:
packages/website⚠️ IMPORTANT - Build Command: Leave as default (
npm run build) - Output Directory:
out(for static export) - Install Command: Leave empty (Vercel will handle it)
- Click "Deploy"
Important: Root Directory Setting
The Root Directory setting is critical!
When you set Root Directory to packages/dapp or packages/website, Vercel will:
- Change to that directory
- Run
npm installin that directory - Run the build command from that directory
Since we're using npm workspaces, Vercel will automatically install all workspace dependencies when it runs npm install from the package directory (because it detects the workspace configuration).
Troubleshooting
Error: "Tracker 'idealTree' already exists"
This happens when npm install is run multiple times. Solution:
- Remove any custom Install Command from project settings
- Let Vercel use the default
npm install - Make sure Root Directory is set correctly
Error: "Cannot find module"
Solution:
- Ensure Root Directory is set to the correct package directory
- Vercel should automatically detect and install workspace dependencies
- Check that
package.jsonin the package directory has the correct dependencies
Build Fails
Solution:
- Check build logs in Vercel dashboard
- Verify Root Directory is set correctly
- Ensure all dependencies are listed in the package's
package.json - Check that npm workspaces are configured in root
package.json
Vercel Configuration Files
The vercel.json files in each package are minimal and let Vercel auto-detect settings:
packages/dapp/vercel.json- DApp configurationpackages/website/vercel.json- Website configuration
Note: The Root Directory must be set in Vercel Dashboard project settings, not in vercel.json.
Environment Variables
DApp Environment Variables
Set these in Vercel Dashboard → Project Settings → Environment Variables:
NEXT_PUBLIC_CHAIN_ID- Blockchain network ID (e.g.,11155111for Sepolia)NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID- WalletConnect project ID
Website Environment Variables
No environment variables needed for the website (static site).
How Vercel Handles Monorepos
When Root Directory is set to a subdirectory:
- Vercel changes to that directory
- Runs
npm install- npm detects the workspace and installs from root - Runs the build command from that directory
- Uses the specified output directory
This works because npm workspaces automatically hoist dependencies and link packages.
Custom Domains
After deployment, you can add custom domains:
- Go to Project Settings → Domains
- Add your custom domain
- Follow DNS configuration instructions
Automatic Deployments
Vercel automatically deploys when you push to:
mainbranch → Production- Other branches → Preview deployments
Preview Deployments
Every pull request gets a preview deployment URL automatically.
Support
For issues:
- Check Vercel build logs
- Verify Root Directory is set correctly in project settings
- Ensure npm workspace configuration is correct
- Check that package.json files are valid