Scroll To Top

This article explains how and why I create my new project directories, the way I do. I use a bash script to generate these directories, but you could manually set up the folders.

I do all my development on a Linux desktop because it gives me quick and easy access to the tools I need in order to automate development. The structure explained below favours the use of Git, but no version control system is required.

First, I'll give you some background about how I develop websites. I run a LAMP server on my desktop/laptop so that I can do my work offline. I then commit my work to Git and push it to whoever needs it or the live server. Creating a consistant directory structure on both your development and server will keep you and your files organized. The goal here is to have everything you need to deploy to any server you want.

First you should have a directory that holds your projects. For this example, let's use '/www'. Then within /www I each project I work on. My projects are broken up by git origin repository, but you could sort by domain or client name or anything you want. The use of the /www directory allows me to use Digital Ocean's Block storage so I can share, duplicate, or move my data without having to pull it from a Git repo each time.

My Directory Structure for a project:

This part is pretty simple, just create the directories you want to use.

# In bash:
mkdir -p public scripts sql bind apache/ssl logs sass
  • public
  • scripts
  • sql
  • bind
  • apache
  • logs
  • sass


The public directory could also be called any of the following: public_html, html, http, webdocs, etc. "Public" will be the directory that is accessible by your webs server (and potentially the world). All other directories will be private.

I usually install the core CMS or framework to this directory.


The scripts directory is where you are going to keep all of your bash scripts. These scripts are intended to be run relative to this directory. I talk about individual scripts in other articles. For example:

Optionally, you could place cron jobs in this directory if you don't create a cron directory. Also, most CMS have existing cron folders already.


The sql folder is where I store database dumps, updates and configurations (such as database users). I store database backups here so that I can commit them and push/pull them to different servers. Keeping the database in Git allows a quick deployment to different servers (unless you have a large database).


If you are using bind, you can store all the files here to move between servers if required. I tend to use services such as Cloudflare; therefore, I don't use bind files all that often and have removed it from newer version of this script.


If you are using a VPS, the apache folder will contain your Apache configurations (excluding htaccess). I use Apache2 which allows me to symbolic link directly to this directory. With symbolic links in place, making updates to the Apache configuration is a breeze when using Git. You could rename and modify the contents this folder for Nginx config files as well.

This is also a great place to store your ssl certificates.

Update: I've since removed the apache directory in favour of bash scripts or ansible playbooks to manage vhosts.


I store all my human, access, error, json and other log files related to the project in this directory.


This is where I store all my sass files before they are complied into the css file.

Project Directory Creation

Now if you were creating a bash script to do this automatically you would also do the following:

  • Generate your apache config
  • Generate any public files such as .htaccess, humans.txt and google validate.
  • Pull in your Sass framework
  • touch logfiles and empty directories with .gitkeep
  • I also automatically create the git repo and commit/push the contents, ready to work from anywhere.

I'm not sure how interesting this article is, if you leave your comments, I'll adapt this article to explain what your looking for.