Laravel Project Structure

πŸ“˜ Laravel πŸ‘ 60 views πŸ“… Dec 22, 2025
⏱ Estimated reading time: 2 min

Laravel follows the Model–View–Controller (MVC) architecture and provides a well-organized directory structure that helps developers build clean, scalable, and maintainable applications. Below is a detailed explanation of the main folders and files in a Laravel project.


Root Directory

The root directory contains core configuration files and folders:

  • artisan – Command-line interface used to perform tasks like migrations, caching, and code generation.

  • composer.json / composer.lock – Define project dependencies and versions.

  • package.json – Manages frontend dependencies.

  • .env – Stores environment-specific configuration.

  • .gitignore – Specifies files and folders ignored by Git.


1. app/ Directory

This is the core of the application logic.

  • Http/

    • Controllers/ – Handle HTTP requests and responses.

    • Middleware/ – Filter requests (authentication, security).

  • Models/ – Represent database tables and handle data logic.

  • Providers/ – Register services and bindings.


2. bootstrap/ Directory

  • app.php – Initializes the Laravel framework.

  • cache/ – Stores cached configuration and routes.


3. config/ Directory

Contains all application configuration files such as:

  • app.php – Application settings

  • database.php – Database configuration

  • mail.php – Mail server settings

  • cache.php – Cache configuration

These files are connected to values in the .env file.


4. database/ Directory

Handles database-related files:

  • migrations/ – Define database table structures

  • seeders/ – Insert test or default data

  • factories/ – Generate fake data for testing


5. public/ Directory

This is the web root of the application.

  • index.php – Entry point for all HTTP requests

  • css/, js/, images/ – Public assets


6. resources/ Directory

Contains frontend and UI-related files:

  • views/ – Blade templates (HTML views)

  • lang/ – Language translation files

  • css/ and js/ – Frontend assets (processed by Vite)


7. routes/ Directory

Defines application routes:

  • web.php – Web routes (sessions, cookies)

  • api.php – API routes (stateless)

  • console.php – Artisan commands

  • channels.php – Event broadcasting channels


8. storage/ Directory

Stores generated and temporary files:

  • app/ – User-uploaded files

  • framework/ – Cache, sessions, compiled views

  • logs/ – Application logs


9. tests/ Directory

Contains automated tests:

  • Feature/ – Test application features

  • Unit/ – Test individual components


10. vendor/ Directory

Contains third-party libraries installed via Composer.
This folder is automatically generated and should not be edited manually.


Conclusion

The Laravel project structure is designed to promote clean code, reusability, and scalability. Understanding this structure helps developers navigate projects efficiently and follow best practices while building robust web applications.


πŸ”’ Some advanced sections are available for Registered Members
Register Now

Share this Post


← Back to Tutorials

Popular Competitive Exam Quizzes