Overview
Shipr is optimized for deployment on Vercel with Convex as the backend. This guide covers deploying your Next.js application, setting up Convex, and configuring all required services.Vercel Deployment
Import to Vercel
- Go to vercel.com/new
- Import your GitHub repository
- Vercel will auto-detect Next.js configuration
Configure Environment Variables
Add all required environment variables in the Vercel dashboard under Settings → Environment Variables.See the Environment Variables page for a complete reference.Required variables:
NEXT_PUBLIC_SITE_URLNEXT_PUBLIC_CONVEX_URLNEXT_PUBLIC_CLERK_PUBLISHABLE_KEYCLERK_SECRET_KEYCLERK_JWT_ISSUER_DOMAINAI_GATEWAY_API_KEYRESEND_API_KEY
Build Settings
Vercel should auto-detect these settings, but verify:- Framework: Next.js
- Build Command:
pnpm build - Output Directory:
.next - Install Command:
pnpm install
Convex Deployment
Convex serves as your backend database and real-time sync layer.Sync Schema Locally
Run Convex in development mode to sync your schema:This creates your development Convex deployment and syncs your schema from the
convex/ directory.Deploy to Production
Deploy your Convex functions to production:This creates a production deployment and provides your
NEXT_PUBLIC_CONVEX_URL.Configure Clerk Authentication
- Go to the Convex Dashboard
- Navigate to your production deployment
- Go to Settings → Authentication
- Add
CLERK_JWT_ISSUER_DOMAINfrom your Clerk dashboard
Service Configuration
Clerk
Create Clerk Application
- Sign up at clerk.com
- Create a new application
- Choose your authentication methods (email, social, etc.)
Copy API Keys
Copy these values to your environment variables:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYCLERK_SECRET_KEYCLERK_JWT_ISSUER_DOMAIN
Resend
Create Resend Account
Sign up at resend.com
Configure API Key
- Generate an API key in the Resend dashboard
- Add
RESEND_API_KEYto your environment variables - Set
RESEND_FROM_EMAILto your verified sender address (e.g.,[email protected])
[email protected] which only works in sandbox mode.src/lib/emails/send.ts and available via POST /api/email.
Sentry (Optional)
Create Sentry Project
- Sign up at sentry.io
- Create a new Next.js project
@sentry/nextjs. Error tracking helpers are available in src/lib/sentry.ts.
PostHog (Optional)
Create PostHog Project
Sign up at posthog.com and create a project.
next.config.ts) to bypass ad blockers.
Production Considerations
Environment Variables
Ensure all production URLs are correctly set:NEXT_PUBLIC_SITE_URLshould match your production domainNEXT_PUBLIC_CONVEX_URLshould point to your production Convex deployment- All secret keys should be different from development
Rate Limiting
Configure rate limits for production usage:AI_CHAT_RATE_LIMIT_MAX_REQUESTS- chat requests per windowAI_CHAT_RATE_LIMIT_WINDOW_MS- rate limit window durationFILE_IMAGE_UPLOAD_RATE_LIMIT_MAX_UPLOADS- image uploads per window
AI Chat Limits
Set appropriate limits for your SaaS:AI_CHAT_ENFORCE_LIFETIME_MESSAGE_LIMIT- enable message capsAI_CHAT_LIFETIME_MESSAGE_LIMIT- total messages per userAI_CHAT_HISTORY_MAX_THREADS- max chat threads per user
Build Output
Vercel automatically builds your Next.js application. Monitor build logs for:- TypeScript errors
- Missing environment variables
- Build warnings
- Bundle size issues
Domain Configuration
- Add your custom domain in Vercel dashboard
- Update DNS records as instructed
- Update
NEXT_PUBLIC_SITE_URLto match your domain - Redeploy to regenerate metadata and sitemaps