Back to Blog
EngineeringMar 28, 2026·10 min read·Ribbsaeter Systems Engineering

Migrating from Laravel to Next.js: A Practical Guide for Growing Teams

When and how to migrate a Laravel monolith to Next.js — covering the strangler-fig pattern, API extraction, authentication migration, database considerations and the cases where staying on Laravel is the right call.

Key takeaways

  • 01Migrate when your frontend needs outgrow Blade, your team is moving to TypeScript, or you need edge/static deployment. Not because Next.js is 'newer'.
  • 02Use the strangler-fig pattern: extract a Laravel API, build Next.js routes against it, migrate incrementally.
  • 03Keep Laravel as the API layer during migration. Eloquent ORM, queues and scheduled jobs are hard to replace and do not need to be.
  • 04Authentication migration is the hardest part. Plan for a shared session period where both systems accept the same auth tokens.
  • 05Some applications should stay on Laravel. If Blade + Livewire meets your UI needs and your team is productive, migration has negative ROI.

Laravel is an excellent framework — we have shipped dozens of production systems on it and continue to maintain several. But there are well-defined inflection points where a Laravel monolith benefits from a frontend migration to Next.js. We have guided this migration for e-commerce platforms, SaaS products and internal tools, and the patterns are consistent enough to document.

When migration makes sense

  • Your frontend requires complex client-side interactivity that Blade + Alpine.js cannot support without fighting the framework. Think: real-time dashboards, drag-and-drop interfaces, multi-step forms with live validation.
  • You are building (or planning to build) a React Native mobile app and want to share components, types and API clients between web and mobile.
  • Your team has shifted toward TypeScript and the cognitive overhead of maintaining both PHP and JavaScript codebases is slowing delivery.
  • You need static generation or edge deployment for performance-critical pages (marketing, product listings) that Laravel's server-rendering model cannot provide.
  • Your SEO requirements demand fine-grained control over metadata, structured data and rendering strategy per route.

When to stay on Laravel

  • Blade + Livewire or Blade + Inertia.js meets your UI requirements. Livewire 3 handles a surprising amount of interactivity without leaving PHP.
  • Your team is primarily PHP-skilled and there is no strategic reason to shift to TypeScript.
  • The application is backend-heavy (API processing, queue workers, scheduled tasks) with a relatively simple frontend.
  • You are under time pressure. Migrations take months. If you need features now, improve the existing stack.

The strangler-fig migration pattern

Never do a big-bang rewrite. The strangler-fig pattern wraps the old system with a new one, migrating functionality incrementally. For Laravel-to-Next.js, the steps are: (1) extract Laravel's web routes into a clean REST or GraphQL API using Laravel's existing controllers and Eloquent models, (2) deploy Next.js alongside Laravel behind a reverse proxy that routes traffic by path, (3) migrate routes one at a time — new Next.js pages call the Laravel API, (4) once all routes are migrated, optionally replace the Laravel API with a Node.js API or keep it as the backend.

API extraction from Laravel

Most Laravel applications already have the bones of an API — controllers return data that Blade templates consume. The extraction process: create versioned API routes (api/v1/*), add JSON responses alongside existing Blade returns, add API authentication (Sanctum tokens for SPA, Passport for OAuth), and document with OpenAPI/Swagger. Use Laravel Resources to standardise response shapes. This API then serves both the existing Blade frontend and the new Next.js frontend during the migration period.

Authentication migration

This is consistently the hardest part. Laravel's session-based auth does not map directly to Next.js's auth patterns. Our approach: implement Laravel Sanctum's SPA authentication mode, which uses cookie-based sessions for same-domain requests. The Next.js frontend calls Laravel's API with credentials: 'include' and Laravel validates the session cookie. This avoids building a separate JWT system during migration. Post-migration, if you replace the Laravel backend, migrate to NextAuth.js or a dedicated auth provider.

Database considerations

The database does not need to migrate. If you are on MySQL with Eloquent, the Next.js frontend calls the Laravel API which continues to use Eloquent and MySQL. If you eventually replace the Laravel backend with Node.js, you can use Prisma or Drizzle ORM against the same MySQL database. If you want to migrate to PostgreSQL, do that as a separate project — never combine a frontend migration with a database migration.

Timeline and phasing

PhaseDurationOutput
1. API extraction2-4 weeksVersioned REST API alongside existing Blade routes
2. Next.js scaffold + auth1-2 weeksNext.js app calling Laravel API, shared auth working
3. Route migration (incremental)4-12 weeksRoutes migrated one section at a time, both systems live
4. Blade sunset1-2 weeksAll traffic on Next.js, Blade routes removed
5. Optional: backend migration4-8 weeksLaravel API replaced with Node.js if desired

How we help with this

We offer Laravel-to-Next.js migration as a standalone engagement. The typical client is a growing startup or mid-size SaaS company that has outgrown Blade but wants to preserve their Laravel investment during the transition. We handle the API extraction, Next.js architecture, auth migration and incremental route cutover while the client's team continues shipping features on the existing system.

Frequently asked questions

Direct answers to questions readers and AI assistants commonly ask about this topic.

How long does a Laravel to Next.js migration take?+

For a mid-size application (20-50 routes, 10-20 database tables): 3-6 months using the strangler-fig pattern. This includes API extraction, auth migration and incremental route cutover, all while the existing application continues to serve production traffic.

Can I keep my Laravel backend and only migrate the frontend?+

Yes, and this is our recommended approach. Extract a clean API from Laravel, build the Next.js frontend against it, and keep Laravel for the backend (Eloquent, queues, jobs, notifications). You get the benefits of a modern React frontend without rewriting your battle-tested backend.

Is Next.js better than Laravel?+

They solve different problems. Laravel is a full-stack PHP framework with excellent backend tooling. Next.js is a React framework with superior frontend capabilities, SSR/SSG options and edge deployment. The best architecture often uses both: Next.js for the frontend, Laravel (or a Node.js API) for the backend.

Should I migrate my database from MySQL to PostgreSQL at the same time?+

No. Never combine a frontend migration with a database migration. Migrate the frontend first, stabilize, then evaluate whether a database migration is warranted. Many applications run perfectly well on MySQL and the migration cost is not justified.

Last updated: April 27, 2026 · Written by Ribbsaeter Systems Engineering · Full-Stack Engineering