Docs / Getting Started / Starter Kits
Starter Kits
Introduction
To give you a head start building your new Laraflare application, every new application comes with a starter kit. The starter kit gives you a head start on building your next application, and includes the routes, controllers, and screens you need to register and authenticate your application's users. The starter kit uses Fortify to provide authentication.
While you are welcome to use the starter kit, it is not required. You are free to build your own application from the ground up by removing what you don't need. Either way, we know you will build something great!
Creating an Application Using a Starter Kit
To create a new Laraflare application with the starter kit, use the installer:
laraflare new my-app
The installer copies the starter kit, writes the env files and the Worker configs, installs the packages, runs the first migration and seeds the owner's account. See Installation for the installer's options.
Once the application is created, it is served at its .test address by Valet. Without Valet or Herd, start the development server yourself:
cd my-app
npm run dev
Available Starter Kits
Vue
Laraflare's starter kit provides a great starting point for building Laraflare applications with a Vue frontend.
The screens are single-page Vue components in resources/js, driven by the server's routes and controllers, and compiled with Vite. Laraflare has no Blade templates: the screens are Vue.
The starter kit utilizes the Vue Composition API, TypeScript, Tailwind, and the shadcn-vue component library (built on Reka UI).
Starter Kit Customization
Vue
The starter kit is built with Vue 3 Composition API, Tailwind, and shadcn-vue. All of the backend and frontend code exists within your application to allow for full customization.
The majority of the frontend code is located in the resources/js directory. You are free to modify any of the code to customize the appearance and behavior of your application:
resources/js/
├── components/ # Reusable Vue components
├── composables/ # Vue composables / hooks
├── layouts/ # Application layouts
├── lib/ # Utility functions and configuration
├── pages/ # Page components
└── types/ # TypeScript definitions
To publish additional shadcn-vue components, first find the component you want to publish. Then, publish the component using npx:
npx shadcn-vue@latest add switch
In this example, the command will publish the Switch component to resources/js/components/ui/. Once the component has been published, you can use it in any of your pages:
<script setup lang="ts">
import { Switch } from '@/components/ui/switch'
</script>
<template>
<div>
<Switch />
</div>
</template>
Available Layouts
The starter kit includes two different primary layouts for you to choose from: a "sidebar" layout and a "header" layout. The sidebar layout is the default, but you can switch to the header layout by modifying the layout that is imported at the top of your application's resources/js/layouts/AppLayout.vue file:
import AppLayout from '@/layouts/app/AppSidebarLayout.vue'; // [tl! remove]
import AppLayout from '@/layouts/app/AppHeaderLayout.vue'; // [tl! add]
Sidebar Variants
The sidebar layout includes three different variants: the default sidebar variant, the "inset" variant, and the "floating" variant. You may choose the variant you like best by modifying the resources/js/components/AppSidebar.vue component:
<Sidebar collapsible="icon" variant="sidebar"> [tl! remove]
<Sidebar collapsible="icon" variant="inset"> [tl! add]
Authentication Page Layout Variants
The authentication pages included with the starter kit, such as the login page and registration page, also offer three different layout variants: "simple", "card", and "split".
To change your authentication layout, modify the layout that is imported at the top of your application's resources/js/layouts/AuthLayout.vue file:
import AuthLayout from '@/layouts/auth/AuthSimpleLayout.vue'; // [tl! remove]
import AuthLayout from '@/layouts/auth/AuthSplitLayout.vue'; // [tl! add]
Authentication
The starter kit uses Fortify to handle authentication. Fortify provides routes, controllers, and logic for login, registration, password reset, email verification, and more.
Fortify automatically registers the following authentication routes based on the features that are enabled in your application's config/fortify.ts configuration file:
| Route | Method | Description |
|---|---|---|
/login |
GET |
Display login form |
/login |
POST |
Authenticate user |
/logout |
POST |
Log user out |
/register |
GET |
Display registration form |
/register |
POST |
Create new user |
/forgot-password |
GET |
Display password reset request form |
/forgot-password |
POST |
Send password reset link |
/reset-password/{token} |
GET |
Display password reset form |
/reset-password |
POST |
Update password |
/email/verify |
GET |
Display email verification notice |
/email/verify/{id}/{hash} |
GET |
Verify email address |
/email/verification-notification |
POST |
Resend verification email |
/user/confirm-password |
GET |
Display password confirmation form |
/user/confirm-password |
POST |
Confirm password |
/two-factor-challenge |
GET |
Display 2FA challenge form |
/two-factor-challenge |
POST |
Verify 2FA code |
The npx artisan route:list command can be used to display all of the routes in your application.
Enabling and Disabling Features
You can control which Fortify features are enabled in your application's config/fortify.ts configuration file:
import { Features } from '@laraflare/fortify';
features: [
Features.registration(),
Features.resetPasswords(),
Features.emailVerification(),
Features.twoFactorAuthentication({
confirm: true,
confirmPassword: true,
}),
Features.passkeys(),
],
To disable a feature, comment out or remove that feature entry from the features array. For example, remove Features.registration() to disable public registration.
When you disable a feature, you should also remove any references to that feature's routes in your Vue components. For example, if you disable email verification, remove the links to the verification screens. Otherwise, those screens will point at routes that no longer exist.
Customizing User Creation and Password Reset
When a user registers or resets their password, Fortify invokes action classes located in your application's app/Actions/Fortify directory:
| File | Description |
|---|---|
CreateNewUser.ts |
Validates and creates new users |
ResetUserPassword.ts |
Validates and updates user passwords |
The password rules are defined by the PasswordValidationRules concern in app/Concerns.
For example, to customize your application's registration logic, you should edit the CreateNewUser action:
async create(input: Record<string, unknown>): Promise<User> {
await Validator.make(input, {
...this.profileRules(),
phone: ['required', 'string', 'max:20'], // [tl! add]
password: this.passwordRules(),
terms: ['required', 'accepted'],
}).validate();
return User.create({
name: input.name,
email: input.email,
phone: input.phone, // [tl! add]
password: input.password,
});
}
Two-Factor Authentication
The starter kit includes built-in two-factor authentication (2FA), allowing users to secure their accounts using any TOTP-compatible authenticator app. 2FA is enabled by default via Features.twoFactorAuthentication() in your application's config/fortify.ts configuration file.
The confirm option requires users to verify a code before 2FA is fully enabled, while confirmPassword requires password confirmation before enabling or disabling 2FA. For more details, see Fortify's two-factor authentication documentation.
Rate Limiting
Rate limiting prevents brute-forcing and repeated login attempts from overwhelming your authentication endpoints. You can customize Fortify's rate limiting behavior in your application's FortifyServiceProvider:
import { Limit, RateLimiter, type Request } from '@laraflare/framework';
RateLimiter.for('login', (request: Request) => {
return Limit.perMinute(5).by(String(request.input('email')) + request.ip());
});
Frequently Asked Questions
How do I upgrade?
The starter kit gives you a solid starting point for your next application. With full ownership of the code, you can tweak, customize, and build your application exactly as you envision. However, there is no need to update the starter kit itself.
How do I enable email verification?
Email verification is enabled by Features.emailVerification() in your application's config/fortify.ts configuration file, and your app/Models/User.ts model uses the MustVerifyEmail mixin:
import { Authenticatable, HasFactory, MustVerifyEmail, Notifiable } from '@laraflare/framework';
export class User extends MustVerifyEmail(HasFactory(Notifiable(Authenticatable))) {
// ...
}
After registration, users will receive a verification email. To restrict access to certain routes until the user's email address is verified, add the verified middleware to the routes:
Route.middleware(['auth', 'verified']).group(() => {
Route.get('dashboard', () => ({})).name('dashboard');
});