Setup & Deployment
This skill covers the complete setup, configuration, and deployment workflow for Next.js applications with Prisma ORM, Capacitor mobile apps, and production hosting.
Setup Script
The interactive setup script (setup.ps1) provides a menu-driven workflow:
# Run the setup wizard
.\setup.ps1
# Or run specific steps manually
npm install # Install all dependencies
npx prisma generate # Generate Prisma client
npx prisma db push # Push schema to database (dev)
npx prisma migrate deploy # Run migrations (prod)
npm run build # Production build
npx cap sync # Sync Capacitor projects
Database Setup
Option 1: Docker (Local Development)
docker-compose up -d
# Database available at: postgresql://postgres:postgres@localhost:5432/massage_connect
Option 2: Supabase (Recommended for Production)
- Create project at https://supabase.com/dashboard
- Copy connection string from Settings > Database
- Update
.env.local:
DATABASE_URL="postgresql://postgres.[PROJECT_REF]:[PASSWORD]@aws-0-[REGION].pooler.supabase.com:5432/postgres"
Option 3: Neon
- Create project at https://neon.tech
- Copy connection string
- Update
.env.local
Environment Configuration
Create .env.local from template:
cp .env.example .env.local
Required variables:
DATABASE_URL="postgresql://..."
JWT_SECRET="your-random-secret-min-32-chars"
JWT_EXPIRES_IN="7d"
REFRESH_TOKEN_SECRET="your-random-refresh-secret"
REFRESH_TOKEN_EXPIRES_IN="30d"
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..."
RESEND_API_KEY="re_..."
NEXT_PUBLIC_APP_URL="https://yourdomain.com"
NODE_ENV="production"
Deployment Options
Vercel (Recommended for Next.js)
// vercel.json
{
"buildCommand": "npm run build",
"devCommand": "npm run dev",
"installCommand": "npm install",
"framework": "nextjs",
"outputDirectory": ".next",
"regions": ["iad1", "sfo1", "fra1", "syd1"],
"crons": [
{
"path": "/api/system/cron",
"schedule": "0 2 * * *"
}
]
}
Deploy:
npx vercel --prod
Docker
docker-compose up -d --build
Self-Hosted
npm run build
npm start
# Requires: Node.js 18+, PostgreSQL
Mobile App Setup
Android
npm install @capacitor/android
npx cap add android
npx cap sync
npx cap open android # Opens in Android Studio
iOS
npm install @capacitor/ios
npx cap add ios
npx cap sync
npx cap open ios # Opens in Xcode
Build Release
# Build web assets
npm run build
# Sync to native projects
npx cap sync
# Generate icons
node scripts/generate-icons.js
# Build Android AAB
npx cap build android
# Build iOS
npx cap build ios
Pre-Production Checklist
Security
Performance
Monitoring
App Store
Post-Deployment
- Run database migrations:
npx prisma migrate deploy
- Verify health check:
curl https://yourdomain.com/api/health
-
Test critical flows:
- Registration
- Login
- Booking
- Payment
-
Set up monitoring alerts
-
Configure backup strategy
-
Document operational procedures