Need Help ? Chat With Us
More
Π‘hoose
Canada

71 South Los Carneros Road, California +51 174 705 812

Germany

Leehove 40, 2678 MC De Lier, Netherlands +31 174 705 811

Understanding Laravel Folder Structure for Beginners

Understanding Laravel Folder Structure for Beginners
Category:  Laravel
Date:  September 1, 2025
Author:  Ajay Sharma

Root Directory

 

After running laravel new project-name or composer create-project, you’ll see several folders and files in the root of your Laravel project. Let’s look at the most important ones:

app/ β†’ Contains your application logic (models, controllers, middleware, etc.)

bootstrap/ β†’ Bootstraps the framework and loads configuration.

config/ β†’ Holds configuration files for database, mail, cache, etc.

database/ β†’ Contains migrations, seeders, and factories for database setup.

public/ β†’ The only folder accessible from the web; contains index.php, CSS, JS, images.

resources/ β†’ Holds Blade templates, raw assets (CSS, JS), and language files.

routes/ β†’ All application routes are defined here (web.php, api.php, etc.)

storage/ β†’ Stores logs, cached views, file uploads, and compiled Blade templates.

tests/ β†’ Contains automated tests (unit and feature).

vendor/ β†’ Composer dependencies (do not edit manually).

The app/ Folder

 

This is where most of your application’s core logic lives. Inside, you’ll find:

  • Console/ β†’ Custom Artisan commands.
  • Exceptions/ β†’ Handles application exceptions.
  • Http/ β†’ Contains controllers, middleware, and request classes.
  • Models/ β†’ Default location for Eloquent models.
  • Providers/ β†’ Service providers that bootstrap services.

 

The routes/ Folder

Laravel keeps all route definitions in one place:

  • web.php β†’ Routes for web (frontend), uses sessions & CSRF protection.
  • api.php β†’ Routes for APIs, stateless by default.
  • console.php β†’ Define Artisan commands here.
  • channels.php β†’ Routes for event broadcasting (WebSockets).

Example from web.php:

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

This folder is all about user-facing content:

  • views/ β†’ Blade templates (.blade.php files).
  • lang/ β†’ Language/localization files.
  • js/, css/ β†’ Frontend assets (before compilation with Laravel Mix or Vite).

 

Example Blade file in resources/views/home.blade.php:

<!DOCTYPE html>
<html>
<head>
   <title>Home Page</title>
</head>
<body>
   <h1>Welcome to Laravel!</h1>
</body>
</html>
The database/ Folder

This is where you define and manage your database schema:

  • migrations/ β†’ Files that create/modify database tables.
  • seeders/ β†’ Pre-fill tables with sample data.
  • factories/ β†’ Generate fake data for testing.

Example migration:

public function up()
{
   Schema::create('posts', function (Blueprint $table) {
       $table->id();
       $table->string('title');
       $table->text('content');
       $table->timestamps();
   });
}
The config/ Folder

All configuration lives here:

  • app.php β†’ Application settings
  • database.php β†’ Database connections
  • mail.php β†’ Email configuration
  • cache.php β†’ Cache settings

Instead of hardcoding settings, you can change them here once and use them across the app.

The storage/ Folder

This folder handles all the "temporary" and "generated" files:

  • logs/ β†’ Application logs.
  • framework/ β†’ Compiled views, cache, and sessions.
  • app/ β†’ File uploads (user images, docs, etc.).

Important: Always give write permissions to storage/ when deploying.

The public/ Folder

The entry point of your application.

  • index.php β†’ Boots up Laravel and handles all requests.
  • Assets like css/, js/, and images/.

Never expose other folders to the public web β€” only this one!

Recent Blogs
Flutter CI/CD Using Firebase App Distribution & GitHub Actions
calendar-color September 3, 2025
Flutter Security Best Practices: Protecting Your App in 2025
calendar-color September 1, 2025
Mastering Cron Jobs: The Developer's Guide to Automation
calendar-color August 31, 2025
How AI is Powering Flutter Apps: Integrating ChatGPT, Gemini, and More
calendar-color August 29, 2025
10 Proven Tips to Improve Flutter App Performance
calendar-color August 22, 2025
Exploring Laravel: A PHP Framework for Modern Web Development
calendar-color August 21, 2025
Top Blogs
Flutter CI/CD Using Firebase App Distribution & GitHub Actions
calendar-color September 3, 2025
Flutter Security Best Practices: Protecting Your App in 2025
calendar-color September 1, 2025
Mastering Cron Jobs: The Developer's Guide to Automation
calendar-color August 31, 2025
How AI is Powering Flutter Apps: Integrating ChatGPT, Gemini, and More
calendar-color August 29, 2025
10 Proven Tips to Improve Flutter App Performance
calendar-color August 22, 2025
Exploring Laravel: A PHP Framework for Modern Web Development
calendar-color August 21, 2025