Next.jsIntermediate
Deployment
Vercel ও অন্যান্য platform-এ Next.js deploy — production deployment বাংলায়।
11টি অংশবাংলা ভাষায়
Next.js deploy-এর জনপ্রিয় উপায় Vercel (Next.js-এর creator)। এছাড়া যেকোনো Node.js platform বা static host-এও deploy করা যায়।
Vercel-এ Deploy
- GitHub/GitLab/Bitbucket-এ কোড push করুন
- vercel.com-এ যান ও repository import করুন
- Build config স্বয়ংক্রিয় detect হয়
- Deploy complete — environment variables সেট করা যায়
Vercel pst
Vercel CLI দিয়েও deploy সম্ভব: npm i -g vercel → vercel। প্রতিটি git push-এ auto-deploy হয় (Preview/Production)।
Static Export
শুধু static content-এর জন্য (dynamic API ছাড়া) static export ব্যবহার করা যায় — যেকোনো static host (Netlify, S3, Nginx)-এ hosting।
next.config.tsts
ts
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
output: "export",
};
export default nextConfig;এতে next build একটি out/ ফোল্ডার তৈরি করে — pure HTML/CSS/JS, server প্রয়োজন হয় না। তবে Route Handlers, Server Actions ইত্যাদি তখন ব্যবহার করা যায় না।
Deployment-এর আগে যাচাই
npm run buildসফল হয় কি না- Environment variables
.env.production-এ সেট করা - Secrets-এ
NEXT_PUBLIC_prefix নেই নিশ্চিত করুন - Lighthouse-এ performance test দিন
Static Export-এ সীমাবদ্ধতা
Static export-এ dynamic routes, cookies/headers, Server Actions — এগুলো work করে না। Dynamic feature দরকার হলে full Node.js deployment নিন।
শেষ প্যারায় নিজে practice করুন — কোড কপি করে নিজের এডিটরে চালিয়ে দেখুন।