Laravel Creating A New Project In Composer

πŸš€ 1. Create New Laravel Project

Make sure you have:

  • PHP 8.2+
  • Composer
  • Node.js 18+
  • MySQL
composer create-project laravel/laravel myapp
cd myapp

βš™οΈ 2. Configure Environment

Update .env

APP_NAME="MyApp"
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myapp_db
DB_USERNAME=root
DB_PASSWORD=yourpassword

Create database manually:

CREATE DATABASE myapp_db;

Then:

php artisan key:generate

🎨 3. Install Tailwind + Alpine + Auth (Breeze)

Laravel doesn’t ship with login UI by default anymore. Use Breeze (lightweight, clean).

composer require laravel/breeze --dev
php artisan breeze:install

Choose:

Blade

Now install frontend:

npm install
npm run dev

🧠 What You Just Installed

  • Blade templating
  • Tailwind CSS
  • Alpine.js
  • Login / Register / Forgot Password
  • Dashboard
  • Middleware protection
  • Auth scaffolding

Clean and simple. No Jetstream spaceship complexity.


πŸ—ƒοΈ 4. Run Migrations

php artisan migrate

This creates:

  • users
  • password_reset_tokens
  • sessions

▢️ 5. Run App

php artisan serve

Visit:

http://127.0.0.1:8000

Boom. You now have:

  • Register
  • Login
  • Authenticated dashboard

πŸ“ Clean Folder Structure (What Matters)

app/
Models/
Http/Controllers/resources/
views/
css/
js/routes/
web.php

πŸ” Protect Routes

Example:

Route::middleware(['auth'])->group(function () {
   Route::get('/dashboard', function () {
          return view('dashboard');   
        });
    });

⚑ 6. Production Build

When ready:

npm run build

🧠 Recommended Additions (Professional Setup)

Add Role Column

Migration:

php artisan make:migration add_role_to_users_table
$table->string('role')->default('user');

Then:

php artisan migrate

Add Global Layout

Edit:

resources/views/layouts/app.blade.php

Add navbar, sidebar, etc.