A production-ready Laravel API template designed for Clean Architecture, Scalability, and Maintainability. This kit leverages the latest Laravel 12 features to provide a robust foundation for modern web applications.
- Laravel 12 Framework: Built on Laravel 12 for modern API development.
- Service Layer Pattern: Dedicated services to isolate business logic from controllers.
- Authentication (Sanctum): Lightweight, secure token-based authentication with multi-device support.
- RBAC (Spatie Permission): Powerful role and permission management integrated out-of-the-box.
- Flexible Primary Key: Core models support both UUID and BigInt (ID). Easily toggle between them via config for project-specific needs.
- Auto-Docs (Scramble): Zero-config OpenAPI documentation accessible at
/docs/api. - Custom CLI: Includes a
make:apicommand to scaffold versioned API components instantly.
This starter kit is designed to be highly adaptable. You can toggle core architectural features directly from your .env file without modifying the source code.
| Feature | Environment Variable | Default | Description |
|---|---|---|---|
| Dynamic UUID | USE_UUID |
false |
When true, all models and migrations will switch from Auto-incrementing IDs to UUIDs. |
| RBAC System | ROLES_PERMISSION |
true |
Enables/Disables the Spatie-based Role and Permission middleware and database checks globally. |
Simply update your .env file and run migrations:
# Example: Switching to UUID-based architecture
USE_UUID=true
php artisan migrate:fresh --seed- Versioned API structure (Api/V1)
- Service layer separation
- Form Request validation
- Role-based authorization
- Dynamic ID-based models (UUID/Auto-increment)
ApiController→ Base controller for API endpoints (uses ApiResponses trait for standardized JSON responses).Controller→ Base controller for Web (Blade/Inertia) controllers.
- PHP: ^8.4
- Laravel: ^12.0
- Composer: ^2.0
-
Clone the project:
git clone https://github.com/Vignesh877845/laravel-api-starter-kit.git cd laravel-api-starter-kit -
Install & Automate Setup:
composer setup
-
Frontend Setup (Optional): If you are using the Inertia + React stack, install the dependencies and start the development environment:
npm install && composer dev
Note: The
composer setupcommand automatically handles.envcreation, key generation, and database migrations with seeding.
Generate versioned API components:
php artisan make:api controller User --ver=V1
php artisan make:api request UserStoreRequest --ver=V1Note: The
--veroption specifies the API version. It is optional and defaults toV1if omitted. To generate components for another version (e.g.,V2), use--ver=V2.