πŸ”§ Part 1 β€” Foundations

Key idea: Before you write a single line of backend code, your machine needs to be set up correctly. This section walks you through every step β€” from installing your IDE to running your first Python program. Future sections assume you have completed this setup.

The goal is not to memorise commands. The goal is to understand the system. Every tool exists to solve a problem β€” understand why it exists, not just how to use it.


← Handbook Home Part 2: Backend β†’

1. Full Development Environment Setup

This is the most important section in the handbook. Get everything here working before moving forward. When something goes wrong in a later section, the first question will always be: β€œDid you complete the setup checklist in Part 1?”


1.1 Choose Your IDE β€” VS Code or PyCharm?

An IDE (Integrated Development Environment) is the app you use to write, run, and debug code. Think of it as a text editor with superpowers β€” it highlights errors, lets you run code, shows you your files, and includes a terminal.

You have two great options for Python. Pick one and stick with it β€” do not install both and switch back and forth while you’re learning.

Side-by-Side Comparison

Feature 🟦 VS Code 🟩 PyCharm
Cost Free, open source Free Community edition; paid Professional
Weight Lightweight (~100 MB) Heavier (~700 MB+)
Setup effort A few extensions needed Python-ready out of the box
Best for All languages, flexible Python/Django/FastAPI projects
Virtual env detection Manual (select interpreter) Automatic (detects venv on open)
Beginner friendliness ⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
Professional use Very common Common in Python-heavy teams

Recommendation: Start with VS Code β€” it is the most widely used editor on real engineering teams and works for every language you’ll ever encounter. PyCharm is an excellent alternative if you find VS Code confusing or want automatic Python setup.


1.2 Installing VS Code

Download: code.visualstudio.com

πŸͺŸ Windows
  1. Go to code.visualstudio.com and click Download for Windows.
  2. Run the downloaded .exe installer.
  3. On the β€œSelect Additional Tasks” screen, tick both of these:
    • βœ… Add "Open with Code" action to Windows Explorer file context menu
    • βœ… Add to PATH (requires shell restart)
  4. Finish the installer and reopen any terminal windows.
  5. Verify: open a terminal and run code --version. You should see a version number.

Common issue: If code is not recognised after install, restart your computer to apply the PATH change.

🍎 Mac
  1. Go to code.visualstudio.com and click Download for Mac.
  2. Open the downloaded .zip β€” it extracts Visual Studio Code.app.
  3. Drag Visual Studio Code.app into your Applications folder.
  4. Open VS Code, then press Cmd+Shift+P, type shell command, and select β€œShell Command: Install β€˜code’ command in PATH”.
  5. Verify: open Terminal and run code --version.

Common issue: β€œVS Code cannot be opened because it is from an unidentified developer.” Go to System Settings β†’ Privacy & Security and click Open Anyway.

🐧 Linux (Ubuntu/Debian)
# Download and install the Microsoft GPG key and repository
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

# Install VS Code
sudo apt update
sudo apt install code

Verify: run code --version.

Install Essential VS Code Extensions

After installing VS Code, add these extensions (they make Python development much easier):

  1. Press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (Mac) to open the Extensions panel.
  2. Search for and install each of these:
Extension Publisher Why you need it
Python Microsoft Syntax highlighting, linting, debugger, interpreter selection
Pylance Microsoft Smarter code completion and type checking
GitLens GitKraken See who changed what and when, right in the editor
Docker Microsoft View and manage containers from the sidebar

1.3 Installing PyCharm (Alternative)

Download: jetbrains.com/pycharm/download

Download the Community edition β€” it is free and covers everything in this handbook.

πŸͺŸ Windows
  1. Download the Community installer (.exe).
  2. Run it and follow the wizard.
  3. On the Installation Options screen, tick β€œAdd launchers to PATH” so you can open PyCharm from a terminal.
  4. Launch PyCharm from the Start menu after install.
