Laravel Project Folder Structure Explained (Beginner to Practical Guide)

I’ll explain each folder simply and practically, so you understand what each part does and when you use it.

You ran:

tree -L 2

That shows the top 2 levels of your Laravel project.


🧠 Big Picture β€” How Laravel Works

Laravel follows:

MVC Architecture

  • Model β†’ Database logic
  • View β†’ UI (HTML pages)
  • Controller β†’ Business logic

Your folders reflect this.


πŸ“ Root-Level Files Explained

These are the main project files.


πŸ“„ README.md

Project documentation.

Used for:

  • Setup instructions
  • Project description

You usually edit this.


βš™οΈ artisan

artisan

This is Laravel’s command-line tool.

You use it for:

php artisan serve
php artisan migrate
php artisan make:model Product
php artisan route:list

Very important file.


πŸ“¦ composer.json

This defines:

  • PHP dependencies
  • Laravel packages
  • Autoload settings

Example packages:

laravel/framework
guzzlehttp/guzzle

Used with:

composer install
composer update

πŸ“¦ composer.lock

Locks exact versions of packages.

Do not edit manually.


πŸ“¦ package.json

Frontend dependencies:

Used for:

npm install
npm run dev

Contains:

vite
axios
tailwind

πŸ§ͺ phpunit.xml

Testing configuration.

Used when running:

php artisan test

⚑ vite.config.js

Frontend build config (Vite).

Used for:

npm run dev

πŸ“ Important Folders Explained

Now the main Laravel directories.


πŸ“ app/ β€” Core Application Logic

Your main backend code lives here.

app/
β”œβ”€β”€ Http
β”œβ”€β”€ Models
β”œβ”€β”€ Providers

πŸ“ app/Models

Contains:

User.php
Product.php
Order.php

Models represent database tables.

Example:

class Product extends Model
{
}

Linked to:

products table

πŸ“ app/Http

Contains:

Controllers
Middleware
Requests

Controllers handle logic.

Example:

ProductController.php

Used in routes.


πŸ“ app/Providers

Service providers.

Used to:

  • Register services
  • Configure application behavior

Advanced Laravel area.


πŸ“ bootstrap/

Laravel startup files.

bootstrap/
β”œβ”€β”€ app.php
β”œβ”€β”€ cache

Used internally.

You rarely modify this.


πŸ“ config/

Configuration files.

config/
β”œβ”€β”€ app.php
β”œβ”€β”€ database.php
β”œβ”€β”€ mail.php
β”œβ”€β”€ queue.php

Very important.

Example:

Database config

config/database.php

Controls:

MySQL
SQLite
PostgreSQL

πŸ“ database/

Database-related files.

database/
β”œβ”€β”€ database.sqlite
β”œβ”€β”€ migrations
β”œβ”€β”€ seeders
β”œβ”€β”€ factories

Very important.


πŸ“„ database/database.sqlite

SQLite database file.

You are currently using:

SQLite database

πŸ“ database/migrations

Database schema files.

Example:

create_users_table.php
create_products_table.php

Run using:

php artisan migrate

πŸ“ database/seeders

Used to insert sample data.

Example:

UserSeeder.php

Run:

php artisan db:seed

πŸ“ database/factories

Used for generating fake data.

Used in testing.


πŸ“ public/

Public web-accessible files.

public/
β”œβ”€β”€ index.php
β”œβ”€β”€ favicon.ico

Very important.


πŸ“„ public/index.php

Entry point of Laravel.

All web requests start here.


πŸ“ resources/

Frontend files.

resources/
β”œβ”€β”€ css
β”œβ”€β”€ js
β”œβ”€β”€ views

Very important.


πŸ“ resources/views

HTML templates.

Example:

home.blade.php
product.blade.php

Blade = Laravel templating engine.


πŸ“ routes/

Defines URLs.

routes/
β”œβ”€β”€ web.php
β”œβ”€β”€ console.php

Very important.


πŸ“„ routes/web.php

Main web routes.

Example:

Route::get('/', function () {
    return view('welcome');
});

πŸ“ storage/

Stores runtime files.

storage/
β”œβ”€β”€ logs
β”œβ”€β”€ framework

Contains:

  • Logs
  • Cache
  • Uploaded files

πŸ“„ Logs Location

storage/logs/laravel.log

Very useful for debugging.


πŸ“ tests/

Testing files.

tests/
β”œβ”€β”€ Feature
β”œβ”€β”€ Unit

Run:

php artisan test

πŸ“ vendor/

Composer dependencies.

vendor/
β”œβ”€β”€ laravel
β”œβ”€β”€ symfony
β”œβ”€β”€ guzzlehttp

Very important but:

❌ Never edit manually.


🧠 How Everything Connects

Typical request flow:

User Request
     ↓
public/index.php
     ↓
routes/web.php
     ↓
Controller
     ↓
Model
     ↓
Database
     ↓
View
     ↓
Browser Output

🎯 Most Important Folders to Learn First

Focus here:

app/Models
app/Http/Controllers
resources/views
routes/web.php
database/migrations

These are used daily.


πŸ§ͺ What Your Project Currently Has

From your output:

βœ” Laravel installed
βœ” SQLite database
βœ” Vendor packages installed
βœ” Default structure ready
βœ” Ready for scaffolding

You’re in a good state πŸ‘


🎯 Suggested Next Step (Very Useful)

Create a new model:

php artisan make:model Product -mcr

Then:

php artisan migrate

Then open:

app/Models/Product.php
app/Http/Controllers/ProductController.php
database/migrations/create_products_table.php

That will help you understand scaffolding practically.