Overview:
LIRET is a batteries-included starter for Laravel apps that combines Laravel, Inertia, React, and TypeScript. It provides a setup that includes authentication, authorization, websockets, linting and formatting tools, and more.
Features:
- Types: The types for the app are defined in
resources/js/lib/types.tsx, including theIPagePropsinterface for typing shared data and theIUserinterface for the User model. - useTitle: The
useTitlehook inresources/js/lib/use-title.tsxis used to set the title from inside a React component. - Artisan command to create pages: The
php artisan make:page <PAGE NAME>command creates a page template inresources/js/pages. - Authentication: LIRET supports authentication with email-password, Github, and Google out of the box. Social authentication is implemented with Socialite and it’s easy to add other providers.
- Authorization: Admin accounts are defined by setting the
adminproperty on the User model to true. Regular users who register via the/auth/registerroute are not admins. - Seeded admin account: The database seeder creates an admin account with pre-defined credentials.
- Frontend Authorization: The
resources/js/lib/authorization.tsxfile contains components such asAdmin,User,Authenticated, andGuestthat show or hide children based on user and authentication state. - Laravel Websockets: LIRET includes Laravel Websockets, which provides a dashboard at
/laravel-websocketsfor establishing websocket connections with the server. - Linting and Formatting: The project comes with ESLint and Prettier setup out of the box, with configs in
.eslintrc.jsand.prettierrc. It also includes husky and pretty-quick for pre-commit formatting.
Installation:
To install LIRET and set up the theme, follow these steps:
Clone the repository to your local machine:
git clone [repository url]Install the dependencies:
composer install npm installCopy the
.env.examplefile to.envand update it with your database credentials:cp .env.example .envGenerate an application key:
php artisan key:generateMigrate the database:
php artisan migrateSeed the database (optional):
php artisan db:seedStart the development server:
npm run devAccess the application in your browser at
http://localhost:8000.
Summary:
LIRET is a Laravel starter that includes Inertia, React, and TypeScript. It provides a comprehensive setup for building Laravel applications, including authentication, authorization, websockets, linting and formatting tools, and more. With its pre-defined features and easy-to-use commands, LIRET offers developers a solid foundation for rapidly developing Laravel apps.