🍎 Mac
  1. Download the Community .dmg.
  2. Open the .dmg and drag PyCharm CE into Applications.
  3. Open PyCharm from Applications β€” macOS may ask you to confirm opening an app from the internet; click Open.
🐧 Linux
# Install using the JetBrains Toolbox (recommended) or snap
sudo snap install pycharm-community --classic

Or download the .tar.gz from the website, extract it, and run bin/pycharm.sh.

PyCharm First-Run Setup

  1. On first launch, PyCharm asks about plugins β€” skip and use defaults.
  2. Choose New Project to create your first project (covered in section 1.7).
  3. PyCharm automatically detects Python installed on your machine β€” you’ll see it pre-selected in the interpreter dropdown.

PyCharm tip: Unlike VS Code, PyCharm creates a virtual environment automatically when you create a new project. It also shows you which interpreter is active in the bottom-right status bar at all times.


1.4 Installing Python

Python is the programming language this handbook is built around.

Download: python.org/downloads

Always install Python 3.11 or newer. Python 2 is obsolete β€” do not install it.

πŸͺŸ Windows
  1. Go to python.org/downloads and click the latest Python 3.x.x button.
  2. Run the downloaded .exe installer.
  3. ⚠️ Critical step: On the first screen, tick β€œAdd Python to PATH” before clicking Install Now.

    β˜‘ Add Python 3.x to PATH    ← TICK THIS or python won't work in any terminal
    
  4. Click Install Now.
  5. Once done, open a new terminal window (important β€” old windows don’t see the new PATH) and verify:

    python --version
    

    Expected output: Python 3.11.x (or newer)

Common Windows issues:

Problem What you see Fix
Forgot to add to PATH 'python' is not recognized as an internal or external command Reinstall Python and tick β€œAdd to PATH”, or add it manually via System Properties β†’ Environment Variables
Python opens Microsoft Store Microsoft Store opens instead of Python Go to Settings β†’ Apps β†’ Advanced app settings β†’ App execution aliases and turn off python.exe and python3.exe
Wrong version Python 2.7.x You have Python 2 installed β€” use python3 command instead, or uninstall Python 2
🍎 Mac

macOS comes with Python 2 pre-installed (old and unusable for our purposes). Install Python 3 separately.

Option A β€” Official installer (recommended for beginners):

  1. Download from python.org/downloads β€” the macOS installer .pkg.
  2. Run the package installer and follow the steps.
  3. After install, run the SSL certificate fixer that comes with it:

    /Applications/Python\ 3.11/Install\ Certificates.command
    

    (Replace 3.11 with your installed version number.)

  4. Verify in Terminal:

    python3 --version
    

Option B β€” Homebrew (for developers who already have Homebrew):

brew install python@3.11

Common Mac issues:

Problem Fix
python: command not found Use python3 β€” macOS ships Python 2 as python
SSL: CERTIFICATE_VERIFY_FAILED Run the Install Certificates script from the Python Applications folder
zsh: command not found: python3 Python not on PATH β€” add to ~/.zshrc: export PATH="/usr/local/bin:$PATH"
🐧 Linux (Ubuntu/Debian)
# Update package list
sudo apt update

# Install Python 3.11
sudo apt install python3.11 python3.11-venv python3-pip -y

# Verify
python3.11 --version
python3 --version
pip3 --version

Tip: On Ubuntu 22.04+, python3 is Python 3.10+. Use python3.11 explicitly if you need that specific version.


1.5 Installing Git

Git is the tool that tracks every change you make to your code. It lets you go back in time, work in teams, and share code on GitHub.

Download: git-scm.com


1.5a Sign Up for a GitHub Account

GitHub is the platform where your code lives online. Think of it as a combination of a cloud backup for your code and a social network for developers. You will push your projects here so the team can see your work, review it, and collaborate with you.

