laravel-starter-kit maintained by nwrman
nwrman/laravel-starter-kit
A fork of nunomaduro/laravel-starter-kit-inertia-react that layers full-stack testing infrastructure, DX tooling, and production-ready React patterns on top of Nuno's ultra-strict, type-safe foundation.
Everything from the upstream kit — 100% type coverage, PHPStan level 9, Rector, strict models via Essentials, Fortify auth, Wayfinder, shadcn/ui — is preserved and kept in sync via git merge upstream/main.
What This Adds
| Area | What | Why |
|---|---|---|
| DX Commands | preflight, test:report, test:retry via nwrman/laravel-toolkit |
Run all quality gates before pushing; get failure-tracking with targeted reruns |
| Form Hook | useInertiaForm |
Bridges TanStack Form (Zod v4 validation) with Inertia's router — client-side validation, server 422 injection, automatic file upload handling |
| Flash Toasts | useFlashToast |
Listens for Inertia v3 flash events and fires Sonner toasts with type-specific durations |
| Error Boundary | <ErrorBoundary> |
Catches React errors with dev-mode diagnostics, auto-resets on Inertia navigation, clipboard-copy stack traces |
| Error Pages | 403, 404, 500 |
Inertia-rendered HTTP error pages with navigation actions |
| Testing Infra | Vitest setup, JSDOM polyfills, Inertia mocks, Wayfinder mocks, test factories | Co-located component/hook tests with @testing-library/react and full mock coverage |
| CI Pipeline | Build-once, test-in-parallel GitHub Actions | PHP checks, frontend coverage, and static analysis run concurrently with optional Telegram notifications |
| Vite Plus | TypeScript 6, Vitest 4, oxlint, Prettier-style formatting, pre-commit hooks | Single toolchain replaces ESLint + Prettier + husky + lint-staged |
| Deploy Scripts | cloud-build.sh, cloud-deploy.sh |
Laravel Cloud build/deploy with Telegram failure alerts |
Tech Stack
| Layer | Technology | Version |
|---|---|---|
| Runtime | PHP | 8.5+ |
| Framework | Laravel | 13 |
| Frontend | React | 19 |
| Routing | Inertia.js | 3 |
| Type-safe Routes | Wayfinder | 0.x |
| Auth | Fortify | 1.x |
| Styling | Tailwind CSS | 4 |
| Components | shadcn/ui | latest |
| Forms | TanStack Form + Zod v4 | latest |
| Bundler | Vite Plus | latest |
| TypeScript | 6 | |
| Linting | oxlint (via Vite Plus) | latest |
| PHP Testing | Pest | 5 |
| Frontend Testing | Vitest + Testing Library | 4 |
| Static Analysis | PHPStan / Larastan | level 9 |
| Refactoring | Rector | 2 |
| Formatting | Pint (PHP) + oxfmt (TS/JS) | latest |
| Package Manager | bun | latest |
| Strict Defaults | nunomaduro/essentials | 1.x |
Getting Started
Requires PHP 8.5+, Bun, and a code coverage driver like Xdebug.
From Packagist (after publishing)
laravel new my-app --using=nwrman/laravel-starter-kit
From local path (development)
laravel new my-app --using=/path/to/laravel-starter-kit
Initial Setup
cd my-app
composer setup # installs deps, generates key, runs migrations, builds assets
composer dev # starts queue worker, log watcher, and Vite dev server
Verify Installation
composer test
This runs the full quality suite: type coverage, Pest with 100% code coverage, Vitest, lint checks, and static analysis.
Available Commands
Development
| Command | Description |
|---|---|
composer dev |
Starts queue worker, Pail log watcher, and Vite Plus dev server concurrently |
composer setup |
Full project setup: install, key:generate, migrate, bun install, build |
Quality Gates
| Command | Description |
|---|---|
composer preflight |
Runs all CI checks locally before pushing |
composer test |
Full suite: type-coverage + Pest + Vitest + lint + static analysis |
composer test:report |
Pest with JUnit tracking — remembers which tests failed |
composer test:retry |
Re-runs only previously failed tests from the last report |
composer lint |
Rector + Pint + oxfmt + oxlint (auto-fix) |
composer lint:dirty |
Lint only files with uncommitted changes |
Targeted Testing
| Command | Description |
|---|---|
composer test:unit |
Pest with 100% code coverage enforcement |
composer test:unit:only |
Unit test suite only |
composer test:feature |
Feature test suite only |
composer test:browser |
Browser test suite only |
composer test:type-coverage |
Pest type coverage (100% minimum) |
composer test:types |
PHPStan + TypeScript type checking |
composer test:lint |
Dry-run lint checks (no auto-fix) |
bun run test:ui |
Vitest frontend tests |
bun run test:coverage |
Vitest with coverage report |
Maintenance
| Command | Description |
|---|---|
composer update:requirements |
Bumps all PHP and Bun dependencies to latest |
composer optimize |
Caches config, events, routes, and views |
Project Structure (additions over upstream)
resources/js/
hooks/
use-inertia-form.ts # TanStack Form + Inertia bridge with Zod v4
use-flash-toast.ts # Inertia flash events -> Sonner toasts
components/
error-boundary.tsx # React error boundary with Inertia awareness
pages/errors/
403.tsx # Forbidden page
404.tsx # Not Found page
500.tsx # Server Error page
testing/
setup.ts # Vitest global setup + JSDOM polyfills
helpers.ts # Test factories (createUser, createNavItem, etc.)
mocks/
inertia.ts # Full @inertiajs/react mock (usePage, Link, router)
routes.ts # Wayfinder route mocks
scripts/
cloud-build.sh # Laravel Cloud build with Telegram alerts
cloud-deploy.sh # Laravel Cloud deploy with Telegram alerts
.ai/guidelines/ # AI agent coding guidelines (actions, general, vitest)
.github/workflows/tests.yml # CI: build-once + parallel test lanes
vite.config.ts # Vite Plus: lint, fmt, staged hooks, plugins
vitest.config.ts # Separate Vitest config (85% coverage thresholds)
CI Pipeline
The included GitHub Actions workflow (.github/workflows/tests.yml) uses a build-once, test-in-parallel architecture:
build ──┬── php_checks (Pest + type coverage + 100% code coverage)
├── frontend_coverage (Vitest + coverage report)
└── static_checks (PHPStan + Rector + Pint + oxlint dry-run)
Optional Telegram notifications fire on start and completion. Configure TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID secrets to enable them — the pipeline works fine without them.
Upstream Sync
This kit is a fork, not a copy. It maintains an upstream remote pointing to nunomaduro/laravel-starter-kit-inertia-react. The mutation surface is deliberately minimal (~13 modified files, ~10 added files) so that upstream merges resolve cleanly:
git fetch upstream
git merge upstream/main
When Nuno updates his kit with new dependencies, components, or security fixes, two commands bring us up to date. Conflicts are limited to the small set of files we both touch (composer.json, vite.config.ts, package.json).
Companion Package
This starter kit includes nwrman/laravel-toolkit as a dev dependency. The toolkit provides Artisan commands (preflight, test:report, test:retry, deploy:notify-telegram) and publishable config stubs (pint.json, rector.php, phpstan.neon, CI workflow).
The toolkit is stack-agnostic — you can use it without this starter kit on any Laravel project:
laravel new my-api --api --pest --no-interaction
cd my-api
composer require --dev nwrman/laravel-toolkit
php artisan toolkit:install
Credits
- Nuno Maduro — upstream starter kit foundation
- Jonathan Hernandez — DX tooling, testing infrastructure, React patterns
License
Open-sourced under the MIT license.