tooinfinity/infinity-starter-kit

Infinity Starter Kit (Laravel + Inertia + React) a full-featured, modular Laravel starter kit powered by Laravel Chisel and Laravel Fortify.

Maintainers

Package info

github.com/tooinfinity/infinity-starter-kit

Language:TypeScript

Type:project

pkg:composer/tooinfinity/infinity-starter-kit

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-08-30 20:58 UTC

This package is auto-updated.

Last update: 2026-08-31 22:25:56 UTC


README

A full-featured, modular Laravel starter kit powered by Laravel Chisel, Laravel Fortify, and Spatie Laravel Permission.

Designed for speed and cleanliness: choose your features during composer create-project, and Chisel automatically prunes unused backend routes, controllers, actions, Inertia pages, traits, model interfaces, and Pest tests.

⚑ Tech Stack

πŸš€ Quick Start

1. Create a New Project

composer create-project tooinfinity/infinity-starter-kit my-app

During setup, the post-create-project-cmd hook will automatically:

  1. Generate your application encryption key.
  2. Initialize your local database (database/database.sqlite).
  3. Run database migrations.
  4. Trigger the interactive php artisan install:features command powered by Chisel.

2. Select Your Features

When prompted:

Which authentication features would you like to enable?
 [x] Registration
 [x] Email verification
 [x] Two-factor authentication

Which authorization features would you like to enable?
 [x] Spatie Roles & Permissions (spatie/laravel-permission)

Select the features you want using Space, then press Enter.

3. Set Up Authorization (if enabled)

php artisan authorization:setup   # Creates permissions + Super Admin role
php artisan admin:setup           # Creates admin user interactively

4. Start Development

cd my-app
composer run dev

πŸ› οΈ Implemented Modules

πŸ” Authentication Module

Feature Description Chisel Pruning
Registration User registration form, routes, and user creation action. Removes /register route, registration page, and login page register links.
Email Verification Native Fortify verification flow (MustVerifyEmail), verification notice page, resend notifications. Strips MustVerifyEmail interface, removes verification controllers, views, and tests.
Two-Factor Authentication TOTP / QR codes, recovery codes, security settings page, and 2FA challenge flow. Strips TwoFactorAuthenticatable trait, removes 2FA routes, settings UI, controllers, and tests.
Account & Security Login/logout, password reset, profile updates, password change, appearance settings. Core β€” always retained.

πŸ›‘οΈ Authorization & RBAC Module

A Policy-Free role-based access control system powered by spatie/laravel-permission, PHP string-backed enums, and Laravel Gates.

Architecture

Permission enum (source of truth)
        β”‚
        β–Ό
Spatie Permission models
        β”‚
Gate::before() ── Super Admin bypass
        β”‚
Form Request authorize() ── Per-endpoint access control
        β”‚
Inertia shared props ── Frontend authorization data
        β”‚
useAuthorization() hook / <Can> component ── UI helpers

Key Design Decisions

  • No Policies β€” All authorization uses Gate::before() for super-admin bypass, Spatie permission checks, and Form Request authorize() methods.
  • PHP Enums β€” App\Enums\Permission and App\Enums\Role are the single source of truth for permission/role identifiers. No magic strings.
  • Two Setup Commands β€” Separation of concerns: authorization:setup manages permissions/roles, admin:setup manages users.
  • Frontend UI Helpers β€” useAuthorization() hook and <Can> component read shared Inertia props. These are UI helpers only; server-side authorization is the actual security boundary.

Permission Enum

enum Permission: string
{
    case UsersView = 'users.view';
    case UsersCreate = 'users.create';
    case UsersUpdate = 'users.update';
    case UsersDelete = 'users.delete';
}

Add your own permissions by extending the enum. Run php artisan authorization:setup to synchronize.

Role Enum

enum Role: string
{
    case SuperAdmin = 'super-admin';
}

Only super-admin is included in the starter kit. Add application-specific roles as needed.

Super Admin Bypass

Configured in AppServiceProvider via Gate::before():

Gate::before(function (User $user, string $ability): ?true {
    if ($user->hasRole(Role::SuperAdmin->value)) {
        return true;
    }
    return null;
});

Form Request Authorization

Use the Permission enum in Form Request authorize() methods:

public function authorize(): bool
{
    return $this->user()?->can(Permission::UsersCreate->value) ?? false;
}

Frontend Authorization

useAuthorization hook:

const { can, canAny, canAll, hasRole } = useAuthorization();

if (can('users.create')) { /* ... */ }
if (canAny(['users.update', 'users.delete'])) { /* ... */ }
if (hasRole('super-admin')) { /* ... */ }

Can component:

<Can permission="users.create">
    <Button>Create User</Button>
</Can>

<Can permissions={['users.update', 'users.delete']} mode="any">
    <Button>Manage Users</Button>
</Can>

Chisel Pruning

When authorization is disabled, Chisel removes:

  • HasRoles trait from User model
  • Gate::before() from AppServiceProvider
  • Authorization shared props from HandleInertiaRequests
  • config/permission.php and Spatie migrations
  • app/Enums/Permission.php and app/Enums/Role.php
  • Both setup commands
  • Frontend hook, <Can> component, and authorization types
  • All authorization tests

🧹 Interactive Feature Pruning (chisel.php)

How Feature Pruning Works

For every unselected feature:

  1. Config β€” Disables feature flags or deletes configuration files.
  2. Routes β€” Removes route definitions from routes/web.php.
  3. Models β€” Strips unused traits and interfaces from app/Models/User.php.
  4. Controllers & Actions β€” Deletes unnecessary controllers and actions.
  5. Frontend Pages β€” Deletes unused Inertia React pages and navigation tabs.
  6. Tests β€” Deletes matching Pest test files.

Non-Interactive Installation

php artisan install:features --answers='{"auth_features":["registration","two-factor-authentication"],"authorization_features":["roles-permissions"]}'

πŸ—ΊοΈ Module Roadmap

  • Authentication β€” Registration, Email Verification, 2FA, Profile, Password, Session management.
  • Authorization & RBAC β€” Spatie Roles & Permissions, PHP enums, Gate bypass, Form Request authorization, frontend hooks.
  • User Management β€” Admin user directory, creation/edit modals, role assignment, user deactivation.
  • Settings β€” Expanded user profile, security controls, and application configuration.
  • Notifications β€” Database & mail notification center, user preference toggles.
  • Audit Trails β€” Searchable activity log tracking changes, IP addresses, user agents, and timestamps.
  • Reporting & Analytics β€” Dashboard metrics, date filtering, CSV exports, queued export jobs.
  • Localization β€” Supported locales, locale switcher component, translated UI messages.

πŸ§ͺ Testing & Quality Control

# Run all tests
composer test

# Run feature tests
vendor/bin/pest tests/Feature

# Run authorization tests
vendor/bin/pest tests/Feature/Authorization tests/Unit/Enums

# Code formatters and linters
composer run lint

# Type check (PHPStan & TypeScript)
composer test:types

πŸ“ Key Directory Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ Actions/                  # Reusable business logic actions
β”‚   β”œβ”€β”€ Console/Commands/         # Artisan commands
β”‚   β”‚   β”œβ”€β”€ InstallFeaturesCommand.php
β”‚   β”‚   β”œβ”€β”€ SetupAuthorizationCommand.php
β”‚   β”‚   └── SetupAdminUserCommand.php
β”‚   β”œβ”€β”€ Enums/                    # PHP string-backed enums
β”‚   β”‚   β”œβ”€β”€ Permission.php
β”‚   β”‚   └── Role.php
β”‚   β”œβ”€β”€ Http/
β”‚   β”‚   β”œβ”€β”€ Controllers/          # Inertia HTTP controllers
β”‚   β”‚   β”œβ”€β”€ Middleware/           # HandleInertiaRequests (shares auth data)
β”‚   β”‚   └── Requests/            # Form Requests with authorize()
β”‚   β”œβ”€β”€ Models/                   # Eloquent models (User with HasRoles)
β”‚   └── Providers/                # AppServiceProvider (Gate::before)
β”œβ”€β”€ chisel.php                    # Feature pruning configuration
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ fortify.php
β”‚   └── permission.php            # Spatie Permission config
β”œβ”€β”€ database/migrations/          # Users + Spatie Permission tables
β”œβ”€β”€ resources/js/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── can.tsx               # <Can> authorization component
β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   └── use-authorization.ts  # useAuthorization() hook
β”‚   └── types/
β”‚       └── auth.ts               # Auth type with permissions/roles
└── tests/
    β”œβ”€β”€ Feature/Authorization/    # RBAC + command tests
    └── Unit/Enums/               # Enum tests

πŸ“„ License

This starter kit is open-sourced software licensed under the MIT license.