Create Your Account

  1. Go to github.com and click Sign up.
  2. Enter your email address and click Continue.
  3. Create a password (use something strong β€” at least 12 characters).
  4. Choose a username. This will appear on all your commits and repos β€” keep it professional (e.g., jane-smith or jsmith-dev).
  5. Complete the verification puzzle, then check your email for the verification code.
  6. On the β€œWelcome to GitHub” screen, you can skip or answer the questions about your use β€” click Continue until you reach the dashboard.

You’re in! Your GitHub dashboard is at github.com/<your-username>.


Connect Git on Your Machine to GitHub

After installing Git (section 1.5), you need to authenticate so GitHub accepts your pushes. The most secure method is Personal Access Tokens (PAT).

Step 1 β€” Set your identity in Git
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Use the same email address you signed up to GitHub with β€” this links your commits to your account.

Step 2 β€” Generate a Personal Access Token (PAT)

A PAT is like a password for the terminal. GitHub no longer accepts your account password for Git operations.

  1. Log in to github.com.
  2. Click your profile photo (top-right) β†’ Settings.
  3. In the left sidebar, scroll down and click Developer settings.
  4. Click Personal access tokens β†’ Tokens (classic).
  5. Click Generate new token β†’ Generate new token (classic).
  6. Give it a name (e.g., My Laptop Token).
  7. Set Expiration to 90 days (or No expiration for personal learning machines).
  8. Under Scopes, tick βœ… repo (this covers all repo operations you’ll need).
  9. Click Generate token.
  10. Copy the token immediately β€” GitHub will not show it again.

Save your token in a password manager or a secure note. You will need it the first time you push from this machine.

Step 3 β€” First Push (entering your token)

The first time you run git push, Git will prompt you for credentials:

πŸͺŸ Windows

A dialog box called Windows Credential Manager will pop up. Enter:

  • Username: your GitHub username
  • Password: paste your PAT (not your account password)

Git stores this securely β€” you won’t be asked again on this machine.

🍎 Mac

The macOS Keychain dialog will appear. Enter:

  • Username: your GitHub username
  • Password: paste your PAT

macOS stores it in Keychain β€” you won’t be prompted again.

🐧 Linux
# Enable credential caching so Git remembers for 1 hour
git config --global credential.helper cache

The first push will prompt for username and password β€” enter your GitHub username and paste the PAT as the password.

Tip: If you push and see remote: Support for password authentication was removed, it means you used your GitHub password instead of a PAT. Create a new PAT and use that.


πŸͺŸ Windows
  1. Download the Git for Windows installer from git-scm.com.
  2. Run the installer β€” you can accept defaults on most screens.
  3. On the screen β€œChoosing the default editor used by Git”, select VS Code from the dropdown if you installed it.
  4. On β€œAdjusting your PATH environment”, keep the default: Git from the command line and also from 3rd-party software.
  5. Finish the install.

After install, you now have Git Bash β€” a Unix-style terminal on Windows. You can use this instead of Command Prompt for all terminal commands in this handbook.

Verify (open Git Bash or PowerShell):

git --version

Expected: git version 2.x.x

🍎 Mac

Option A β€” Xcode Command Line Tools (simplest):

xcode-select --install

A dialog will appear β€” click Install. This installs Git (and other dev tools) automatically.

Option B β€” Homebrew:

brew install git

Verify:

git --version
🐧 Linux (Ubuntu/Debian)
sudo apt update
sudo apt install git -y

git --version

First-Time Git Configuration

After installing Git on any OS, tell it your name and email. Git uses this to label your commits.

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

You only do this once per machine. It applies to all your Git projects.


1.6 Installing Docker Desktop

Docker lets you run software in isolated containers β€” same code, same environment, on any machine. You’ll use it later for running databases and packaging your API.

Download: docker.com/products/docker-desktop

πŸͺŸ Windows
  1. Download Docker Desktop for Windows.
  2. Run the installer. It may prompt you to enable WSL 2 (Windows Subsystem for Linux) β€” click Enable/Install if asked. This is required.
  3. Restart your computer if asked.
  4. Launch Docker Desktop from the Start menu β€” it starts in the background (look for the whale icon in the system tray).

