A fresh Craft 4 installation will have the following folders and files in it.
Holds all of your Craft and plugin configuration files, as well as your
Holds any Yii modules (opens new window) your site might be using.
This is where Craft stores a bunch of files that get dynamically generated at runtime.
Some of the folders you might find in there include:
backups/– Stores database backups that get created when you update Craft or run the DB Backup utility.
logs/– Stores Craft’s logs and PHP error logs.
rebrand/– Stores the custom Login Page Logo and Site Icon files, if you’ve uploaded them.
runtime/– Pretty much everything in here is there for caching and logging purposes. Nothing that Craft couldn’t live without, if the folder happened to get deleted.
For the curious, here are the types of things you will find in
storage/runtime/ (though this is not a comprehensive list):
assets/– Stores image thumbnails, resized file icons, and copies of images stored on remote asset volumes, to save Craft an HTTP request when it needs the images to generate new thumbnails or transforms.
cache/– Stores data caches.
compiled_classes/– Stores some dynamically-defined PHP classes.
compiled_templates/– Stores compiled Twig templates.
temp/– Stores temp files.
validation.key– A randomly-generated, cryptographically secure key that is used for hashing and validating data between requests.
Your front-end Twig templates go in here. Any local site assets, such as images, CSS, and JS that should be statically served, should live in the web folder.
This is where all of your Composer dependencies go—including Craft and any plugins you’ve installed. This directory should not be tracked in version control. Instead, commit
composer.lock, and use
composer install (opens new window) to rebuild it.
You can customize the name and location of this folder by changing the CRAFT_VENDOR_PATH PHP constant in your entry script. If you choose to relocate it, make sure you update your
.gitignore file to continue excluding it from version control.
This directory represents your server’s web root. The public
index.php file lives here and this is where any of the local site images, CSS, and JS that is statically served should live.
You can customize the name and location of this folder. If you move it so it’s no longer living alongside the other Craft folders, make sure to update the CRAFT_BASE_PATH PHP constant in your entry script.
This is your PHP dotenv (opens new window)
.env file template. It should be used as a starting point for any actual
.env files, stored alongside it but out of version control on each of the environments your Craft project is running in.
Tells Git which files it should exclude when committing changes. At minimum, this should ignore
.env and Composer’s
The starter project consolidates important bootstrapping logic (like defining path constants and loading environment variables from the
.env file) into this file. Both the HTTP and console entry scripts (
craft, respectively) include this file—but each goes on to instantiate a different type of application (opens new window) suited for that request context.
The starting point
composer.json file that should be used for all Craft projects. See the Composer documentation (opens new window) for details on what can go in here.
This is a Composer file that tells Composer exactly which dependencies and versions should be currently installed in
This is a command line executable used to execute Craft’s console commands. Its structure is similar to
web/index.php, insofar as it is responsible for bootstrapping the appropriate Craft application—but instead of a craft\web\Application (opens new window), it creates a craft\console\Application (opens new window).
If you followed the installation guide, DDEV will have left a
.ddev/ directory in the root of your project. This is safe to keep in version control—DDEV may make changes to it from time to time, but a separate
.gitignore file exists within it to ensure only necessary files are tracked.