martyrer/laravel-starter-kit

The skeleton application for the Laravel framework.

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Language:TypeScript

Type:project

v1.0 2025-09-22 14:09 UTC

This package is auto-updated.

Last update: 2025-09-22 14:14:34 UTC


README

CI Laravel PHP React Tailwind

A strict, modern Laravel 12 starter that pairs Inertia + React 19 and Tailwind CSS 4, with opinionated DX and guardrails: 100% test and type coverage targets, high level static analysis, automated refactoring, and first‑class formatting.

This is a mix of the official Laravel React Starter Kit and the Nuno Maduro Starter Kit starter kits

Built for rapid app scaffolding while enforcing high code quality.

Features

  • Laravel 12 with streamlined bootstrap structure and SQLite default
  • Authentication via laravel/fortify
  • Inertia.js (server: inertiajs/inertia-laravel, client: @inertiajs/react)
  • React 19 + TypeScript with Vite 7 and Wayfinder routing helpers
  • Tailwind CSS v4 with modern utilities and @tailwindcss/vite
  • Strict Tooling pre-configured:
    • Tests: Pest v4, PHPUnit 12 (100% coverage targets)
    • Static analysis: Larastan (PHPStan max)
    • Refactoring: Rector
    • Code style: Laravel Pint + Prettier (TS/TSX)
    • Browser testing ready via Pest Browser
  • Essentials defaults (immutable dates, safe console, eager loading) via nunomaduro/essentials
  • DX scripts for linting, type checks, and parallel dev processes

Tech Stack

  • Backend: PHP 8.4, Laravel 12.30.x, Fortify, Wayfinder
  • Frontend: React 19, TypeScript 5, Inertia React 2, Tailwind 4, Vite 7
  • Tooling: Pest 4, PHPUnit 12, Larastan 3, Rector 2, Pint 1, Prettier 3, ESLint 9
  • Runtime: SQLite (default), Queue worker, Laravel Pail for logs

Getting Started

Prerequisites

  • PHP 8.4+
  • Composer
  • Node.js 22+ (Vite 7)
  • Bun or npm (repository scripts use bun for dev, Prettier for formatting)

Installation

# 1) Install PHP dependencies
composer install

# 2) Install JS dependencies
npm install

# 3) Environment + App key
cp .env.example .env
php artisan key:generate

# 4) Database (SQLite default)
mkdir -p database && touch database/database.sqlite
php artisan migrate

# 5) Run dev servers (app, queue, logs, Vite)
composer dev

Visit the app at http://localhost:8000.

Frontend

  • Entry points live under resources/ (TS/TSX)
  • Vite-based dev/build with React plugin and Wayfinder

Common commands:

# Start Vite dev server
npm run dev

# Production build (client + SSR)
npm run build
npm run build:ssr

# Prettier format and check
npm run format
npm run format:check

# Type-check only
npm run types

Backend

Key composer scripts:

# All-in dev orchestration
composer dev

# Lint/fix PHP (Pint), refactor (Rector), then run JS lint
composer lint

# Full test suite with strict gates
composer test

# Individual suites
composer test:unit
composer test:type-coverage
composer test:lint
composer test:types

Fortify provides authentication scaffolding; check routes/ and app/ for actions, requests, and middleware registration via bootstrap/app.php per Laravel 12 conventions.

Testing

Pest v4 is configured for fast unit and browser tests:

# Run full suite (coverage + lint + types)
composer test

# Unit tests with 100% coverage target
a: composer test:unit

# Type coverage (100%)
composer test:type-coverage

# Static analysis and lint gates
composer test:types
composer test:lint

Use datasets and factories for expressive tests. Browser tests live in tests/Browser/.

Code Quality

  • Pint: opinionated PHP formatting
  • Rector: safe automated refactoring
  • Larastan (PHPStan): level max static analysis
  • Prettier: TS/TSX formatting with Tailwind and organize‑imports plugins
  • ESLint: modern React, hooks, and TS rules

Run all in one:

composer lint

Project Scripts (Selected)

Composer (composer.json):

  • dev: parallel app server, queue listener, logs (Pail), and Vite
  • test:*: coverage, unit, lint, types—with strict thresholds

NPM (package.json):

  • dev, build, build:ssr
  • format, format:check, lint
  • types

Directory Structure (Highlights)

  • app/ – Laravel application code (actions, controllers, policies, etc.)
  • bootstrap/ – Application bootstrap (middleware, exceptions, routing)
  • resources/ – React + Inertia frontend (TS/TSX, styles)
  • routes/ – Route files (web, console, etc.)
  • database/ – Migrations, factories, seeders
  • tests/ – Pest tests (Feature, Unit, Browser)

Configuration Notes

  • Tailwind v4 uses CSS @import "tailwindcss" (no @tailwind directives)
  • Wayfinder assists with route discovery while using Vite
  • Essentials enforces strict runtime defaults (immutable dates, eager loading, etc.)
  • Default DB is SQLite; swap via .env without code changes

Deployment

  • Build frontend: npm run build
  • Run migrations: php artisan migrate --force
  • Cache config/routes/views as desired: php artisan optimize
  • Ensure queue workers and logs (Pail) are supervised in production

FAQ

  • "I don’t see UI changes": ensure the Vite dev server is running (npm run dev) or build assets (npm run build).
  • "Vite manifest error": run a fresh build. If still failing, clear caches: php artisan optimize:clear.
  • "Type errors or style diffs": run composer lint and npm run types.

License

This starter is distributed under the MIT license. Components and tools retain their respective licenses (Laravel, Pest, Rector, Pint, Prettier, Tailwind, Inertia, etc.).