Verify (in any terminal):

docker --version
docker compose version

Common Windows issues:

Problem Fix
β€œWSL 2 installation is incomplete” Open PowerShell as Admin and run: wsl --update
Docker Desktop won’t start Make sure virtualisation is enabled in BIOS (usually is on modern PCs)
docker: command not found Docker Desktop is not running β€” start it from the Start menu
🍎 Mac
  1. Download Docker Desktop for Mac β€” choose Apple Silicon (M1/M2/M3) or Intel based on your Mac.
  2. Open the .dmg and drag Docker to Applications.
  3. Open Docker from Applications β€” it starts in the background (whale icon in the menu bar).
  4. Wait for the whale icon to become steady (not animated) β€” Docker is ready.

Verify:

docker --version
docker compose version
🐧 Linux (Ubuntu)
# Install Docker Engine
sudo apt update
sudo apt install ca-certificates curl -y
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
  https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

# Run Docker without sudo (log out and back in after this)
sudo usermod -aG docker $USER

Verify after logging out and back in:

docker --version
docker compose version

Note: On Linux there is no Docker Desktop GUI β€” Docker runs as a background service. This is fine for this handbook.


1.7 Verify All Installations

Open a terminal (Git Bash on Windows, Terminal on Mac/Linux) and run each command. Every command should return a version number β€” not an error.

# Check Python
python --version         # Windows
python3 --version        # Mac / Linux

# Check pip (Python package manager)
pip --version            # Windows
pip3 --version           # Mac / Linux

# Check Git
git --version

# Check Docker
docker --version
docker compose version

Expected output (your exact versions may differ β€” that’s fine):

Python 3.11.9
pip 23.3.1 from ...
git version 2.44.0
Docker version 26.1.1
Docker Compose version v2.27.0

⚠️ If any command gives an error, stop here and fix it before continuing. Every other part of this handbook depends on these tools working.


1.8 Open a Project in Your IDE

Now that everything is installed, let’s open a project folder and get comfortable in the IDE.

VS Code

  1. Create a new folder on your computer called hello-project (anywhere you like β€” your Desktop or Documents is fine).
  2. Open VS Code.
  3. Go to File β†’ Open Folder and select hello-project.
  4. VS Code opens the folder. The left sidebar shows your project files (currently empty).

Open the integrated terminal in VS Code:

A terminal panel opens at the bottom, already pointing to your project folder. You can run all commands from here β€” you do not need a separate terminal window.

Select the Python interpreter in VS Code:

  1. Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac) to open the Command Palette.
  2. Type Python: Select Interpreter and press Enter.
  3. Choose the Python version you installed (e.g., Python 3.11.x).

Common issue: If no Python shows up, VS Code can’t find it. Make sure Python is on your PATH (check by running python --version in the terminal). If it works in the terminal but not in VS Code, restart VS Code.

PyCharm

  1. Open PyCharm.
  2. Click New Project.
  3. Set the Location to a folder called hello-project.
  4. Under Python Interpreter, select New environment using Virtualenv β€” PyCharm will create a venv automatically.
  5. Click Create.

Open the terminal in PyCharm:

Check the active interpreter in PyCharm:

Look at the bottom-right corner of the PyCharm window. It shows the active Python interpreter (e.g., Python 3.11 (hello-project)). Click it to change.


1.9 Create and Activate a Virtual Environment

A virtual environment (venv) is an isolated box of Python packages for your project. It prevents version conflicts between projects and keeps your global Python installation clean.

Every project should have its own venv. This is non-negotiable on real teams.

Skip this section if you are using PyCharm β€” PyCharm already created the venv for you in step 1.8.

Step 1 β€” Create the virtual environment

Open the terminal in your IDE (or any terminal) and make sure you are in your project folder:

# Make sure you are in your project folder
cd hello-project     # skip if you are already there

Now create the venv:

