Modern Laravel + Vue.js + TypeScript Starter Kit
- π― Modern Stack: Laravel 11 + Vue 3 + TypeScript + Inertia.js
- π¨ Beautiful UI: Shadcn/Vue components with TailwindCSS
- π Role-Based Access Control: Spatie Laravel Permission integration
- π Advanced DataTable: Reusable component with search, sort, and pagination
- ποΈ Clean Architecture: Organized component structure and reusable traits
- π± Responsive Design: Mobile-first approach with modern UI patterns
- β‘ TypeScript: Full type safety throughout the application
- π οΈ Developer Experience: Hot module replacement, ESLint, and modern tooling
resources/js/
βββ components/
β βββ common/ # Reusable common components
β βββ data/ # Data display components (DataTable)
β βββ forms/ # Form components
β βββ layout/ # Layout-specific components
β βββ ui/ # Shadcn/Vue UI components
βββ layouts/
β βββ AuthLayout.vue # Authentication layout
β βββ DefaultLayout.vue # Main application layout
βββ pages/ # Page components
βββ types/ # TypeScript type definitions
βββ lib/ # Utility functions
app/
βββ Http/
β βββ Controllers/ # API and web controllers
β βββ Middleware/ # Custom middleware
β βββ Requests/ # Form request validation
β βββ Traits/ # Reusable controller traits
βββ Models/ # Eloquent models
βββ Policies/ # Authorization policies
βββ Providers/ # Service providers
- PHP 8.2+
- Node.js 18+
- Composer
- MySQL/PostgreSQL
-
Clone the repository
git clone <repository-url> cd laravel-starter-kit
-
Install PHP dependencies
composer install
-
Install Node.js dependencies
npm install
-
Environment setup
cp .env.example .env php artisan key:generate
-
Configure database
# Edit .env file with your database credentials DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_database DB_USERNAME=your_username DB_PASSWORD=your_password
-
Run migrations and seeders
php artisan migrate php artisan db:seed --class=RolePermissionSeeder
-
Build assets
npm run build # or for development npm run dev
-
Start the application
php artisan serve
- Admin: Full system access
- Moderator: Limited user and content management
- User: Basic access
view users
,create users
,edit users
,delete users
view roles
,create roles
,edit roles
,delete roles
view permissions
,create permissions
,edit permissions
,delete permissions
In Controllers:
$this->authorize('view', User::class);
In Vue Components:
const canManageUsers = computed(() => {
return user.value?.permissions?.includes('view users');
});
- π Real-time search with debouncing
- π Column sorting (ascending/descending)
- π Pagination with customizable page sizes
- π¨ Customizable cell rendering via slots
- β‘ Loading states and error handling
- π± Responsive design
<template>
<DataTable
:data="users"
:columns="columns"
:pagination="pagination"
:loading="loading"
@search="handleSearch"
@sort="handleSort"
@paginate="handlePaginate"
>
<template #cell.actions="{ row }">
<!-- Custom action buttons -->
</template>
</DataTable>
</template>
<script setup lang="ts">
const columns: Column[] = [
{
key: 'name',
label: 'Name',
sortable: true,
searchable: true,
},
{
key: 'email',
label: 'Email',
sortable: true,
render: (value) => value.toLowerCase(),
},
];
</script>
use App\Http\Traits\HasDataTable;
class UserController extends Controller
{
use HasDataTable;
public function index(Request $request)
{
$query = User::with('roles');
$users = $this->processDataTableRequest(
$query,
$request,
['name', 'email'], // searchable columns
['name', 'email', 'created_at'] // sortable columns
);
return Inertia::render('Users/Index', [
'users' => $users->items(),
'pagination' => $this->formatPaginationData($users),
]);
}
}
This starter kit includes a full set of shadcn/vue components:
- Layout: Card, Sheet, Sidebar
- Navigation: Breadcrumb, Navigation Menu
- Forms: Input, Select, Button, Checkbox
- Data Display: Table, Badge, Avatar
- Feedback: Dialog, Tooltip, Skeleton
- DataTable: Advanced table with search, sort, and pagination
- AppSidebar: Role-aware navigation sidebar
- AppHeader: Breadcrumb navigation header
- AppLogo: Branded logo component
# Development server with hot reload
npm run dev
# Build for production
npm run build
# Type checking
npm run type-check
# Linting
npm run lint
# Run tests
php artisan test
-
Create a new page
# Create controller php artisan make:controller FeatureController --resource # Create Vue page touch resources/js/pages/Feature/Index.vue
-
Add routes
Route::resource('features', FeatureController::class);
-
Add permissions
Permission::create(['name' => 'view features']);
app/Http/Traits/HasDataTable.php
- Reusable DataTable backend logicresources/js/components/data/DataTable.vue
- Frontend DataTable componentresources/js/layouts/DefaultLayout.vue
- Main application layoutresources/js/types/index.ts
- TypeScript type definitionsdatabase/seeders/RolePermissionSeeder.php
- Default roles and permissions
# App
APP_NAME="Laravel Starter Kit"
APP_ENV=local
APP_DEBUG=true
# Database
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=starter_kit
# Permissions
PERMISSION_CACHE_EXPIRATION_TIME=3600
- Brand Colors: Edit
tailwind.config.js
- Logo: Replace components in
resources/js/components/common/
- Permissions: Modify
database/seeders/RolePermissionSeeder.php
- Layout: Customize
resources/js/layouts/DefaultLayout.vue
-
Ziggy route errors
php artisan route:cache npm run build
-
Permission issues
php artisan permission:cache-reset
-
Asset compilation
npm run build php artisan view:cache
- Laravel Documentation
- Vue.js Documentation
- Inertia.js Documentation
- TypeScript Documentation
- Shadcn/Vue Documentation
- Spatie Laravel Permission
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is open-sourced software licensed under the MIT license.
- Laravel - The PHP framework
- Vue.js - The progressive JavaScript framework
- Inertia.js - The modern monolith
- Shadcn/Vue - Beautiful UI components
- Spatie - Amazing Laravel packages
Built with β€οΈ using Laravel, Vue.js, and TypeScript