Craft’s Folder Structure

There’s a lot going on in your craft/ folder, so let’s makes some sense of it.

Your craft/ folder has the following subfolders:

craft/app/ #

This is where the actual Craft application is stored. You will never need to make any changes within it. (Though if you want to dive into plugin development, it doesn’t hurt to familiarize yourself with it.)

When you need to manually update craft, this is the only folder you will need to replace.

craft/config/ #

This is where Craft stores your configuration files, including:

  • db.php – Stores your site’s database connection settings.

  • general.php – Stores your site’s custom config settings.

  • license.key – Stores your Craft install’s license key. This file is automatically generated for you the first time Craft makes a call to our web server, so don’t worry if you don’t see it right away.

  • routes.php – Stores any PHP-based routes you have.

  • redactor/ – Stores any Redactor configs you want to be available to your Rich Text fields.

craft/plugins/ #

This is where you should place any plugins you want to install. All plugins manifest themselves as a single, self-contained folder that lives here.

craft/storage/ #

This is where Craft stores a bunch of files that get dynamically saved during use.

Some of the folders you might find in there include:

  • backups/ – Stores the database backups that get created when you update Craft, or manually request a backup via the Backup Database tool in Settings.

  • 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 craft/storage/runtime (though this is not a comprehensive list):

    • assets/ – Stores image thumbnails, resized file icons, and copies of images stored on remote asset sources, to save Craft an HTTP request when it needs the images to generate new thumbnails or transforms.
    • cache/ – Stores file caches for things like available update info, whether your server is set up to support URLs without “index.php”, and fetched RSS/Atom feeds.
    • compiled_templates/ – This is where Twig saves your compiled templates as PHP files.
    • logs/ – Stores Craft’s request logs as well as a PHP error log.
    • sessions/ – Stores PHP’s HTTP session data for Craft requests.
  • userphotos/ – Stores your users’ photos, as well as the resized versions used for thumbnails.

craft/templates/ #

This is where all of your site’s templates go.

craft/translations/ #

This folder is not present by default, but if you create it, you can store custom CP and front-end translations in here. The file names and contents should follow the same formats as the files in craft/app/translations/. When a request comes in that gets served with a locale matching one of your translation’s filenames, the file will automatically get loaded up, and its strings will be used when called upon. (See Translating Static Text for an example.)