If you're new to Laravel or Next.js, one of the biggest challenges is deciding how to organize your project.
Most tutorials recommend creating two separate applications:
api.example.com)example.com)While this works, beginners quickly run into problems:
.env filesFor small and medium-sized applications, this architecture is often unnecessary.
A much simpler approach is to build a Monolithic Repository, where Laravel and Next.js live inside the same project.
This guide walks you through setting up a modern Laravel 13 + Next.js (JavaScript) monolith from scratch.
Instead of maintaining two independent projects, everything lives in one repository.
my-project/
|
|-- app/
|-- bootstrap/
|-- config/
|-- database/
|-- public/
|-- resources/
|-- routes/
|-- storage/
|-- frontend/
|
|-- artisan
|-- composer.json
`-- package.json
Benefits
Before starting, make sure you have installed:
Verify your installation:
php -v
composer -V
node -v
npm -v
Create a new Laravel application.
composer create-project laravel/laravel my-project
Navigate into the project.
cd my-project
Start Laravel.
php artisan serve
Open:
http://127.0.0.1:8000
If you see the Laravel welcome page, you're ready for the next step.
Create Next.js inside your Laravel project.
npx create-next-app@latest frontend
Choose the following options:
TypeScript? No
ESLint? Yes
Tailwind CSS? Yes
src directory? Yes
App Router? Yes
Turbopack? Yes
Import Alias? No (or keep default)
Your project structure should now look like this:
my-project/
app/
bootstrap/
config/
public/
resources/
routes/
frontend/
app/
public/
package.json
next.config.mjs
Open two terminals.
php artisan serve
Laravel runs on:
http://127.0.0.1:8000
cd frontend
npm install
npm run dev
Next.js runs on:
http://localhost:3000
During development, Laravel and Next.js run independently.