What’s a Local Development Environment?
As you’ve started developing sites, have you come across the terms “local development environment” or “developing locally” and wondered what that means? Maybe you’ve been testing code on your live site, something didn’t work as expected, and in forums you’ve seen it suggested that local development is the way to go next time. Maybe you’ve heard of web companies getting into the local development game and wondered what all the buzz is about.
Or to back things up a bit, maybe you’ve never heard this term in your life because you’re new to code or considering a life as a programmer, but you get anxious about one day typing in the wrong tag and somehow breaking the internet. If that fear is keeping your from diving in, take a deep breath. The aforementioned local development environment is here to stop that exact thing from happening.
Here, I’ll breakdown exactly what a local development environment is in the first place, and why you definitely should be including it in your best practices.
What Is a Local Development Environment?
First things first: Local development has nothing to do with your physical location. It isn’t about using locally sourced software, a coworking space, or supporting your neighborhood coffee shop by drinking your fourth cup while working away on a client site (though I won’t fault you for that).
When you develop locally, you are hosting your site’s files locally (on your computer) rather than externally (like on a hosting company’s servers). In fact, you’ve likely been developing locally this whole time, but just didn’t know it had a name.
When you were first learning to code static sites with HTML and CSS, you probably used a text editor (like Atom, Sublime, or Visual Studio Code, to name a few) to create an index.html file and a style.css file. Then you used your browser to view your site. Wow! You could see your work come alive even before signing up with a hosting company! (Technically, you wouldn’t even need an internet connection.)
The thing to remember is that a local site may look and act like a live site for development and testing purposes, but it is only visible to you. In order for anyone to see the site, you eventually have to buy a domain and upload a copy of the files to a hosting company’s servers.
But while you created and then tweaked your files, you tested and perfected your code in your local environment (your computer) and only uploaded the new or revised files to a live environment (your host’s servers) once they were just right. You didn’t even realize it, but you were developing locally!
Local WordPress Development
But what about when you want to develop more complex and dynamic sites that use a language like PHP and store content in a database? I’m talking sites like self-hosting WordPress. The great news is, you can still develop locally—you just need a little help to replicate those live server stacks on your local machine.
There are a myriad of server software programs to chose from when you are setting up your local development environment. In Skillcrush’s WordPress course, we teach students how to set up MAMP for Mac users or XAMPP for PC users. MAMP and XAMPP are free to download and use, and you can create unlimited sites. They bundle the server stacks like Apache, MySQL/MariaDB, and PHP (known as an AMP stack) that you will need to view your local WordPress site in a browser (at the “localhost” url).
Want more bells and whistles? DesktopServer offers a paid upgrade from their free version that gives users unlimited sites, access to customer support, and bonus features that save you some manual tasks. Local by Flywheel gives you the ability to develop locally and then share your work with clients via a publicly accessible url where a user can (temporarily) view what is running on your local development machine.
Local Development Is Best Practice—Here’s Why
Let’s imagine you’ve been working hard on a client site. The client requests what they think is a small fix but it will require you to edit some code. You are plugging along, you view the site in the browser when your new code is in, and. . . nothing. WHITE SCREEN OF DEATH!
In this moment, do you want to be working on a live client site, fielding a frantic phone call five minutes later saying their customers can’t access the site and you need to fix this ASAP? (I’m already breaking into a cold sweat.) Or do you want to be working locally so no one is the wiser? You can calmly troubleshoot where you went wrong while chatting with your rubber ducky and sipping warm coffee.
For this reason alone, local development is best practice. Something as small as missing or erroneous punctuation or a bad line of code can make or break your site. And you don’t want a broken live site. (Especially at 3:00 a.m. when you are tweaking just a liiiiiiittle something on your business site before finally calling it a night. Not that I’ve ever done that or anything. . .)
Besides saving you from a totally unnecessary meltdown, there’s plenty of other reasons to develop locally. In terms of the day to day of running your business as a developer, local development environments can save you from plenty of other headaches. Maybe you want to work out the site design and/or the code out of sight of your client until you are ready to solicit feedback. You don’t need to waste precious time being told to fix something you already planned to edit. Maybe you’re working on a redesign of a live site and your client wants the old site to remain up for customers until just before the new site is launched. Your client might want to avoid paying for hosting while you are working away on the site build for two months. Or perhaps you’d like to try a new plugin but you aren’t sure if it will conflict with your theme or how to configure it yet.
Working locally also makes your life easier once you’re in the weeds of doing the actual programming work. Local sites are faster to work with because you don’t need an internet connection. You can avoid the SFTP dance where you need to constantly upload files to the live host in order to view every change. Version control with git is an option. You can create branches to test new code, try variations, merge working code, or roll back changes when the code isn’t playing nice. Since you aren’t paying anyone to host your local sites, you can set up as many sites as your computer has space for. This means you can test new plugins, themes, or crazy ideas on dummy sites. Because you don’t need an internet connection, you can work offline (on a plane, in the park…) and avoid paying for Wi-Fi.
And these benefits aren’t just for sites that haven’t launched yet. Got a live site that needs updates? No problem. You can bring a copy of the site down from live to your local environment and work on the changes without the live site being impacted, and then upload the changes to the files and/or content when it is perfected.
What Happens at Client Review Time?
Convinced you need to develop locally? Great! But local sites are only visible to you, so you may be wondering how clients can review the site before changes go live.
In order for your clients to see review passes, you could use screen recorder software to walk your clients through each page and feature, but likely they want to experience the site firsthand.
Give your clients access to their site before it is live by copying the site from local to a demo or transferable install, which is password-protected until a hosting package is purchased and is meant to be a temporary place to review a site before going live. Many managed WordPress hosts offer these free of charge with your hosting package. Your client will review, you’ll continue to develop locally for any changes, you’ll push changes from local to live again, and review. Then when the site has been approved, you can make the site live, often with the push of a button that sends the client a hosting bill and then removes the password protection and transfers ownership to them upon payment. Quick, easy, and professional.
And as a pro tip: Even after one of my client’s sites has gone live, I keep the local copy handy for faster testing and troubleshooting if updates or changes are required.
Now you are armed with the knowledge and the benefits to go local. What are you waiting for? Grab a server software program and get to developing with confidence.