← Back to blog
·3 min read·CI/CD

Vercel + GitLab: CI/CD for Next.js Portfolios

Combine GitLab for source control and optional CI checks with Vercel for zero-config Next.js deployment.

For personal sites and portfolios, Vercel + GitLab is a pragmatic split: GitLab owns the repo and quality gates; Vercel owns build and edge deployment for Next.js.

Workflow Diagram

Responsibility Split

LayerGitLabVercel
Git hosting
MR / code review
Lint & test CI
Next.js optimized build
CDN + SSL
Preview per branch

Avoid double deploy

Use GitLab CI for validation only (npm run lint, npm run build). Let Vercel handle production deploy — do not run two deploy pipelines to different platforms.

GitLab CI (validate only)

image: node:20 stages: - test cache: key: files: - package-lock.json paths: - node_modules/ before_script: - npm ci lint: stage: test script: - npm run lint build: stage: test script: - npm run build rules: - if: $CI_COMMIT_BRANCH == "dev"

Vercel Configuration

SettingValue
Production branchdev or main
Build commandnpm run build
FrameworkNext.js (auto-detected)
EnvNEXT_PUBLIC_SITE_URL

Sequence: Push to Production

How to Draw Diagrams in MDX

This blog uses Mermaid via the <Mermaid> component. Paste diagram code inside a template literal:

<Mermaid chartId="mermaid-2" />

Rendered result:

Syntax tips

Wrap diagram code in a template literal inside the Mermaid component. Curly braces like decision nodes {ok?} are safe inside backticks. Types: flowchart, sequenceDiagram, stateDiagram, and more.

When This Pattern Fits

  • Personal blogs and portfolio sites
  • Next.js App Router with MDX
  • Small teams without Kubernetes overhead
  • Need preview URLs for stakeholders

Conclusion

GitLab + Vercel gives you professional CI discipline without operating your own deployment platform. Keep CI fast, let Vercel specialize in Next.js delivery.

Related Articles