This is a step-by-step guide to help you install and run a Laravel 10 project that incorporates Tailwind CSS and the Jetstream library.
Before you begin, ensure that you have the following prerequisites installed on your system:
- PHP (version 7.4 or higher)
- Composer
- Node.js (version 14 or higher)
- NPM (Node Package Manager)
- Laravel CLI
- Open a terminal or command prompt.
- Run the following command to install Laravel globally:
composer global require laravel/installer
- Navigate to the desired directory where you want to create your Laravel project.
- Run the following command to create a new Laravel project named
my-project
:laravel new my-project
- Change into your project's directory:
cd my-project
- Run the following command to install Tailwind CSS:
npm install tailwindcss
- Create a
tailwind.config.js
file in the root directory of your project:npx tailwindcss init
- Open the
webpack.mix.js
file in your project's root directory and add the following code at the end:const mix = require('laravel-mix'); mix.js('resources/js/app.js', 'public/js') .postCss('resources/css/app.css', 'public/css', [ require('tailwindcss'), ]);
- Run the following command to install the Jetstream scaffolding:
composer require laravel/jetstream
- Run the following command to install the Jetstream stack you prefer (e.g., Livewire or Inertia):
- Livewire:
php artisan jetstream:install livewire
- Inertia:
php artisan jetstream:install inertia
- Livewire:
- If you're using the Inertia stack, you'll also need to install and configure Inertia. Refer to the official Laravel documentation for more information.
- Configure your database settings in the
.env
file located in the root directory of your project. - Run the following command to migrate the database:
php artisan migrate
- Run the following command to compile your assets:
You can also use
npm run dev
npm run watch
for automatic asset compilation during development.
- Run the following command to start the local development server:
php artisan serve
- Open your web browser and visit
http://localhost:8000
to see your Laravel application in action.
That's it! You've successfully installed and set up a Laravel 10 project with Tailwind CSS and Jetstream. Now you can start building your application using the powerful features provided by Laravel and the convenience of the Jetstream library.