Tech Stack
Vue 3
Composition API, TypeScript support, and reactive state management
Inertia.js
Server-side routing with SPA-like experience, no separate API needed
Tailwind CSS 4
Utility-first CSS with custom design system
TypeScript
Type safety for Vue components and application logic
Project Structure
The frontend code lives inresources/js/:
Inertia.js Architecture
Inertia.js bridges Laravel and Vue without building a separate API. Controllers return Inertia responses that render Vue components.How It Works
Controller Returns Data
Laravel controller returns an Inertia response with page component and props:
app/Http/Controllers/System/DashboardController.php
Vue Component Receives Props
The Vue component receives the data as typed props:
resources/js/pages/system/Dashboard.vue
Benefits of Inertia
No API Needed
No API Needed
Controllers return data directly to Vue components. No need to build REST or GraphQL APIs.
Server-Side Routing
Server-Side Routing
Routes are defined in Laravel. No need to sync frontend and backend route definitions.
Type-Safe Routing with Wayfinder
Type-Safe Routing with Wayfinder
Generate type-safe route helpers from Laravel routes:
Shared Data
Shared Data
Vue Components
Component Structure
Components follow the Composition API with<script setup> syntax:
resources/js/components/AppHeader.vue
UI Component Library
The project uses shadcn-vue components located inresources/js/components/ui/:
- Card
- Table
- Form
- Dialog
Available Components
Layout
Card, Sheet, Tabs, Separator, Accordion
Forms
Input, Textarea, Select, Checkbox, Radio, Switch
Feedback
Alert, Toast, Dialog, Popover, Tooltip
Navigation
Breadcrumb, Dropdown Menu, Navigation Menu
Data Display
Table, Badge, Avatar, Calendar
Controls
Button, Command, Context Menu, Slider
Layouts
Layouts provide consistent structure across pages:AppLayout (System)
resources/js/layouts/AppLayout.vue
Usage in Pages
resources/js/pages/system/Dashboard.vue
Composables
Reusable logic extracted into composables (Vue’s equivalent of React hooks):useAppearance
resources/js/composables/useAppearance.ts
useTwoFactorAuth
resources/js/composables/useTwoFactorAuth.ts
Tailwind CSS
The project uses Tailwind CSS 4 with custom configuration:Configuration
vite.config.ts
Utility Classes
- Layout
- Typography
- Colors
- Dark Mode
Custom Utilities
Useclsx and tailwind-merge for conditional classes:
resources/js/lib/utils.ts
Form Handling
Inertia provides auseForm helper for managing form state:
resources/js/pages/system/tenants/Create.vue
Form Features
- Automatic CSRF protection: Handled by Inertia
- Validation errors: Automatically populated in
form.errors - Loading states: Track submission with
form.processing - Optimistic updates: Update UI before server response
- File uploads: Support for
multipart/form-data
TypeScript
The project uses TypeScript for type safety:resources/js/types/index.ts
Type-Safe Props
Build Configuration
Vite powers the frontend build process:vite.config.ts
Development
Production Build
SSR Build
Best Practices
Component Organization
Component Organization
- Keep components small and focused
- Use composition API with
<script setup> - Extract reusable logic into composables
- Define TypeScript interfaces for props
State Management
State Management
- Use local state with
ref()andreactive() - Share state across components with composables
- Use Inertia’s shared data for global state
- Avoid prop drilling with
provide/inject
Performance
Performance
- Use
v-memofor expensive renders - Lazy load routes with dynamic imports
- Optimize images with proper sizing
- Use
<Suspense>for async components
Type Safety
Type Safety
- Define interfaces for all props
- Use TypeScript for composables
- Type Inertia page props
- Enable strict mode in
tsconfig.json
Next Steps
Backend Development
Learn about Laravel controllers and services
Testing
Write tests for Vue components and pages