Skip to main content

Quickstart

Get your development environment running quickly with this streamlined guide. For more detailed instructions, see the Installation guide.

Prerequisites

Before starting, ensure you have:
  • PHP 8.2 or higher
  • Composer
  • Node.js 18+
  • npm or pnpm (pnpm recommended)
  • Git
1

Clone the Repository

Clone the project to your local machine:
git clone <your-repository>
cd LaravelBreezeApi_Nextjs
2

Setup the Backend

Navigate to the Backend directory and install dependencies:
cd Backend

# Install PHP dependencies
composer install

# Copy environment file
cp .env.example .env

# Generate application key
php artisan key:generate

# Run database migrations
php artisan migrate

# (Optional) Seed the database
php artisan db:seed
By default, Laravel uses SQLite for development. If you want to use MySQL or PostgreSQL, update your .env file with the appropriate database credentials.
3

Setup the Frontend

Open a new terminal, navigate to the Frontend directory, and install dependencies:
cd Frontend

# Install dependencies with pnpm
pnpm install

# Or with npm
npm install
Create a .env.local file and configure the backend URL:
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
4

Start the Development Servers

Option 1: Run Everything Together (Recommended)From the Backend directory:
composer run dev
This single command runs in parallel:
  • Laravel server (php artisan serve)
  • Queue worker (php artisan queue:listen)
  • Next.js development server (npm run dev)
This requires the concurrently package, which is automatically installed with the backend dependencies.
Option 2: Run ManuallyTerminal 1 - Backend:
cd Backend
php artisan serve
Terminal 2 - Frontend:
cd Frontend
pnpm dev
# or npm run dev
5

Access Your Application

Once the servers are running, you can access:
The first time you visit the frontend, you’ll see the authentication pages. You can register a new account to get started.

Verify Installation

To verify everything is working correctly:
  1. Visit http://localhost:3000
  2. Click on “Register” to create a new account
  3. Fill out the registration form
  4. You should be redirected to the dashboard after successful registration

Quick Commands Reference

Backend Commands

# Run all tests
composer test

# Run specific tests
php artisan test Feature/Auth

# Clear application cache
php artisan cache:clear

# Run migrations
php artisan migrate

# Rollback migrations
php artisan migrate:rollback

Frontend Commands

# Run linter
pnpm lint

# Build for production
pnpm build

# Start production server
pnpm start

Troubleshooting

If you encounter CORS errors, ensure that:
  1. The FRONTEND_URL in your backend .env is set to http://localhost:3000
  2. The NEXT_PUBLIC_BACKEND_URL in your frontend .env.local is set to http://localhost:8000
  3. Both servers are running

Common Issues

Port already in use: If port 8000 or 3000 is already in use, you can specify a different port:
# Backend - use port 8001
php artisan serve --port=8001

# Frontend - use port 3001
npm run dev -- -p 3001
Remember to update your environment variables if you change ports. Database connection errors: If you see database errors, ensure your database is running and credentials in .env are correct. For SQLite, ensure the database file exists:
touch database/database.sqlite
php artisan migrate

Next Steps

Now that you have everything running:

Build docs developers (and LLMs) love