
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.