Action-Based Architecture,业务逻辑按单一职责拆分,并由 Deptrac 强制分层依赖
laravel-starter — Laravel 启动器模板
作者 davide-cardelli
基于 Laravel 的启动器模板,采用 Action 架构,内置用户管理、角色权限与完整质量工具链。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
目前有 1 张原始预览,可打开完整图片查看设计细节。
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
内置用户管理 CRUD、Policy 授权、角色分配与移除,以及审计日志
Spatie Permission 角色权限体系,含四级角色与按等级授予/撤销规则
PHPStan Level 9、Pest 单元/功能/浏览器测试、CI 覆盖率不低于 80%
Vue 3 + TypeScript + Inertia.js + Tailwind CSS 前端,支持暗色模式与类型安全路由
模板详细介绍
这是一个面向 Laravel 项目的启动器模板,核心定位是提供一套带约束的工程基础,而非 SaaS 样板。它采用 Action-Based Architecture,将业务逻辑拆分为单一职责的 Action 类,并通过 Deptrac 强制分层依赖规则。模板内置完整的用户管理示例,包括增删改查、基于 Policy 的授权、角色分配与移除,以及审计日志。角色与权限基于 Spatie Permission,定义了 super-admin、admin、manager、user 四级角色,并实现按等级授予或撤销角色的规则。
质量工具方面,模板配置了 PHPStan Level 9、Laravel Pint、ESLint、Prettier、Git Hooks,以及 Pest 单元、功能和浏览器端到端测试,CI 中强制覆盖率不低于 80%。前端使用 Vue 3、TypeScript、Inertia.js、Tailwind CSS 与 Reka UI 组件,支持暗色模式和类型安全路由。
需要明确的是,模板不包含计费订阅、团队多租户、代码生成器或功能堆砌。它只提供经过测试和静态分析覆盖的基础,额外功能需要开发者自行在现有架构上添加。
适合你的项目吗?
适用场景
- 需要带角色权限和用户管理后台的 Laravel 项目起点
- 希望以 Action 架构和分层规则约束团队编码方式的项目
- 需要开箱即用的静态分析、测试与 Git Hooks 质量工具链
- 作为学习 Laravel 工程化实践与用户管理实现的参考项目
适合人群
- 熟悉 Laravel 并希望快速搭建带权限管理后台的开发者
- 重视代码质量、静态分析和测试覆盖的团队
- 需要单租户用户管理而非多租户 SaaS 的项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
提供 Docker(Laravel Sail)和原生两种安装方式,Docker 方式无需本地安装 PHP、PostgreSQL 或 Redis
- 2
原生安装需 PHP 8.3+、Composer、Node.js 22+ 和 PostgreSQL 13+,并创建测试数据库
- 3
使用 composer setup 完成依赖安装、迁移、填充和构建,composer dev 启动开发服务器
- 4
内置演示账号(superadmin、admin、manager、user),密码均为 password
- 5
代码采用 MIT 许可,但演示图片、字体、图标等第三方素材需单独核对许可
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 浏览器端到端测试依赖 Playwright 无头浏览器,且必须在 Laravel Sail(Docker)环境中运行;原生安装方式无法直接执行该测试套件。
- 原生安装需自行准备 PostgreSQL 数据库,并额外创建一个用于测试套件的 testing 数据库,否则测试无法运行。
- Docker 安装方式要求本地已安装 Docker Desktop 与 Git,属于外部运行环境依赖。
- 原生安装要求 PHP 8.3 及以上、Node.js 22+ 与 PostgreSQL 13+,低于这些版本无法使用。
- 模板明确不包含计费订阅、团队多租户和代码生成器,这些功能需开发者自行在现有架构上添加。
- super-admin 角色只能由其他 super-admin 授予或撤销,且最后一个 super-admin 不可被删除或降级,属于内置的权限使用限制。
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
Browser tests drive a real headless browser via Playwright and run **inside Sail** (`composer test:browser`); `composer setup` installs the browser for you.
README 原文
Native install: set DB_HOST=127.0.0.1 (plus REDIS_HOST/MAIL_HOST if used) # and create your database, plus a "testing" database for the test suite
README 原文
Docker Desktop
README 原文
PHP 8.3 or higher
README 原文
This is a **curated foundation**, not a SaaS boilerplate. By design it does **not** include:
README 原文
https://github.com/davide-cardelli/laravel-starter/blob/main/LICENSEhttps://github.com/davide-cardelli/laravel-starter/blob/main/README.mdonly another super-admin can grant or revoke it, and the last super-admin can never be deleted or demoted
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-04。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料一般 · 71 / 100
- 技术栈
- Laravel
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-08-31
- 截图检查日期
- 2026-10-04
目前没有记录演示链接。请依据仓库说明在本地评估;仅凭截图无法确认交互行为。
目录记录的主要技术栈是 Laravel。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-04
查看当时使用的来源资料
SHA-256: f9bfea20f5fad3003413465ec5890deb035b3805f5a365115eeb5c89d693f253
2026-10-04T02:46:10.506Z
来源文件 / 仓库# Laravel Starter Template [](https://github.com/davide-cardelli/laravel-starter/actions/workflows/ci.yml) [](https://phpstan.org/) [](https://opensource.org/licenses/MIT) > **Production-ready Laravel 13 starter template** with Action-Based Architecture, User Management, Roles & Permissions, and complete quality tooling. --- ## 🎯 Why This Template? - 🚀 **Production-Ready** - Not a tutorial, not a demo. Real code you can ship today - 🏗️ **Architecture-First** - Enforced patterns with Deptrac, fully documented and testable - 🧪 **Quality-Driven** - PHPStan Level 9, full Pest suite, automated git hooks - 📚 **Learning Resource** - Complete real-world example with industry best practices - 🔋 **Batteries Included** - Auth, 2FA, roles, permissions, user management CRUD - 💪 **Type-Safe** - Full TypeScript support for frontend, PHPStan Level 9 for backend - 🎨 **Modern UI** - Tailwind CSS 4 with shadcn/ui-inspired components - ⚡ **Developer Experience** - Fast HMR, type-safe routes, git hooks, CI/CD ready --- ## 🆚 What this adds over the official starter kit Laravel's official [`laravel/vue-starter-kit`](https://github.com/laravel/vue-starter-kit) gives you auth, a dashboard, and settings on Inertia + Vue. This template starts there and adds an opinionated, **enforced** foundation. Every row is verifiable in this repository: | Capability | Official Vue starter kit | This template | | --- | :---: | --- | | Auth + 2FA (Fortify) | ✅ | ✅ | | Roles & permissions (spatie) | ❌ | ✅ real, with admin user-management CRUD | | Type-safe role/permission enums | ❌ | ✅ `App\Enums\Role` / `Permission` | | Action-Based Architecture | ❌ | ✅ enforced by Deptrac | | Static analysis | ❌ | ✅ PHPStan **level 9**, no baseline | | Architecture tests | ❌ | ✅ Pest `arch()` — strict types, layer rules | | Browser e2e tests | ❌ | ✅ Pest 4 browser testing (Playwright) | | Rate-limited auth + error pages | partial | ✅ register/forgot throttled, Inertia 403/404/500/503 | | Accessible confirm dialog / a11y | ❌ | ✅ reka-ui alert-dialog, aria labels | | Agent-ready | ❌ | ✅ `AGENTS.md` + Laravel Boost | | CI | basic | ✅ one workflow, PHP matrix, coverage ≥ 80% enforced | ## 🚫 What this is NOT This is a **curated foundation**, not a SaaS boilerplate. By design it does **not** include: - **Billing / subscriptions** — no Cashier, no payment flows. - **Teams / multi-tenancy** — single-tenant user management only. - **Code generators** — no `make:crud`; you copy the documented Action / Policy / Request pattern instead (see "Adding New Features"). - **A grab-bag of features** — every addition must earn its place and stay covered by tests and static analysis. Need those? Add them deliberately on top of this base — the architecture is designed to absorb them cleanly. ## 📸 Screenshots **User management** — roles as badges, permission-gated actions, searchable list:  **User detail** — inline role assignment/removal with optimistic UI (Inertia `useHttp`) and permissions derived from roles:  **Login** — Laravel Fortify authentication with two-factor support:  _Captured from the seeded demo app; run `composer setup` and sign in with the demo accounts (below) to explore these flows yourself._ --- ## ✨ Features ### Core Stack - **Laravel 13** - Latest features and improvements - **Vue 3 + TypeScript + Inertia.js 3** - Modern, type-safe frontend - **PostgreSQL** - Robust relational database - **Laravel Sail** - Docker development environment - **Spatie Permission** - Complete role and permission management - **Laravel Fortify** - Authentication with 2FA support - **Tailwind CSS 4** - Modern utility-first CSS framework ### Architecture & Code Quality - **Action-Based Architecture** - Clean, testable, single-purpose business logic - **PHPStan Level 9** - Maximum static analysis and type safety - **Deptrac** - Automated architecture layer enforcement - **Laravel Pint** - Consistent PHP code style (PSR-12) - **ESLint + Prettier** - TypeScript/Vue code formatting - **Git Hooks** - Pre-commit formatting, pre-push quality checks - **Comprehensive Test Suite** - Unit, feature, and browser e2e tests with Pest 4; coverage enforced at ≥ 80% in CI ### Frontend Stack - **Vite** - Lightning-fast hot module replacement - **TypeScript** - Type-safe JavaScript with full IDE support - **Laravel Wayfinder** - Type-safe routes for TypeScript - **Reka UI** - Headless, accessible Vue components - **Lucide Icons** - Beautiful, consistent icon library - **Dark Mode** - Built-in theme switching ### Complete User Management Example - **CRUD Operations** - Create, read, update, delete users - **Role Management** - Assign and remove roles with proper authorization - **Policy-Based Auth** - Fine-grained permission checking - **Form Validation** - Client and server-side validation - **Partials Pattern** - Reusable Vue form components - **Audit Logging** - Track all user operations --- ## 🚀 Quick Start ### 📝 Using GitHub Template (Recommended) 1. **Click the green "Use this template" button** at the top of this repository 2. **Choose a name** for your new project 3. **Clone your new repository:** ```bash git clone https://github.com/YOUR-USERNAME/YOUR-PROJECT.git cd YOUR-PROJECT ``` 4. **Follow installation steps below** (Option 1 or Option 2) --- ### Option 1: Docker Installation (Recommended) Perfect for **quick setup** and **consistent environments**. No need to install PHP, PostgreSQL, or Redis locally. **Prerequisites:** - [Docker Desktop](https://www.docker.com/products/docker-desktop) - [Git](https://git-scm.com/) **Installation:** ```bash # 1. Install PHP dependencies composer install # 2. Copy environment file cp .env.example .env # 3. Generate application key php artisan key:generate # 4. Start Docker containers ./vendor/bin/sail up -d # 5. Run migrations and seed demo data ./vendor/bin/sail artisan migrate --seed # 6. Install frontend dependencies and start dev server ./vendor/bin/sail npm install ./vendor/bin/sail npm run dev ``` **Access your application:** - **App:** http://localhost - **Mailpit (Email Testing):** http://localhost:8025 - **PostgreSQL:** localhost:5432 - **Redis:** localhost:6379 **Demo Credentials:** | Role | Email | Password | |------|-------|----------| | Super Admin | [email protected] | password | | Admin | [email protected] | password | | Manager | [email protected] | password | | User | [email protected] | password | **Useful Sail Commands:** ```bash # Alias for convenience (add to ~/.bashrc or ~/.zshrc) alias sail='./vendor/bin/sail' # Start containers sail up -d # Stop containers sail down # Run tests sail artisan test # Access container shell sail shell # View logs sail artisan pail ``` --- ### Option 2: Native Installation For developers who prefer **native PHP** or want **maximum performance**. **Prerequisites:** - PHP 8.3 or higher - [Composer](https://getcomposer.org/) - [Node.js 22+](https://nodejs.org/) - PostgreSQL 13 or higher **Installation:** ```bash # 1. Copy and configure environment cp .env.example .env # Native install: set DB_HOST=127.0.0.1 (plus REDIS_HOST/MAIL_HOST if used) # and create your database, plus a "testing" database for the test suite # 2. One-command bootstrap: installs, migrates, seeds, builds composer setup # 3. Start development servers (Laravel + Vite) composer dev ``` **Access your application:** - **App:** http://localhost:8000 **Demo Credentials:** (same as Docker installation above) --- ## 🏗️ Architecture ### Action-Based Architecture This template implements a **clean Action-Based Architecture** that separates business logic into focused, testable classes. ``` app/ ├── Actions/ # Business logic (single responsibility) │ └── User/ │ ├── CreateUser.php # Create new user │ ├── UpdateUser.php # Update existing user │ ├── DeleteUser.php # Delete user │ ├── AssignRoleToUser.php # Assign role to user │ └── RemoveRoleFromUser.php # Remove role from user ├── Http/ │ ├── Controllers/ # Thin orchestration layer │ ├── Requests/ # Form validation rules │ └── Middleware/ ├── Models/ # Eloquent models (pure data) └── Policies/ # Authorization logic ``` **Why Actions?** - ✅ **Single Responsibility** - Each action does ONE thing - ✅ **Testable in Isolation** - Easy to unit test without HTTP layer - ✅ **Reusable** - Use in controllers, jobs, console commands - ✅ **Type-Safe** - Full PHPDoc and type hints - ✅ **Logged** - Built-in operation logging for audit trails ### Architecture Rules (Enforced by Deptrac) ```yaml Enums → (no dependencies — leaf domain primitives) Models → Enums Policies → Models, Enums Actions → Models, Enums Controllers → Actions, Models, Requests, Policies, Enums Requests → Models, Enums Jobs → Actions, Models Middleware → Models, Enums ``` **Validate compliance:** ```bash composer deptrac ``` --- ## 👥 User Management Example This template includes a **complete User Management implementation** as a real-world reference. ### Backend Components | Component | Purpose | Location | |-----------|---------|----------| | **UserPolicy** | Authorization rules | `app/Policies/UserPolicy.php` | | **Actions** | Business logic | `app/Actions/User/` | | **Controller** | HTTP handling | `app/Http/Controllers/UserController.php` | | **Requests** | Form validation | `app/Http/Requests/` | ### Frontend Components | Page | Purpose | Location | |------|---------|----------| | **Index** | User list with search/pagination | `resources/js/pages/admin/users/Index.vue` | | **Show** | User detail with inline role management (Inertia `useHttp` + optimistic UI) | `resources/js/pages/admin/users/Show.vue` | | **Create** | User creation form | `resources/js/pages/admin/users/Create.vue` | | **Edit** | User editing form | `resources/js/pages/admin/users/Edit.vue` | | **UserForm** | Reusable form partial | `resources/js/pages/admin/users/partials/UserForm.vue` | ### Permissions ```php 'view users' // View user list 'create users' // Create new users 'edit users' // Edit existing users 'delete users' // Delete users 'assign roles' // Manage user roles ``` ### Usage Example ```php // app/Http/Controllers/UserController.php use App\Actions\User\CreateUser; use App\Http\Requests\StoreUserRequest; public function store(StoreUserRequest $request, CreateUser $createUser) { // Action handles business logic $user = $createUser->execute($request->validated()); return redirect()->route('users.index') ->with('success', 'User created successfully'); } ``` --- ## 🔒 Roles & Permissions ### Default Roles | Role | Permissions | Description | |------|-------------|-------------| | **super-admin** | All permissions | Full access; only another super-admin can grant or revoke it, and the last super-admin can never be deleted or demoted | | **admin** | All permissions | Full access like super-admin, but ranks below it: cannot grant or revoke the super-admin role | | **manager** | View users + content management | Content editing, read-only on users | | **user** | View content | Standard user access (default on self-registration) | Role authority follows a rank hierarchy defined on the `Role` enum (`super-admin > admin > manager > user`): holders of the `assign roles` permission can only grant or revoke roles at or below their own rank. ### Customization Edit `database/seeders/RolePermissionSeeder.php` to customize for your application needs. ### Permission Checking ```php // In Blade/Vue templates @can('edit users') <button>Edit</button> @endcan // In controllers (via Policy, using Laravel 13 attributes) #[Authorize('update', 'user')] public function edit(User $user): Response { /* ... */ } // In code if ($user->can('delete users')) { // Perform action } ``` --- ## 🛠️ Development Commands ### Code Quality ```bash # Run all quality checks composer test # Pest tests composer analyse # PHPStan Level 9 composer deptrac # Architecture validation composer format # Format PHP (Pint) npm run lint # ESLint npm run type-check # TypeScript validation npm run format # Prettier formatting ``` ### Development Workflow ```bash # With Sail sail up -d # Start containers sail artisan test # Run tests sail artisan pail # View logs in real-time sail npm run dev # Start Vite HMR # Without Sail composer dev # Start all servers php artisan test # Run tests php artisan pail # View logs npm run dev # Start Vite ``` ### Git Hooks (Versioned) Hooks live in `.githooks/` (tracked in the repository) and are activated by `composer setup` — or manually with `git config core.hooksPath .githooks`. **Pre-commit** (fast): - ✅ Checks the staged PHP files with Laravel Pint (`--test`) - ✅ Checks the staged TS/Vue/CSS files with Prettier (`--check`) - Aborts with guidance if anything needs formatting — it never edits or re-stages files, so partially-staged work is never silently pulled into the commit **Pre-push** (full gate, mirrors CI): - ✅ TypeScript type checking - ✅ ESLint validation - ✅ PHPStan Level 9 analysis - ✅ Deptrac architecture validation - ✅ Full test suite (auto-detects Sail) - ✅ Production build Run the static, style, architecture and build gates locally with `composer check` (run the test suite separately with `sail composer test`, which needs the database). --- ## 🔄 CI/CD ### GitHub Actions Every push and pull request automatically runs: **Quality Matrix:** | Check | Purpose | Tool | |-------|---------|------| | **Tests** | PHP 8.3 + PostgreSQL 18 | Pest | | **PHPStan** | Level 9 static analysis | PHPStan | | **Deptrac** | Architecture enforcement | Deptrac | | **Pint** | Code style validation | Laravel Pint | | **TypeScript** | Type checking | vue-tsc | | **ESLint** | Code linting | ESLint | | **Prettier** | Format checking | Prettier | | **Build** | Frontend compilation | Vite | **Configuration:** `.github/workflows/ci.yml` ### Dependabot Automatic dependency updates run **weekly (Mondays 9:00 AM)**: - 📦 **Composer** - Laravel, Spatie, testing tools - 📦 **npm** - Vue, Vite, TypeScript, UI components - 🔧 **GitHub Actions** - Workflow versions **Features:** - Auto-creates PRs for security patches - CI runs on every Dependabot PR - Ignores major Vue/Vite updates (manual review required) - Limits to 10 concurrent PRs **Configuration:** `.github/dependabot.yml` --- ## 📊 Logging & Monitoring All Actions include **comprehensive logging** for debugging and audit trails. ### Real-time Monitoring ```bash # With Sail sail artisan pail # Without Sail php artisan pail ``` ### What Gets Logged Every Action logs: - ✅ **Operation start** - User ID, parameters, context - ✅ **Operation success** - Results, created IDs - ⚠️ **Warnings** - Sensitive operations (deletions) - ❌ **Errors** - Full context for troubleshooting ### Example Log Output ``` [INFO] Creating new user email: [email protected] first_name: John last_name: Doe phone: +39 333 1234567 created_by: 1 [INFO] User created successfully user_id: 42 email: [email protected] name: John Doe [INFO] Assigning role to user user_id: 42 role: admin assigned_by: 1 [INFO] Role assigned successfully user_id: 42 role: admin ``` ### Security - 🔒 **Passwords never logged** - Only hashed values stored - 🔒 **Sensitive data protected** - Tokens, API keys excluded - 🔒 **Audit trail** - All operations tracked with user context ### Deploying behind a proxy The template trusts the immediate upstream proxy (`trustProxies(at: '*')` in `bootstrap/app.php`) so that, behind a TLS-terminating load balancer or CDN, the real client IP reaches the per-IP rate limiters (login, register, password reset) and HTTPS detection keeps cookies `Secure`. If clients can also reach the app server directly, tighten `'*'` to your proxy's explicit IPs/CIDRs to prevent `X-Forwarded-For` spoofing. --- ## 🧪 Testing ```bash # Run all tests (inside Sail) sail composer test # Run tests natively: phpunit.xml env entries are overridable from # your shell (requires a local "testing" PostgreSQL database) DB_HOST=127.0.0.1 DB_USERNAME=your_user DB_PASSWORD=your_password php artisan test # Run specific test suite composer test -- --filter=UserManagementTest # Run tests in parallel (faster) composer test:parallel # Generate HTML coverage report composer test:coverage # Profile slow tests composer test:profile ``` **Test Structure:** ``` tests/ ├── Browser/ # Pest 4 browser e2e (Playwright, Sail-only) ├── Feature/ # Integration tests │ ├── Auth/ # Authentication + real 2FA (TOTP, recovery, throttle) │ ├── Settings/ # User settings │ ├── ErrorPagesTest.php │ └── UserManagementTest.php └── Unit/ # Isolated unit tests ├── Actions/ # Action classes ├── Enums/ # Role/permission enums ├── ArchTest.php # Architecture rules (strict types, layer boundaries) └── Policies/ # Authorization rules ``` **Notes:** - Line coverage is enforced at **≥ 80%** in CI (`composer test:coverage`, non-browser suites); it currently sits well above that. - Browser tests drive a real headless browser via Playwright and run **inside Sail** (`composer test:browser`); `composer setup` installs the browser for you. --- ## 📝 Adding New Features ### 1. Create an Action ```php // app/Actions/Post/CreatePost.php namespace App\Actions\Post; use App\Models\Post; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log; /** * Create Post Action * * Creates a new post with validated data. */ class CreatePost { /** * Execute the create post action. * * @param array<string, mixed> $data Validated post data * @return \App\Models\Post Created post instance */ public function execute(array $data): Post { Log::info('Creating new post', [ 'title' => $data['title'], 'created_by' => Auth::id(), ]); $post = Post::create($data); Log::info('Post created successfully', [ 'post_id' => $post->id, 'title' => $post->title, ]); return $post; } } ``` **Best Practices:** - ✅ PHPDoc with description, @param, @return - ✅ Full type hints - ✅ Log operation start and completion - ✅ Use appropriate log levels - ❌ Never log sensitive data ### 2. Create a Controller ```php // app/Http/Controllers/PostController.php namespace App\Http\Controllers; use App\Actions\Post\CreatePost; use App\Http\Requests\StorePostRequest; class PostController extends Controller { /** * Store a newly created post. */ public function store(StorePostRequest $request, CreatePost $createPost) { $post = $createPost->execute($request->validated()); return redirect()->route('posts.index'); } } ``` ### 3. Add Routes and Vue Pages ```php // routes/web.php Route::resource('posts', PostController::class); ``` ```bash # Regenerate TypeScript routes php artisan wayfinder:generate --with-form ``` ### 4. Validate Architecture ```bash composer deptrac # Ensures architecture compliance ``` --- ## 🔧 Troubleshooting ### Port Already in Use ```bash # Change ports in .env or compose.yaml APP_PORT=8080 ./vendor/bin/sail up -d ``` ### npm Build Errors ```bash # Clear and reinstall rm -rf node_modules package-lock.json npm install ``` ### Database Connection Issues ```bash # Reset database and volumes ./vendor/bin/sail down -v ./vendor/bin/sail up -d ./vendor/bin/sail artisan migrate:fresh --seed ``` ### Git Hooks Not Running ```bash # Hooks are tracked in .githooks/ and activated by composer setup; # re-activate manually if needed: git config core.hooksPath .githooks ``` ### PHPStan Cache Issues ```bash # Clear PHPStan cache ./vendor/bin/sail composer analyse -- --clear-result-cache ``` --- ## 📁 Project Structure ``` laravel-starter/ ├── app/ │ ├── Actions/ # Business logic │ ├── Http/ │ │ ├── Controllers/ # HTTP handlers │ │ ├── Requests/ # Form validation │ │ └── Middleware/ │ ├── Models/ # Eloquent models │ └── Policies/ # Authorization ├── database/ │ ├── factories/ # Model factories │ ├── migrations/ # Database schema │ └── seeders/ # Data seeding ├── resources/ │ ├── css/ # Tailwind CSS │ └── js/ │ ├── components/ # Vue components │ │ ├── ui/ # shadcn/ui components │ │ └── ... │ ├── layouts/ # Page layouts │ ├── pages/ # Inertia pages │ │ ├── admin/ # Admin pages │ │ ├── auth/ # Auth pages │ │ └── settings/ # Settings pages │ ├── routes/ # Wayfinder routes (generated) │ └── types/ # TypeScript types ├── routes/ │ ├── web.php # Web routes │ └── settings.php # Settings routes ├── tests/ │ ├── Feature/ # Integration tests │ └── Unit/ # Unit tests ├── .github/ │ └── workflows/ │ └── ci.yml # GitHub Actions CI ├── deptrac.yaml # Architecture rules ├── phpstan.neon # Static analysis config ├── compose.yaml # Docker Compose (Sail) └── package.json # Frontend dependencies ``` --- ## 🤝 Contributing This is a **template repository** - feel free to: - ⭐ Star it if you find it useful - 🐛 Report issues - 💡 Suggest improvements - 🔀 Fork and customize for your needs --- ## 📄 License **MIT License** - Use freely for personal or commercial projects. --- ## 🙏 Credits & Acknowledgments Built with industry-leading tools and frameworks: **Backend:** - [Laravel](https://laravel.com) - PHP Framework - [Spatie Laravel Permission](https://spatie.be/docs/laravel-permission) - Roles & Permissions - [Laravel Fortify](https://laravel.com/docs/fortify) - Authentication - [Pest PHP](https://pestphp.com) - Testing Framework - [PHPStan](https://phpstan.org) - Static Analysis - [Deptrac](https://qossmic.github.io/deptrac/) - Architecture Enforcement **Frontend:** - [Vue.js](https://vuejs.org) - Progressive Framework - [Inertia.js](https://inertiajs.com) - Modern Monolith - [TypeScript](https://www.typescriptlang.org) - Type Safety - [Tailwind CSS](https://tailwindcss.com) - Utility-First CSS - [Vite](https://vitejs.dev) - Build Tool - [Reka UI](https://reka-ui.com) - Headless Components - [shadcn/ui](https://ui.shadcn.com) - Design Inspiration - [Lucide Icons](https://lucide.dev) - Icon Library **Development:** - [Laravel Sail](https://laravel.com/docs/sail) - Docker Environment - [Laravel Pint](https://laravel.com/docs/pint) - Code Style - [ESLint](https://eslint.org) - Linting - [Prettier](https://prettier.io) - Code Formatting --- **Ready to build something amazing?** 🚀 **[Use this template](https://github.com/davide-cardelli/laravel-starter/generate)** to get started in minutes!
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

sage
WordPress starter theme with Laravel Blade components and templates, Tailwind CSS, and block editor support
Laravel · 启动器

wave
Wave - The Software as a Service Starter Kit, designed to help you build the SAAS of your dreams 🚀 💰
Laravel · SaaS

filament-starter
A beautiful starting point for your next TALL stack project using Filament. ⚡
Laravel · 启动器

electrik
Laravel SaaS starter kit: auth, teams, Stripe billing, and Slate 3 — Composer package for Laravel 12
Laravel · SaaS

php-saas
The everything-included starter kit for your next idea
Laravel · SaaS

filament-jetstream
A Laravel starter kit built with Filament inspired by Jetstream.
Laravel · 启动器
