- Before:
prisma generateran in bothpostinstallscript ANDbuildscript - After:
prisma generateonly runs once during the install phase (vianixpacks.toml) - Impact: Saves ~10-20 seconds per deployment
- Before:
prisma db pushran on every app start/restart (slow database operation) - After: Start command only runs
next start(fast) - Impact: Saves 30-60 seconds on every restart/deployment
- Created
nixpacks.tomlto optimize build caching - Uses
npm ciinstead ofnpm installfor faster, reproducible installs - Explicitly sets Node.js version for consistency
- Impact: Better caching, faster installs
- Excludes unnecessary files from upload (node_modules, .next, etc.)
- Impact: Faster upload times
Note: prisma db push syncs your database schema with your Prisma schema file - it's not for data migration. Since Railway is your main/production database, you only need to run this when you change your Prisma schema.
When to run: Only when you modify prisma/schema.prisma (add/remove models, change fields, etc.)
railway run npm run railway:deploy- Go to your Railway project
- Open the service
- Click "Deployments" → "Latest" → "View Logs"
- Use the "Run Command" feature to execute:
npm run railway:deploy
Why this is better: Running prisma db push on every deployment was slow and unnecessary. Now it only runs when you explicitly need to update the schema.
- Build time: Reduced by ~20-30 seconds (removed redundant Prisma generation)
- Start time: Reduced by ~30-60 seconds (removed db push from start)
- Total deployment: Should now take 1-2 minutes instead of 3+ minutes
- Push these changes to your repository
- Railway will automatically trigger a new deployment
- Monitor the build logs to see the improved times
- Your app will start faster since it's not running
prisma db pushon every start - Only run
prisma db pushmanually when you modify your Prisma schema:railway run npm run railway:deploy
- The
railway:deployscript runsprisma db push --skip-generate(skips generation since it's already done) - For local development, migrations still work the same way
- The
postinstallscript was removed to avoid double generation