OS Command
πŸͺŸ Windows python -m venv venv
🍎 Mac python3 -m venv venv
🐧 Linux python3 -m venv venv

This creates a folder called venv/ inside your project. You only do this once per project.

Step 2 β€” Activate the virtual environment

You must activate the venv every time you open a new terminal window. When active, your terminal prompt shows (venv) at the start.

OS Command
πŸͺŸ Windows (PowerShell) venv\Scripts\Activate.ps1
πŸͺŸ Windows (Command Prompt) venv\Scripts\activate.bat
πŸͺŸ Windows (Git Bash) source venv/Scripts/activate
🍎 Mac source venv/bin/activate
🐧 Linux source venv/bin/activate

After activation, your prompt looks like this:

(venv) user@machine:~/hello-project$     ← (venv) means it's active

Step 3 β€” Verify the venv is active

# Should show a path inside your project's venv folder
which python          # Mac / Linux
where python          # Windows

Expected output (Mac/Linux):

/home/yourname/hello-project/venv/bin/python

Expected output (Windows):

C:\Users\yourname\hello-project\venv\Scripts\python.exe

If it shows a system path instead (like /usr/bin/python), the venv is not activated.

Deactivate when done

deactivate

Common venv errors

Error Cause Fix
No such file or directory: venv/bin/activate venv not created yet Run the python -m venv venv command first
Activate.ps1 cannot be loaded because running scripts is disabled Windows PowerShell security policy Run: Set-ExecutionPolicy RemoteSigned -Scope CurrentUser and try again
python: command not found after activation venv was created with a Python that is no longer on PATH Delete the venv folder and recreate it: rm -rf venv && python3 -m venv venv
Packages installed but not found venv is not activated Activate it first β€” check for (venv) in your prompt
Wrong Python version in venv System Python is old Specify the version: python3.11 -m venv venv

1.10 Your First Python Hello World Project

Now you will write and run your first Python program. No extra packages needed β€” just Python and your venv.

Create the file

In your IDE, create a new file called hello.py in your project folder:

VS Code: Click the New File icon in the Explorer sidebar (or File β†’ New File), name it hello.py.

PyCharm: Right-click the project folder in the Project panel β†’ New β†’ Python File β†’ name it hello.

Write the code

# hello.py
# This is your first Python program.
# The print() function outputs text to the terminal.

print("Hello, world!")

That’s it. One line of real Python code.

Run from the terminal

Make sure your venv is active ((venv) in the prompt), then:

python hello.py         # Windows
python3 hello.py        # Mac / Linux

Expected output:

Hello, world!

If you see Hello, world! β€” your setup is working. πŸŽ‰

Run from VS Code

  1. Open hello.py in VS Code.
  2. Click the β–Ά Run button in the top-right corner of the editor, OR press F5.
  3. A terminal panel opens at the bottom and shows the output.

Common issue: VS Code runs with the wrong Python. Check the bottom-left status bar β€” it should show your venv Python path (e.g., Python 3.11.x ('venv': venv)). If it shows the global Python, click the interpreter name and select your venv.

Run from PyCharm

  1. Open hello.py in PyCharm.
  2. Right-click in the editor β†’ Run β€˜hello’, OR press Shift+F10.
  3. The output panel at the bottom shows Hello, world!.

PyCharm note: The Run button only appears once you have a Python file open. If you see a grey triangle (not green), make sure the interpreter at the bottom-right is set to your venv.

Common run errors

Error What it means Fix
ModuleNotFoundError: No module named 'hello' You ran python hello instead of python hello.py Add .py extension: python hello.py
SyntaxError: invalid syntax Typo in your code Check the line number in the error β€” look for missing quotes or brackets
NameError: name 'Print' is not defined Python is case-sensitive β€” Print β‰  print Use lowercase: print("Hello, world!")
IndentationError Unexpected spaces or tabs Python cares about indentation β€” remove any accidental spaces before print
No such file or directory: hello.py You are not in the right folder Run cd hello-project first, then run the file

