Skip to content

🚀 6. Deployment

Guide to deploying TaskNexus to production.

Since this is a Next.js application with a PostgreSQL database, we recommend:

  1. Vercel: Best for Next.js frontend/backend hosting.
  2. Railway / Render: Good for hosting both the App and the Database.
  3. Supabase / Neon: Excellent managed PostgreSQL databases.

📦 Build Process

The package.json build script is:

"build": "prisma generate && next build"
It is CRITICAL that prisma generate runs before next build, because Next.js needs the generated Prisma client to compile the pages.

Steps for Vercel

  1. Connect your GitHub Repository.
  2. Environment Variables: Add all variables from your .env.
    • DATABASE_URL
    • GEMINI_API_KEY
    • NODE_ENV = production
    • SESSION_SECRET
  3. Build Command: Default (next build) is usually fine, but ensure the "Install Command" runs npm install.
    • Override Build Command (if needed): npx prisma generate && next build
  4. Deploy.

⚠️ Important Considerations

  1. Database Connection Pooling:

    • Serverless functions (like Vercel) can exhaust database connections.
    • Use a Connection Pooler (like Supabase Transaction Pooler or Neon Pooling).
    • Update your DATABASE_URL to the pooled connection string.
  2. Cold Starts:

    • First request might be slow as the lambda wakes up and connects to the DB.
    • This is normal for serverless.
  3. Timeouts:

    • AI generation can take 10-30 seconds.
    • Vercel Free Tier has a 10s timeout limit on Server Functions.
    • Solution: Upgrade to Pro (60s limit) OR optimize AI prompts to be shorter.

Next: Troubleshooting & FAQ ➡️