As a developer, you will work on many coding projects simultaneously; it can quickly become a mess if you don't organize yourself. Don't be the person who has to wait until you lose the project code to learn your lesson. A well-structured workflow and setup will help you:
This lesson will discuss the best practices for setting up your local development environment and workflow on any operating system (Windows, Mac, and Linux computers).
Use a consistent directory structure to organize your projects. This makes switching between projects and navigating and managing your code easier. The following are the recommended directories to save your projects and code:
C:\Users\<YourUsername>\MyDocuments\Code
/Users/<YourUsername>/Documents/Code
/home/<YourUsername>/Documents/Code
The following steps will guide you on how to create this root directory depending on your operating system:
Loading... Loading... Loading...
You cannot work and/or collaborate on multiple projects without using a version control system like Git and Github.
Every time you start working on a project, you will make changes to the files and those updates will be recorded and tracked by git:
An "environment" refers to the setup or configuration under which a project runs. Ideally, you have one environment for one project, which means you will have as many environments as projects.
There are several reasons; let's focus on one: programming language Versions.
Technology evolves too fast: If you start a project in Node v12
it will become obsolete after a few months.
To avoid errors, you must freeze in time
all the project dependencies (libraries, programing language version, etc.).
๐ Learn more about creating environments in programming
Another reason is privacy and security when integrating with other APIs. For example, you need to use API credentials (API Keys) to make an API call to the TikTok API. If these credentials are typed directly into your code, they are exposed to the public, and anyone can use the TikTok API on your behalf. To avoid security incidents, you have to use environment variables.
๐ Learn more about environment variables in programming
Once you have your environment ready, it is standard to create a file called .env
that will not be uploaded to Github because it will be ignored by Git (the version control system).
These instructions vary depending on the programming language you choose to install; we recommend having at least Node
and Python
, so here are the instructions for both languages.
We strongly recommend installing Node
and Python
using version managers instead of installing the programming language in an isolated way.
Pyenv is a tool for managing different versions of Python on our computer. It makes it easy to switch between versions as needed for our developing environment. Click here to learn how to install PyEnv on your local computer.
NVM (node version manager) allows you to manage multiple Javascript projects and Node.js environments and switch between them depending on the project's needs. Click here to learn how to install NVM on every operating system.
By following these best practices, students will be able to create a robust and organized local development environment that supports efficient and effective coding.