1.11 Initialize Your Demo Project and Push to GitHub

Now that your IDE is set up, your venv is active, and you have a working hello.py, it’s time to put your project under version control and push it to GitHub. This is what you will do every time you start a new project or mini exercise.

Why push to GitHub? The team reviews your work from GitHub, not from your local machine. If it is not on GitHub, it does not exist from the team’s perspective. Make it a habit β€” push early and push often.

Step 1 β€” Create a .gitignore file

Before initialising Git, tell it which files to ignore. The venv/ folder is large and machine-specific β€” never commit it.

Create a file called .gitignore in your project root:

venv/
__pycache__/
*.pyc
*.pyo
.env
.DS_Store

Step 2 β€” Initialise Git in your project folder

In your terminal (with venv active, inside hello-project/):

git init

This creates a hidden .git/ folder β€” Git now tracks changes in this folder.

Step 3 β€” Stage and commit your files

# Stage all files (hello.py and .gitignore)
git add .

# Commit with a descriptive message
git commit -m "Initial commit: hello world project"

Run git status to confirm there is nothing left unstaged.

Step 4 β€” Create a repository on GitHub

  1. Go to github.com and log in.
  2. Click the + icon (top-right) β†’ New repository.
  3. Fill in:
    • Repository name: hello-project (match your local folder name)
    • Description: My first Python hello world project (optional but good practice)
    • Visibility: Public (so the team can see it) or Private
    • Do NOT tick β€œAdd a README” or any other options β€” you already have files locally
  4. Click Create repository.

GitHub shows you a page with setup instructions β€” you only need the β€œβ€¦or push an existing repository from the command line” section.

Step 5 β€” Connect your local project to GitHub

Copy and run the commands GitHub shows. They look like this (with your actual username and repo name):

git remote add origin https://github.com/your-username/hello-project.git
git branch -M main
git push -u origin main

When prompted:

Step 6 β€” Verify on GitHub

Reload your GitHub repository page β€” you should see hello.py and .gitignore listed.

πŸŽ‰ Your first project is live on GitHub!

Future pushes (after the first)

Once the remote is set up, pushing new changes is just:

git add .
git commit -m "Describe your change"
git push

You won’t need to enter credentials again (they were cached in step 3 of section 1.5a).


1.12 Setup Checklist βœ…

Go through each item below. Do not move to Part 2 until every box is ticked.

All boxes ticked? You have a fully working development environment. Everything in the rest of this handbook builds on this foundation.

Stuck on something? Check the error tables in each section above. If you’re still stuck, search the exact error message β€” you are very unlikely to be the first person to see it.


2. How to Approach Learning

The goal is not to memorise commands. The goal is to understand the system.

Every tool exists to solve a problem. Before using a tool, ask:


3. Common Setup Failures

These are the most common problems beginners hit. Check here before asking for help.

Error Cause Fix
command not found: python Python not installed or not on PATH Install Python; on Windows, tick β€œAdd Python to PATH” during install
python opens the Microsoft Store (Windows) Windows App Execution Aliases intercepting Disable in Settings β†’ Apps β†’ Advanced app settings β†’ App execution aliases
command not found: docker Docker Desktop not installed Install Docker Desktop
Docker commands fail Docker Desktop is not running Launch the Docker Desktop app from your applications folder
docker compose not found Old Docker version uses docker-compose (hyphen) Update Docker Desktop, or use docker-compose (with hyphen)
Permission denied (Mac/Linux) Running Docker without sudo or group membership Add your user to the docker group: sudo usermod -aG docker $USER then log out and back in
SSL: CERTIFICATE_VERIFY_FAILED (Mac) Python SSL certificates not installed Run /Applications/Python\ 3.x/Install\ Certificates.command
VS Code can’t find Python Python not on PATH or wrong interpreter Press Ctrl+Shift+P β†’ β€œPython: Select Interpreter” and choose the correct one

