Lesson 5.1: Development Environment, Terminal, Packages, and Environment Variables
Lesson Quick-Jump (10 Sections)
1. What Are We Learning?
In this lesson, you will learn how to:
- Understand your development environment (IDE, AI coding agent, runtime, terminal).
- Use basic terminal commands comfortably without fear.
- Understand what package managers do (and how to stay safe when installing packages).
- Configure environment variables safely using
.envand.env.example.
2. Why Does It Matter?
Many beginners get stuck on day one because they don't know where to type commands, why a project needs packages installed, or where secret API keys belong. Worse, beginners sometimes paste secret keys straight into code files and upload them publicly to GitHub—which bots scan and steal within minutes.
Getting your local workspace clean and safe once makes every future coding session smooth.
3. Simple Explanation for a Complete Beginner
Think of your development environment as a clean carpenter's workshop on your computer:
- The IDE (Code Editor): Where you read files, see folder trees, and talk to your AI coding agent (see AI-CODING-AGENTS.md).
- The Terminal (Command Line): A text box inside your editor where you give direct instructions to your computer—like "go into this folder," "install packages," or "start the local server."
- Four commands cover 80% of daily use:
pwd— "Where am I right now?" (prints current folder path)ls(ordiron Windows Command Prompt) — "What files are in this folder?"cd folder-name— "Move intofolder-name" (cd ..moves up one level)- Run commands like
npm run devorpython app.py— "Start the app"
- Four commands cover 80% of daily use:
- Runtime & Package Manager:
- A runtime (such as Node.js or Python) runs your code on your computer.
- A package manager (such as
npmfor JavaScript/TypeScript orpipfor Python) downloads helpful open-source building blocks (dependencies) listed in a manifest file (package.jsonorrequirements.txt).
- Environment Variables (
.env): Values your app needs that either vary by location (local laptop vs. live server) or must stay secret (database passwords, API keys)..envholds your real local secrets and is NEVER committed to GitHub..env.exampleholds dummy placeholder names (likeDATABASE_URL=your_url_here) and IS committed so anyone setting up the project knows which variables are required.
4. Practical Example
Suppose your app connects to a database and sends transactional emails.
Inside .env (private on your computer ONLY):
DATABASE_URL="postgresql://user:real_local_password@localhost:5432/habit_app"
EMAIL_API_KEY="sk_live_secret_12345"
Inside .env.example (safe to share on GitHub):
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
EMAIL_API_KEY="replace_with_your_email_provider_key"
Inside .gitignore (tells Git what to never upload):
.env
.env.local
node_modules/
__pycache__/
5. Step-by-Step Instructions
- Install your chosen runtime (e.g., Node.js LTS or Python) from its official website, and install Git if not already installed.
- Open your code editor / IDE and open its built-in Terminal panel.
- Verify your tools are installed by running version checks in the terminal:
git --version- Plus your stack's runtime check (for example
node --versionandnpm --version, orpython3 --versionandpip --version).
- Practice navigating with
pwd,ls, andcduntil you feel comfortable knowing which folder your terminal is currently inside. - Create a
.env.examplehabit: Whenever an AI agent adds a new config value or API key requirement, insist it updates.env.examplewith a placeholder and confirms.envis listed in.gitignore.
6. Ready-to-Use AI Prompt
Context:
I am setting up my development environment on [Windows / macOS / Linux] for this tech stack: [name your stack from Phase 4].
I am a beginner using the terminal for the first time.
Objective:
Give me an exact, safe setup checklist to verify my runtime, package manager, and environment variable setup before creating the project.
Boundaries:
- Do NOT ask me to paste real passwords or API keys into chat.
- Explain what every terminal command does before asking me to run it.
- Clearly mark which commands are specific to my OS or stack.
Expected Output:
1. Exact commands to check if my runtime, package manager, and Git are installed properly.
2. A starter `.gitignore` and `.env.example` tailored to my chosen stack.
3. Short plain-English explanation of what each installed tool does.
7. What to Expect from the AI Agent
| Good Response | Warning Sign |
|---|---|
The AI explains each terminal command cleanly (e.g., "This checks your Node version without changing any files") and provides an explicit .gitignore covering .env and dependency folders. | The AI tells you to run curl ... | bash from an unfamiliar URL, asks you to disable security permissions, or hardcodes a sample secret directly in source code instead of using environment variables. |
8. What You Must Personally Verify
- Terminal location: Always check
pwdbefore running install or delete commands so you are in the right folder. - Package sanity check: Whenever an AI suggests installing a new package, ask why it is needed and verify the package name is a real, well-known library (AI agents occasionally hallucinate fake package names).
- Secret safety (Mandatory rule): Never paste real API keys, passwords, or
.envcontents into AI chat or code files.
9. Common Mistakes
- Running commands from the wrong folder: Running
npm installin your home directory instead of inside your project folder creates stray files in the wrong place. - Committing
node_modules/or.envto GitHub:node_modules/contains thousands of downloadable files that belong only on your machine, and.envleaks your secrets. - Ignoring terminal error messages: Red text in the terminal usually tells you exactly what is missing (e.g., wrong folder, command not found). Read the first error line carefully instead of retrying blindly.
10. Small Practical Exercise
- Open your IDE's terminal.
- Run
pwd,ls, andgit --version(plus your stack's runtime check). - Create a temporary practice folder (
mkdir setup-test && cd setup-test), verifypwdshows you are inside it, create a sample.env.exampleand.gitignoreusing the AI prompt above, then check withls -lathat hidden dotfiles like.gitignoreappear.
Completed the exercise? Track your progress
Check off this lesson in PROGRESS-CHECKLIST.md once you have verified every step in Section 8.