WabTechs
AccueilBlogDocumentationProjetsPodcastVidéosCommunauté
ConnexionS'inscrire
DocumentationDéploiement

Déploiement

Déployez votre application Next.js sur Vercel, Docker ou votre propre serveur — guide complet de mise en production.

Getting StartedArchitectureAPI ReferenceBase de donnéesAuthentificationMiddleware et ProxyGuidesDéploiementTesting

Vercel (Recommandé)

Vercel est la plateforme de déploiement recommandée pour Next.js.

Configuration

# Installer la CLI
npm install -g vercel

# Déployer
vercel

# Déployer en production
vercel --prod

Variables d'Environnement

# Via la CLI
vercel env add DATABASE_URL
vercel env add NEXTAUTH_SECRET
vercel env add NEXTAUTH_URL

Configuration du Projet

// vercel.json
{
  "buildCommand": "npx prisma generate && npx next build",
  "framework": "nextjs",
  "regions": ["iad1"]
}

GitHub Integration

  1. Connectez votre repo GitHub sur vercel.com
  2. Chaque push sur main déclenche un déploiement
  3. Les PRs génèrent des previews automatiques

Docker

Dockerfile Multi-Stage

FROM node:20-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci

FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build

FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs
EXPOSE 3000
CMD ["node", "server.js"]

next.config.ts

const nextConfig = {
  output: "standalone",
};

Docker Compose

services:
  app:
    build: .
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=${DATABASE_URL}
      - NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
      - NEXTAUTH_URL=${NEXTAUTH_URL}
    depends_on:
      db:
        condition: service_healthy

  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_DB: app
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready"]
      interval: 5s

volumes:
  pgdata:

VPS (Vultr, DigitalOcean, etc.)

Setup

# Installer Docker
curl -fsSL https://get.docker.com | sh

# Cloner le repo
git clone https://github.com/username/project.git
cd project

# Configurer les variables
cp .env.example .env
nano .env

# Lancer
docker compose -f docker-compose.prod.yml up -d

Nginx Reverse Proxy

server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

SSL avec Certbot

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com

CI/CD

GitHub Actions

# .github/workflows/deploy.yml
name: Deploy

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - run: npm ci
      - run: npm run lint
      - run: npm run typecheck
      - run: npm run build
      - run: npx prisma migrate deploy
        env:
          DATABASE_URL: ${{ secrets.DATABASE_URL }}
      - uses: amondnet/vercel-action@v25
        with:
          vercel-token: ${{ secrets.VERCEL_TOKEN }}
          vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
          vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
          vercel-args: '--prod'

Checklist de Production

  • [ ] Variables d'Environnement configurées
  • [ ] Base de données connectée
  • [ ] Migrations appliquées
  • [ ] HTTPS activé
  • [ ] Headers de sécurité configurés
  • [ ] Monitoring en place
  • [ ] Backups automatiques
  • [ ] Logs configurés
  • [ ] Performance vérifiée (Lighthouse > 90)

Sur cette page

  • Vercel (Recommandé)
  • Configuration
  • Installer la CLI
  • Déployer
  • Déployer en production
  • Variables d'Environnement
  • Via la CLI
  • Configuration du Projet
  • GitHub Integration
  • Docker
  • Dockerfile Multi-Stage
  • next.config.ts
  • Docker Compose
  • VPS (Vultr, DigitalOcean, etc.)
  • Setup
  • Installer Docker
  • Cloner le repo
  • Configurer les variables
  • Lancer
  • Nginx Reverse Proxy
  • SSL avec Certbot
  • CI/CD
  • GitHub Actions
  • .github/workflows/deploy.yml
  • Checklist de Production
WabTechs
Quick Link
  • Service
  • Projects
  • Pricing
  • FAQs
  • Contact
Adresse
  • n° 27 bis Katakombe 2 Ngalima Kinshasa RDC
  • contact@wabtechs.com
  • +243 850 060 060

Copyright ©2026, Wabtechs Company All Rights Reserved

GitHubTwitterYouTubeLinkedIn