4. Git Mental Model

Git tracks your code across four states:

Working Directory β†’ Staging β†’ Commit β†’ Remote
State What it means
Working Directory Files on your machine that you are editing right now
Staging Files you have marked to include in the next commit (git add)
Commit A saved snapshot stored in your local Git history
Remote The commit pushed to GitHub where others can see it

Git Basics

Before you start, tell Git who you are (do this once):

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Initialise a new repository:

git init

Check what has changed (run this often):

git status

Stage all changed files:

git add .

Create a commit with a description:

git commit -m "Describe what you changed and why"

Push to remote (GitHub):

git push

Branching Workflow

Rules (non-negotiable):

# Start from the latest main branch
git checkout main
git pull

# Create and switch to a new branch for your task
git checkout -b feature/my-task

# Do your work, then stage and commit
git add .
git commit -m "Add my feature"

# Push the branch to GitHub so others can see it
git push -u origin feature/my-task

Common Git Problems

Problem Cause Fix
Push rejected Remote has commits you don’t have locally git pull first, resolve any conflicts, then git push
Merge conflict Two branches changed the same lines Manually resolve conflicts, remove the conflict markers, then commit
Working on wrong branch Forgot to create a branch before coding git stash, create the correct branch, then git stash pop
fatal: not a git repository You’re not in a git repo folder Run git init or cd into the correct project folder

5. Internet Flow and HTTP Basics

How the Internet Works

Client β†’ HTTP Request β†’ Server β†’ HTTP Response β†’ Client
  1. You type a URL or click a button in a browser
  2. Your browser (the client) sends an HTTP request to a server
  3. The server processes the request (runs code, queries the database)
  4. The server sends back an HTTP response with data
  5. Your browser renders the response

HTTP Methods

Method Purpose Example
GET Retrieve data (no side effects) Get a list of users
POST Create new data Create a new user
PUT Replace existing data completely Update all fields of a user
PATCH Update part of existing data Update just a user’s name
DELETE Delete data Delete a user

HTTP Status Codes

Code Meaning When you see it
200 OK Request succeeded (GET, PUT, PATCH)
201 Created A new resource was created (POST)
400 Bad Request Client sent invalid or malformed data
404 Not Found The resource you asked for does not exist
422 Unprocessable Entity Data format is valid but fails validation rules
500 Internal Server Error Something broke on the server side

6. Terminal Basics

If you are new to the terminal, here are the most important commands:

Command What it does Example
pwd Print working directory (where am I?) pwd
ls (Mac/Linux) / dir (Windows) List files in current folder ls
cd <folder> Change directory cd my-project
cd .. Go up one directory cd ..
mkdir <name> Create a new folder mkdir backend
touch <file> (Mac/Linux) Create a new empty file touch main.py
cat <file> Print file contents cat requirements.txt
Ctrl+C Stop a running program Use when the server is running and you want to stop it

Windows users: Use Git Bash (installed with Git) or Windows Terminal with PowerShell. Many Unix commands like ls and touch work in Git Bash.


Part 1 Summary

Concept Key Takeaway
Dev environment Install VS Code (or PyCharm), Python 3.11+, Git, Docker Desktop β€” verify all with version commands
IDE setup Open project folder, use IDE terminal, select Python interpreter from venv
Virtual environment Create once per project (python -m venv venv), activate every terminal session
Hello World python hello.py prints Hello, world! β€” confirms your entire setup works
GitHub account Sign up at github.com, generate a PAT, use it as your password when pushing
Push to GitHub git init β†’ git add . β†’ git commit β†’ create GitHub repo β†’ git push
Learning approach Understand systems, not just commands
Git model Working Directory β†’ Staging β†’ Commit β†’ Remote
Branching Always branch, never commit directly to main
HTTP Every web interaction is a request/response cycle
Terminal Learn the basic navigation commands β€” you’ll use them every day

← Handbook Home Part 2: Backend β†’