laravel-starter-kit-react maintained by marekmiklusek
🚀 Laravel React Starter Kit
Laravel's official React starter kit enhanced with development workflow tools, code quality standards, and additional developer experience improvements from laravel-starter-kit. ✨
Built with Inertia.js v2, React 19, Tailwind CSS v4, and Laravel Wayfinder.
📋 Requirements
- PHP >= 8.4.0
- Composer
- Node.js & NPM
- MySQL (or your preferred database)
🚀 Quick Start
[!NOTE] In
config/database.php,'engine' => 'InnoDB',is used as the default for bothmysqlandmariadbconnections.
📦 Installation
Create a new Laravel React project:
composer create-project marekmiklusek/laravel-starter-kit-react --prefer-dist app-name
Run the automated setup script:
composer setup
This command will:
- Install PHP dependencies via Composer
- Create
.envfile from.env.example(if not exists) - Generate application key
- Run database migrations
- Install NPM dependencies
- Build frontend assets
⚙️ Additional Setup
🔧 Environment Configuration
After running composer setup, configure your .env file with your database credentials:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_username
DB_PASSWORD=your_password
🌐 Browser Testing Setup (Optional)
If you plan to use Pest's browser testing capabilities, install Playwright:
npm install playwright
npx playwright install
This installs the necessary browser binaries for running browser tests.
💻 Development
🖥️ Running the Development Server
Start all development services concurrently:
composer dev
This starts:
- Laravel development server (port 8000) - Your Inertia + React application
- Queue listener - Background job processing
- Vite dev server - Hot Module Replacement for React/CSS/JS
Your application will be available at http://localhost:8000 🎉
SSR Mode
To run with server-side rendering:
composer dev:ssr
🔍 Code Quality
🧹 Linting & Formatting
Fix code style issues:
composer lint
This runs:
- Rector (PHP refactoring)
- Laravel Pint (PHP formatting)
- ESLint & Prettier (frontend formatting)
🧪 Testing
Run the full test suite:
composer test
This includes:
- Type coverage (100% minimum)
- Unit and feature tests (Pest)
- Code style validation
- Static analysis (PHPStan)
🌐 Browser Testing
This starter kit includes Pest 4 with browser testing capabilities. Create browser tests in tests/Browser/:
it('displays the welcome page', function () {
$page = visit('/');
$page->assertSee('Laravel')
->assertNoJavascriptErrors();
});
📜 Available Scripts
🎼 Composer Scripts
composer setup- Initial project setupcomposer dev- Run all development servicescomposer dev:ssr- Run with server-side renderingcomposer lint- Fix code style issuescomposer test- Run full test suitecomposer test:unit- Run Pest tests onlycomposer test:types- Run PHPStan analysiscomposer test:type-coverage- Check type coveragecomposer test:lint- Validate code stylecomposer ci:check- Run all CI checks (lint, format, types, tests)
📦 NPM Scripts
npm run dev- Start Vite dev servernpm run build- Build for productionnpm run build:ssr- Build for production with SSRnpm run lint- Fix frontend lint issuesnpm run lint:check- Check frontend lint issuesnpm run format- Format frontend code with Prettiernpm run format:check- Check frontend formattingnpm run types:check- Check TypeScript types
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.