Why I use Github Codespaces and why you should try it out.
Starting out as a BackEnd Developer trying to learn front-end development, I usually have a lot of things running on my laptop. A NodeJS application, MongoDB server, web browser and Insomnia are typical things I'd have running while working. These applications made my laptop hot and toasty. Starting a ReactJS application came with its own set of issues. The solution was to get a better laptop. A solution that required money. I had a moderately fast internet connection and did not know that I could use it to access an online computer. It was a no-brainer to apply when GitHub asked for early access applications to codespaces. That was a while ago and I have become an avid user of GitHub codespaces. This article is about what I use GitHub codespaces for and why you might want to check it out. Let's get started.
What is a codespace?
A codespace is a cloud-hosted development environment. It provides a means to create a repeatable codespace configuration for all users of your project. Codespaces run on several VM-based compute options hosted by GitHub, which you can configure from 2 core machines up to 32 core machines. You can connect to your codespaces from the browser or locally using Visual Studio Code.
Why Github codespaces?
I have been using codespaces for a while and I have been enjoying all that it comes with. These features appeal to me as a software developer and make my code writing experience better. Productivity-wise, I have become more efficient with software development and spend less time doing things that usually take time. It is the best anyone can ask for at this moment in time. I have listed some of the features below and I hope you find them helpful.
Setup of environment
All developers live in the constant fear of messing up their local development environment to the point of having to reinstall their OS. It is not rare to forget to create a virtual environment before
pip installing from a requirement file. I couldn't open my terminal for a while because I did some installation that messed up the python version on my Ubuntu Linux laptop. All these fears are irrational in a codespace environment.
A codespace can be initiated with the development environment pre-installed. The fact that the codespace of one project is different from another also help maintain normalcy in the world of complex code dependencies. All you need to get started with a project on GitHub is to initiate its codespace. The default environment supports all major programming languages like NodeJS, Python, GoLang and many more. One can even specify runtime requirements, hardware specs, extensions and editor settings in the
.devcontainer.json configuration files. This file springs up the specified environment in a short time and gets you working in no time. If the repository has no
.devcontainer.json for setting up the project environment, you can install all you need. The fact that you aren't using your local internet makes the installation very fast and It will stay that way until you delete that codespace. Open-Source becomes very easy to get started in the light of these features. Getting an environment setup is something a lot of people don't like to do. We want to write code, fix issues and send in a pull request. GitHub codespaces is a great one in this regard.
Seemless integration with existing development tools.
A lot of developers use GitHub, just like a lot of Open-Source projects can be found there. Setting up the codespace for a project in one click from a projects GitHub page is very useful. The usual workflow would require that you clone the repo, install the dependencies and run the code. Things have changed. You only have to create a codespace for that project and you would find everything already set up for you in your favourite IDE, Visual Studio Code.
If you asked four developers what IDE they use, three will respond with Visual Studio Code. I love Visual Studio Code. It has immense support, an active community and a lot of extensions to make development easier. GitHub codespaces are integrated with VScode. The integration opens up a lot of doors for developers. The first advantage of this integration is the ability to use codespaces on my local installation of VScode. It works like a charm. So good I sometimes forget whether I am on my local machine or using codespaces. I get to keep my shortcuts and themes. You can say, I'm at home while in the cloud. A moderate internet connection makes the experience seamless. While I'm not a fan of it, codespaces can also be accessed through a web browser. However, it is interesting to know that option exists. The VScode integration also allows all Vscode extensions to be usable in a codespace. If your projects use a different extension for different reasons, you can install them without worries. What a time to be alive!
Better Hardware than my Laptop
The default specification of a codespace environment is four cores, 8GB RAM, 32GB ROM. It is more than enough for running my codes without the server even breaking a sweat. GitHub offers higher specs for a little more price if you are ever in need of such power. I see no reason to run the applications on my laptop. An internet connection with moderate speed makes my codes run faster while removing the overhead of running the code from my local machine.
Docker Image building
A lot of my projects are containerized for faster and easier deployment. Building such an image on my laptop is not cost-effective. The price of internet connection plans isn't the cheapest where I live. I am not ready to use all of my internet plan pulling Docker sub-images. Even with the layer caching of Docker, I can still accrue considerable cost by building the Docker images on my laptop. GitHub codespaces help in this regard.
The building of Docker images is seamless on codespaces as I am less concerned about the fluctuations of my internet connection. I can build, tag and push the Docker image to a repository within a short period. The fact that I'm in a VScode environment makes it even better. I get to run the same command that I would run locally to build the images. I get to use the same set of VScode extensions to make building and managing Docker images even easier.
These are the reasons I choose and love to use Github codespaces. Its seamless accessibility and integration are awesome. I believe it will get better and we will get more players in this field. The more the competition, the better it is for us all. Below is a small clip showing how to set up a GitHub codespace for a sample project. Thank you for reading.