The convex/_generated folder is gitignored, so it needs to be generated during the build process.
-
In Vercel Dashboard:
- Set Root Directory to:
dillydally-frontend(in Project Settings → General) - This allows Vercel to see the parent
convexfolder during build
- Set Root Directory to:
-
Environment Variables:
- Add
VITE_CONVEX_URLwith your Convex deployment URL (required for runtime) - Add
CONVEX_URLwith your Convex deployment URL (required forconvex codegenduring build) - You can find this in your
.env.localfile or Convex dashboard
- Add
-
Build Process:
- The build command will:
- Install root dependencies (including
convexCLI) - Run
npx convex codegento generate types from schema - Copy
convex/_generatedtodillydally-frontend/src/lib/convex-generated - Build the Vite app
- Install root dependencies (including
- The build command will:
-
Deploy Convex first (if not already deployed):
npx convex deploy
-
Get your Convex URL:
- Check
.env.localfile:CONVEX_URL=... - Or find it in the Convex dashboard
- Check
Run from the monorepo root:
npm run devOr individually:
# Terminal 1: Convex (generates _generated folder)
npx convex dev
# Terminal 2: Frontend
cd dillydally-frontend
npm run devThe Express server uses the same approach:
-
Build Process:
npm run buildautomatically runscopy-convexfirst- This copies
convex/_generatedtosrc/lib/convex-generated
-
Environment Variables:
- Set
CONVEX_URLin your deployment platform - Ensure
.env.localis not committed (it's in.gitignore)
- Set
-
Deployment Platforms:
- Railway: Set root directory to
dillydally-express - Render: Set root directory to
dillydally-express - Heroku: Use a
Procfilethat runsnpm run build && npm start
- Railway: Set root directory to
Issue: convex/_generated not found during build
- Solution: The build process now runs
npx convex codegenautomatically - Make sure
CONVEX_URLenvironment variable is set in Vercel - Ensure the
convexfolder exists in the repository
Issue: convex codegen fails during build
- Solution: Make sure
CONVEX_URLis set in Vercel environment variables - The
convexpackage must be installed (handled by installCommand) - Check that the
convex/schema.tsfile exists and is valid
Issue: Import errors in TypeScript
- Solution: The copy script runs before TypeScript compilation, so this should resolve after the first successful build
- If errors persist, check that the copy script completed successfully
Issue: Vercel can't find convex folder
- Solution: Ensure Root Directory is set to
dillydally-frontendin Vercel settings - This allows Vercel to access the parent
convexfolder during build