Next.js Project Setup Guide 2025: From Initialization to Deployment

Next.jsWeb DevelopmentFrontend
Shubhanshu
β€’β€’10 min read
Next.js Project Setup Guide 2025: From Initialization to Deployment

Next.js Project Setup Guide 2025: From Initialization to Deployment

Next.js 15 has introduced powerful features that make building modern web apps easier than ever. Whether you're new to Next.js or upgrading from an older version, this guide will help you set up your project with modern tooling like TypeScript, Tailwind CSS, ESLint, and deploy it with ease.

πŸ›  Prerequisites

  • Node.js v18 or later
  • npm / yarn / pnpm
  • Basic understanding of React

πŸš€ Initialize a New Project

Run this command to scaffold a new project:

npx create-next-app@latest my-next-app

Choose the following options:

  • Yes to TypeScript
  • Yes to Tailwind CSS
  • Yes to App Router
  • Yes to ESLint and src/ directory

πŸ“ Project Structure

Your app will have this structure:

  • /app – App Router pages and layouts
  • /components – Reusable components
  • /public – Static assets
  • /styles – Global CSS
  • tailwind.config.ts, tsconfig.json, etc. – Config files

πŸ’¨ Tailwind CSS

Already configured if you selected it, but here’s the manual setup:

npm install -D tailwindcss postcss autoprefixer
  npx tailwindcss init -p

Update tailwind.config.ts:

content: [
    "./app/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}"
  ]

And import Tailwind in globals.css:

@tailwind base;
  @tailwind components;
  @tailwind utilities;

πŸ” ESLint & Prettier

For clean code and consistency:

npm install -D eslint prettier eslint-config-prettier eslint-plugin-prettier

Create .eslintrc.json:

{
    "extends": ["next/core-web-vitals", "plugin:prettier/recommended"]
  }

And a simple .prettierrc:

{
    "semi": true,
    "singleQuote": true
  }

βš™οΈ Adding Environment Variables

Use .env.local for private keys:

NEXT_PUBLIC_API_URL=https://api.example.com

Access them via process.env.NEXT_PUBLIC_API_URL.

πŸ“¦ Useful Scripts

"scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  }

🌐 Deployment

You can deploy your app to:

  • Vercel: Official and best for Next.js
  • Netlify: Great support via adapters
  • Docker: For containerized deployment

To deploy on Vercel:

  1. Push code to GitHub
  2. Go to vercel.com and import repo
  3. Set environment variables and click "Deploy"

βœ… Final Thoughts

Setting up a modern Next.js project in 2025 is simpler than ever. With features like the App Router, integrated Tailwind CSS, and first-class TypeScript support, you're ready to build high-performance applications out of the box.

Follow these best practices and start deploying your ideas faster with a clean, scalable, and maintainable codebase.