Laravel REST API 后端与 React + Vite 前端分离,不使用 Blade 模板
LaraBaseX — Laravel 启动器模板
作者 ayush-sleeping
LaraBaseX 是一个基于 Laravel 与 React 的全栈启动器,提供 REST API 后端、React 前端以及用户、角色权限、员工与询盘等基础 CRUD 模块。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
目前有 1 张原始预览,可打开完整图片查看设计细节。
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
集成 Laravel Sanctum 认证与 Spatie 角色权限,支持基于权限的前端 UI 控制
内置用户、员工、询盘三个完整 CRUD 模块及仪表盘界面
提供 PHPStan、Pest、Pint、ESLint、Postman/Newman 等开发与测试工具配置
包含 Docker 开发配置,并说明支持 VPS 或共享主机部署
模板详细介绍
LaraBaseX 是一个面向开发者的全栈启动器模板,后端使用 Laravel 构建 REST API,前端使用 React(Vite 构建)并集成 Shadcn UI,不依赖 Blade 模板。项目定位是跳过重复的初始化工作,直接进入功能开发。
模板内置了认证与授权基础:Laravel Sanctum 负责登录注册流程,Spatie 权限包提供角色与权限管理,并支持基于权限的前端 UI 控制。业务模块方面,提供了用户、员工、询盘三个完整 CRUD,以及可用的仪表盘界面。
开发与质量工具包括 PHPStan 静态分析、Pest 测试、Pint 代码风格、ESLint 前端检查以及 Postman/Newman API 测试脚本。部署方面说明支持 Docker、VPS 或共享主机,并提供队列、缓存、邮件等 Laravel 常规配置项。
需要留意的是,README 中关于“生产就绪”“可扩展至企业级”等表述属于作者自述,模板本身未附带性能或安全审计证明。实际使用前应自行核对依赖版本、环境配置与第三方素材许可。
适合你的项目吗?
适用场景
- 需要快速搭建带认证和权限管理的后台管理系统原型
- 希望以 Laravel API + React 前后端分离方式启动新项目
- 需要用户、员工、询盘等基础 CRUD 作为业务起点
- 在团队中统一代码风格、静态分析与 API 测试流程
适合人群
- 熟悉 Laravel 与 React 的全栈开发者
- 需要跳过重复初始化、直接开发业务功能的团队
- 接受前后端分离架构并自行维护依赖与部署的开发者
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
依次执行 composer install、npm install,复制 .env.example 为 .env 并配置数据库等环境变量
- 2
运行 php artisan key:generate 与 php artisan migrate --seed 初始化数据库
- 3
前端使用 npm run build 构建,开发时用 npm run dev 启动 Vite
- 4
后端可用 php artisan serve 或 docker-compose up 启动,前端默认运行在 5173 端口
- 5
使用前请核对依赖版本、第三方素材许可及外部服务费用
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 使用前需自行配置数据库连接信息(推荐 MySQL,也支持 SQLite),并设置邮件、缓存等环境变量,否则应用无法正常运行。
- 邮件、缓存等外部服务需自行配置环境变量,可能涉及第三方服务账号或费用。
- Docker 仅为本地开发的可选方式,生产部署需自行准备服务器环境。
- 部署需自备 Docker、共享主机或 VPS 等运行环境,模板本身不提供托管服务。
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
Update `.env` with your database credentials (MySQL recommended, SQLite supported).
README 原文
Set up mail, cache, and other environment variables as needed.
README 原文
- Or use Docker for local development:
README 原文
https://github.com/ayush-sleeping/LaraBaseX/blob/main/LICENSEhttps://github.com/ayush-sleeping/LaraBaseX/blob/main/README.md- **Deployment Ready**: Docker / Shared Hosting / VPS
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-03。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料一般 · 70 / 100
- 技术栈
- Laravel · Vite · React
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2025-10-13
- 截图检查日期
- 2026-10-03
目前没有记录演示链接。请依据仓库说明在本地评估;仅凭截图无法确认交互行为。
目录记录的主要技术栈是 Laravel。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
已完成服务器许可规则与 AI 来源核对;未经过人工编辑审核。
查看当时使用的来源资料
SHA-256: 916c76c7096b2043172e2c2d0d6f73967cd019bb7436403924eb10087a57a352
2026-10-03T07:40:13.648Z
来源文件 / 仓库## 🚀 LaraBaseX
> A Laravel 12 + ReactJS Full Stack Starter Boilerplate.
This is a secure, modular, production-ready base project using Laravel 12 with ReactJS frontend, ideal for building scalable web applications without Blade.
[](https://example.com)
[](https://example.com)
## Overview
What LaraBaseX Is
A starter kit for developers who want to skip repetitive setup work and start building features right away.
- Laravel 12 backend → clean REST API architecture, ready for production.
- ReactJS frontend → Vite-based, integrated with API, UI ready with Shadcn.
- Security baked in → CSRF, CORS, Rate limiting, Sanitization.
- Roles & Permissions → Spatie permissions + UI protection.
- Full CRUDs ready → Users, Employees, Enquiries.
- Deployment ready → Works with Docker, VPS, or shared hosting.
Why It’s Useful
- Saves weeks of setup time by giving you authentication, authorization, logging, validation, helper functions, and database structure out of the box.
- Gives a modern dev experience — API response helpers, centralized error handling, custom commands, and frontend integration.
- Provides flexibility — you can scale it from small apps to enterprise-level solutions.
Included Major Features
- Backend → Laravel 12 API, Sanctum Auth, MySQL, Redis queues, Spatie permissions, custom helpers.
- Frontend → React + Shadcn UI, API integration, role-based UI.
- Dev Tools → PHPStan, Pest tests, ESLint, Pint, Postman tests, Docker dev setup.
- Security → HTTPS enforcement, CORS setup, CSRF tokens, rate limits.
- Production Ready → Queue workers, caching, mailers, exception logging, activity logs.
<p align="right"><a href="#top"><img src="https://img.shields.io/badge/-Back%20to%20Top-blueviolet?style=for-the-badge" /></a></p>
<br>
<br>
<div id="top"></div>
##
### Table of content:
| No. | Topics |
| ------- | --------------------------------------------------------------------------------------- |
| 0. | [Tech Stack](#tech-stack) |
| 1 | [Features and Integrations](#features-and-integrations) |
| 2 | [Getting Started](#getting-started) |
| 3 | [Documentations](#documentations) |
| 4 | [Folder Structure](#folder-structure) |
<br>
<br>
#
## Tech Stack
> A modern tech stack for building scalable web applications.
- **Backend**: Laravel 12 (REST API)
- **Frontend**: ReactJS (Vite + Axios) + Shadcn UI
- **Database**: MySQL
- **Authentication**: Laravel Sanctum
- **Deployment Ready**: Docker / Shared Hosting / VPS
<p align="right"><a href="#top"><img src="https://img.shields.io/badge/-Back%20to%20Top-blueviolet?style=for-the-badge" /></a></p>
<br>
<br>
#
## Features and Integrations
| Category | Integrations & Features |
|------------------|---------------------------------------------------------------------------------------|
| RDBMS | MySQL, SQLite (default) |
| Storage | Local, Unix File System |
| Message Queues | Redis, Database (queue driver), Supervisor (production) |
| Mailers | SMTP, Mailgun (via Laravel config) |
| Caching | Redis, File |
| Logging | Monolog, custom exception handler, Spatie Activity Log |
| Validations | FormRequest, custom validation rules |
| Transformers | API response helpers |
| Helpers | Centralized helpers for API, formatting, utilities |
| Internationalisation | Laravel's built-in i18n, language files |
| Console Commands | Custom Artisan commands, scheduler |
| Security | HTTPS, CORS, CSRF, Rate Limiting, Authorization, Input Sanitization |
| Frontend | ReactJS (Vite), Shadcn UI, Inertia.js SPA routing |
| Deployment | Docker, Shared Hosting, VPS |
| Authentication | Full login & registration flow with database-backed users |
| Dashboard | Working dashboard UI and backend |
| Roles & Permissions | Create/manage roles, assign permissions, protect routes and UI |
| User Management | Full users CRUD (create, read, update, delete) and assign Roles & Permissions |
| Employee Management | Employee CRUD (create, read, update, delete) and assign Roles & Permissions |
| Enquiry | Enquiry section for user/customer queries |
<p align="right"><a href="#top"><img src="https://img.shields.io/badge/-Back%20to%20Top-blueviolet?style=for-the-badge" /></a></p>
<br>
<br>
#
## Getting Started
1. **Clone the repo:**
```sh
git clone https://github.com/ayush-sleeping/LaraBaseX.git
cd LaraBaseX
```
2. **Install backend dependencies:**
```sh
composer install
```
3. **Install frontend dependencies:**
```sh
npm install
```
4. **Copy and configure environment files:**
```sh
cp .env.example .env
```
- Update `.env` with your database credentials (MySQL recommended, SQLite supported).
- Set up mail, cache, and other environment variables as needed.
5. **Generate application key:**
```sh
php artisan key:generate
```
6. **Run database migrations and seeders:**
```sh
php artisan migrate --seed
```
7. **Build frontend assets:**
```sh
npm run build
```
8. **Start the Laravel backend server:**
```sh
php artisan serve
```
- Or use Docker for local development:
```sh
docker-compose up
```
9. **Start the React frontend (Vite):**
```sh
npm run dev
```
10. **Access the app:**
- Backend API: [http://localhost:8000](http://localhost:8000)
- Frontend: [http://localhost:5173](http://localhost:5173)
11. **Run tests and code quality checks:**
- PHPStan (static analysis):
```sh
./vendor/bin/phpstan analyse
```
- Pest (unit/feature tests):
```sh
./vendor/bin/pest
```
- Pint (code style):
```sh
./vendor/bin/pint
```
- ESLint (frontend lint):
```sh
npm run lint
```
- Postman/Newman (API tests):
```sh
bash postman/test.sh
```
- Health check:
```sh
php test_health.php
```
<p align="right"><a href="#top"><img src="https://img.shields.io/badge/-Back%20to%20Top-blueviolet?style=for-the-badge" /></a></p>
<br>
<br>
#
## Documentations
> Comprehensive guides and references for the codebase.
| No. | Topics | Includes |
| --- | ------- | -------- |
| 1 | [Security Essentials Documentation](documentation/1.%20Security%20Essentials/) | HTTPS Enforced, CORS Configured Properly, CSRF Protection and Others ... |
| 2 | [Architecture & Structure Essentials](documentation/2.%20Architecture%20&%20Structure%20Essentials/) | Helpers, Services, Job Queues, and Others ... |
| 3 | [Packages to Include Documentation](documentation/3.%20Packages%20to%20Include/) | Spatie Laravel Permission, Laravel Sanctum, and Others ... |
| 4 | [Developer Experience Documentation](documentation/4.%20Developer%20Experience%20(DX)/) | Global Exception Handler, Standard API Response, Seeder & Factory and Others ... |
| 5 | [Frontend Integration Documentation](documentation/5.%20Frontend%20Integration%20(ReactJS)/) | Serve React with Vite, Proxy Setup, React Router and Others ... |
| 6 | [User Management Essentials](documentation/6.%20User%20Management%20Essentials/) | Auth APIs, Password Management, Roles & Permissions and Others ... |
| 7 | [Helper Functions Documentation](documentation/7.%20Helper%20Functions/) | Helper Functions |
| 8 | [MySQL Best Practices Documentation](documentation/8.%20MySQL%20Best%20Practices/) | MySQL Best Practices |
| 9 | [Deployment & Production Readiness](documentation/9.%20Deployment%20&%20Production%20Readiness/) | Deployment on server |
| 10 | [Authentication Flow Documentation](documentation/10.%20Authentication%20Flow%20Documentation/Authentication%20Flow%20Documentation%20docx.md) | Authentication Flow |
| 11 | [Authorization Flow Documentation](documentation/11.%20Authorization%20Flow%20Documentation/Authorization%20Flow%20Documentation%20docx.md) | Authorization Flow |
| 12 | [Setting Profile Information Update](documentation/12.%20Setting%20Profile%20Information%20Update/) | Profile Information Update |
| 13 | [Setting Password Update](documentation/13.%20Setting%20Password%20Update/) | Password Update |
| 14 | [Permission Based UI Implementation](documentation/14.%20Permission%20Based%20UI%20Implementation/) | Permission Based UI Implementation |
| 15 | [LaraBaseX Postman Collection](postman/README.md) | Postman Collection |
| 16 | [Testing](documentation/16.%20Testing/) | Testing Documentation |
<p align="right"><a href="#top"><img src="https://img.shields.io/badge/-Back%20to%20Top-blueviolet?style=for-the-badge" /></a></p>
<br>
<br>
#
## Folder Structure
```
LaraBaseX/
├── app/
│ ├── Http/
│ │ ├── Controllers/
│ │ │ ├── Api/
│ │ │ │ ├── AuthController.php
│ │ │ │ ├── BaseApiController.php
│ │ │ │ └── HomeController.php
│ │ │ ├── Auth/
│ │ │ │ ├── AuthenticatedSessionController.php
│ │ │ │ ├── ConfirmablePasswordController.php
│ │ │ │ ├── EmailVerificationNotificationController.php
│ │ │ │ ├── EmailVerificationPromptController.php
│ │ │ │ ├── NewPasswordController.php
│ │ │ │ ├── PasswordController.php
│ │ │ │ ├── PasswordResetLinkController.php
│ │ │ │ ├── RegisteredUserController.php
│ │ │ │ └── VerifyEmailController.php
│ │ │ ├── Backend/
│ │ │ │ ├── DashboardController.php
│ │ │ │ ├── EmployeeController.php
│ │ │ │ ├── EnquiryController.php
│ │ │ │ ├── RoleController.php
│ │ │ │ └── UserController.php
│ │ │ ├── Frontend/
│ │ │ │ └── (empty)
│ │ │ ├── Settings/
│ │ │ │ ├── PasswordController.php
│ │ │ │ └── ProfileController.php
│ │ │ ├── Controller.php
│ │ │ └── HealthController.php
│ │ ├── Kernel.php
│ │ ├── Middleware/
│ │ │ ├── AdminAccess.php
│ │ │ ├── Authenticate.php
│ │ │ ├── BasicAuth.php
│ │ │ ├── EncryptCookies.php
│ │ │ ├── ForceHttps.php
│ │ │ ├── HandleAppearance.php
│ │ │ ├── HandleInertiaRequests.php
│ │ │ ├── PreventBackHistory.php
│ │ │ ├── PreventRequestsDuringMaintenance.php
│ │ │ ├── RedirectIfAuthenticated.php
│ │ │ ├── Token.php
│ │ │ ├── TrimStrings.php
│ │ │ ├── TrustHosts.php
│ │ │ ├── TrustProxies.php
│ │ │ ├── ValidateSignature.php
│ │ │ └── VerifyCsrfToken.php
│ │ └── Requests/
│ │ ├── Auth/
│ │ │ └── LoginRequest.php
│ │ ├── Settings/
│ │ │ └── ProfileUpdateRequest.php
│ │ └── (empty)
│ ├── Repositories/
│ │ └── Contracts/ (empty)
│ ├── Scopes/
│ │ └── HierarchyScope.php
│ ├── Services/
│ │ ├── BackupMonitoringService.php
│ │ ├── CacheWarmupService.php
│ │ └── QueryCacheService.php
│ ├── Traits/
│ │ ├── Cacheable.php
│ │ └── Hashidable.php
│ └── helpers.php
├── bootstrap/
│ ├── cache/
│ │ ├── .gitignore
│ │ ├── config.php
│ │ ├── packages.php
│ │ ├── routes-v7.php
│ │ └── services.php
│ ├── app.php
│ └── providers.php
├── config/
│ ├── app.php
│ ├── auth.php
│ ├── backup.php
│ ├── broadcasting.php
│ ├── cache.php
│ ├── cors.php
│ ├── database.php
│ ├── debugbar.php
│ ├── filesystems.php
│ ├── hashids.php
│ ├── hashing.php
│ ├── inertia.php
│ ├── l5-swagger.php
│ ├── logging.php
│ ├── mail.php
│ ├── permission.php
│ ├── proxy.php
│ ├── queue.php
│ ├── sanctum.php
│ ├── services.php
│ ├── session.php
│ ├── telescope.php
│ ├── trusted.php
│ ├── view.php
├── database/
│ ├── .gitignore
│ ├── database.sqlite
│ ├── factories/
│ │ └── UserFactory.php
│ ├── migrations/
│ │ ├── 0001_01_01_000000_create_users_table.php
│ │ ├── 0001_01_01_000001_create_cache_table.php
│ │ ├── 0001_01_01_000002_create_jobs_table.php
│ │ ├── 2025_08_01_000000_create_permissiongroups_table.php
│ │ ├── 2025_08_01_000001_create_permissions_table.php
│ │ ├── 2025_08_01_000002_create_roles_table.php
│ │ ├── 2025_08_01_000003_create_model_has_permissions_table.php
│ │ ├── 2025_08_01_000004_create_model_has_roles_table.php
│ │ ├── 2025_08_01_000005_create_role_has_permissions_table.php
│ │ ├── 2025_08_01_134338_create_personal_access_tokens_table.php
│ │ ├── 2025_08_04_000001_create_employees_table.php
│ │ ├── 2025_08_04_000002_create_enquiries_table.php
│ │ ├── 2025_08_04_075755_add_avatar_column_to_users_table.php
│ │ ├── 2025_08_08_063250_create_telescope_entries_table.php
│ │ ├── 2025_08_08_063402_create_activity_log_table.php
│ │ ├── 2025_08_08_063403_add_event_column_to_activity_log_table.php
│ │ └── 2025_08_08_063404_add_batch_uuid_column_to_activity_log_table.php
│ └── seeders/
│ ├── DatabaseSeeder.php
│ └── PermissionSeeder.php
├── documentation/
│ ├── 1. Security Essentials/
│ ├── 2. Architecture & Structure Essentials/
│ ├── 3. Packages to Include/
│ ├── 4. Developer Experience (DX)/
│ ├── 5. Frontend Integration (ReactJS)/
│ ├── 6. User Management Essentials/
│ ├── 7. Helper Functions/
│ ├── 8. MySQL Best Practices/
│ ├── 9. Deployment & Production Readiness/
│ ├── 10. Authentication Flow Documentation/
│ ├── 11. Authorization Flow Documentation/
│ ├── 12. Setting Profile Information Update/
│ ├── 13. Setting Password Update/
│ ├── 14. Permission Based UI Implementation/
│ └── 15. Testing/
├── lang/
│ ├── en/
│ └── vendor/
├── node_modules/
│ ├──
├── postman/
│ ├──
├── public/
│ ├── .htaccess
│ ├── apple-touch-icon.png
│ ├── build/
│ ├── favicon.ico
│ ├── favicon.svg
│ ├── index.php
│ ├── logo.svg
│ └── robots.txt
├── resources/
│ ├── css/
│ │ └── app.css
│ ├── js/
│ │ ├── app.tsx
│ │ ├── ssr.tsx
│ │ ├── ziggy.js
│ │ ├── components/
│ │ ├── hooks/
│ │ ├── layouts/
│ │ ├── lib/
│ │ ├── pages/
│ │ │ ├── auth/
│ │ │ ├── backend/
│ │ │ ├── frontend/
│ │ │ ├── settings/
│ │ │ ├── dashboard.tsx
│ │ │ ├── error.tsx
│ │ │ └── welcome.tsx
│ │ └── types/
│ └── views/
│ ├── app.blade.php
│ └── vendor/
│ └── l5-swagger/
├── routes/
│ ├── api.php
│ ├── auth.php
│ ├── backend.php
│ ├── channels.php
│ ├── console.php
│ ├── frontend.php
│ ├── settings.php
│ └── web.php
├── scripts/
│ └── phpstan.sh
├── storage/
│ ├── api-docs/
│ ├── app/
│ ├── debugbar/
│ ├── framework/
│ ├── logs/
│ └── pail/
├── stubs/
│ └──
├── tests/
│ ├── Feature/
│ ├── Pest.php
│ ├── TestCase.php
│ └── Unit/
├── vendor/
│ └── ... (all composer dependencies)
├── .editorconfig
├── .env
├── .env.example
├── .gitattributes
├── .github/
├── .gitignore
├── .prettierignore
├── .prettierrc
├── LICENSE
├── README.md
├── artisan
├── components.json
├── composer.json
├── composer.lock
├── eslint.config.js
├── package-lock.json
├── package.json
├── phpstan-baseline.neon
├── phpstan.neon
├── phpunit.xml
├── postman/
├── test_health.php
├── tsconfig.json
├── vite.config.ts
```
<p align="right"><a href="#top"><img src="https://img.shields.io/badge/-Back%20to%20Top-blueviolet?style=for-the-badge" /></a></p>
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

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 · 启动器
