mrsuner / laravel-api-boilerplate
A production-ready headless Laravel API boilerplate.
Package info
github.com/mrsuner/laravel-api-boilerplate
Type:project
pkg:composer/mrsuner/laravel-api-boilerplate
Requires
- php: ^8.3
- knuckleswtf/scribe: ^5.6
- laravel-notification-channels/fcm: ^6.1
- laravel/framework: ^13.0
- laravel/sanctum: ^4.0
- laravel/socialite: ^5.24
- laravel/tinker: ^3.0
- santigarcor/laratrust: ^8.5
- spatie/laravel-data: ^4.18
Requires (Dev)
- fakerphp/faker: ^1.23
- laravel/boost: ^2.0
- laravel/pail: ^1.2.2
- laravel/pint: ^1.24
- laravel/sail: ^1.41
- mockery/mockery: ^1.6
- nunomaduro/collision: ^8.6
- phpunit/phpunit: ^12.5.12
This package is auto-updated.
Last update: 2026-08-30 10:52:13 UTC
README
A robust starter template designed to streamline RESTful API development with Laravel 13. This boilerplate comes pre-configured with essential tools and libraries to ensure code quality, documentation, and maintainability.
Why another boilerplate?
Recently I have discovered some baas services and project, e.g. supabase, firebase, pocketbase and Tailbase. They are great and can help developers a lot to sketch up a prototype quickly.
However, AI has been bring in a huge changes with the development workflow, and those baas services' advantages are becoming less obvious. With AI, developers can generate code snippets, database schemas, and even entire modules in seconds. This significantly reduces the time and effort required to build backend services from scratch. And the most important part is that Laravel provides a clean and elegant syntax, making it easier to read and maintain the code, a better development experience and native scalability -- you don't need to worry about outgrowing the platform's limitations and vendor lock-in.
This boilerplate is target to let any developers familiar with Laravel to quickly start a new API project with best practices and essential tools pre-configured, so they can focus on building features and delivering value. it may not suit for all scenarios, but it's a better replacement for those BaaS services for most projects.
🚀 Features
- Framework: Laravel 13 (PHP 8.3+)
- Authentication: Dual token + cookie auth (Sanctum), password / OTP / OAuth, signed-URL email verification
- Configurable security: per-endpoint rate limits,
Password::defaults()policy, login email-verification gate - Standard API envelope: base
Controllerresponse helpers plus a global exception → JSON renderer - API Documentation: Automated docs via Scribe
- Roles & Permissions: Manage access control with Laratrust
- File uploads: Two-phase upload with TTL + scheduled cleanup; works with
localors3 - Data Transfer Objects: Type-safe data handling using Spatie Laravel Data
- Code Quality: Automated code styling with Laravel Pint
- Testing: Comprehensive testing suite with PHPUnit
- AI integration: Laravel Boost MCP and shared agent rules (
CLAUDE.md/AGENTS.md/GEMINI.md/.cursor/rules/.github/copilot-instructions.md)
📚 Documentation
Per-feature docs live in docs/. The index links every module — start there or jump straight to what you need:
| Area | Doc |
|---|---|
| Auth overview & route reference | docs/authentication.md |
| OTP / passwordless | docs/otp.md |
| OAuth / social login | docs/social-auth.md |
| Email verification | docs/email-verification.md |
| Password policy | docs/password-policy.md |
| Rate limiting | docs/rate-limiting.md |
| API responses & exception envelope | docs/api-responses.md |
| RBAC (roles & permissions) | docs/rbac.md |
| File uploads (TTL + cleanup) | docs/files.md |
| Auth event email notifications | docs/notifications.md |
| Roadmap memo | docs/devlog/2026-05-10-boilerplate-roadmap.md |
🛠Installation
Choose one of the following installation paths.
GitHub Template
Click Use this template on the GitHub repository, create your application repository, then clone it locally. This is the recommended path when you want a fresh Git history and GitHub repository workflow.
Composer
composer create-project mrsuner/laravel-api-boilerplate my-api "^1.0" cd my-api
Composer creates a clean application without the boilerplate's Git history, copies .env.example, generates APP_KEY, creates the default SQLite database, and runs migrations.
Git clone
git clone https://github.com/mrsuner/laravel-api-boilerplate.git my-api
cd my-api
Clone preserves the boilerplate repository history. Remove or replace the origin remote before starting your own project.
Finish a Template or clone installation
composer install npm ci cp .env.example .env php artisan key:generate php artisan migrate --seed npm run build
SQLite works by default. Configure another database in .env before migration when required.
âš¡ Usage
Development Server
Start the local development server:
composer run dev
Or separately:
php artisan serve
Running Tests
Execute the test suite using PHPUnit:
php artisan test
Code Formatting
Fix code style issues using Laravel Pint:
./vendor/bin/pint
Generating API Documentation
Generate static HTML documentation:
php artisan scribe:generate
📦 Key Packages
knuckleswtf/scribe: Generates API documentation from your code.santigarcor/laratrust: Handles roles and permissions.spatie/laravel-data: Powerful data transfer objects.
📄 License
Laravel API Boilerplate is open-sourced software licensed under the MIT license.