Structure of File

This section will show you how to keep your files organized. Our theme file structure that looks like this.

Theme folder and file structure

As mentioned previously, the default Block themes are some of the best examples of good theme development.

For instance, here is how the Block Theme organizes its file structure:

  • Block

    Folder contains all template source and production files.

    • app

      It contains the core code of your application, almost all of the classes in your application will be in this directory.

    • bootstrap

      This directory contains the app.php file which bootstraps the framework.

    • config

      It contains all of your application's configuration files.

    • database

      It directory contains your database migrations, model factories, and seeds.

    • node_modules

      Directory where npm installs dependencies.

    • public

      contains the index.php file, which is the entry point for all requests entering your application and configures autoloading

      • assets

        This directory also houses your assets such as images, JavaScript, and CSS.

        • css

          Compiled CSS

        • fonts

          All fonts are used in the theme.

        • images

          All the images are used in the theme

        • js

          All Javascript source files used in theme.

      • index.php

        This file is the entry point for all requests entering your application and configures autoloading.

    • resources

      This directory contains your views as well as your raw, un-compiled assets such as CSS or JavaScript.

      • css

        Compiled CSS

      • js

        All Javascript source files used in theme.

      • views

    • routes

      This directory contains all of the route definitions for your application

      • web.php

        This file contains routes that Laravel places in the web middleware group.

      • console.php

        This file is where you may define all of your closure based console commands.

      • api.php

        Thismfile contains routes that are intended to be stateless.

    • storage

      This directory contains your logs, compiled Blade templates, file based sessions, file caches, and other files generated by the framework.

      • app

        The app directory may be used to store any files generated by your application.

      • framework

        The framework directory is used to store framework generated files and caches.

      • logs

        The logs directory contains your application's log files.

    • tests

      The tests directory contains your automated tests. Example Pest or PHPUnit unit tests and feature tests are provided out of the box.