Chapter 01: Environment Setup
Understand why mise/bun/OpenRouter, then install and smoke-test each piece before scaffolding the project.
TUTOR WITH THEFOCUS.AI
Copy this prompt into Claude, ChatGPT, or any external AI assistant. It points the assistant to the course instructions and links it to your student profile to track your progress and customize observations.
You are not enrolled yet. Enroll to generate a Student ID to track lesson completions and store learning notes.
Chapter 01: Environment Setup
Objective
Set up a reproducible local environment: mise (tool versions), bun (TypeScript runtime), and an OpenRouter API key so later chapters can call LLMs without reinventing setup.
Your tutor walks this gate by gate — one install, one verify — not one mega paste.
Concept: Why this stack
| Piece | Job |
|---|---|
| mise | Pins runtimes/tools so “works on my machine” is a config file, not luck |
| bun | Fast TS runtime/package runner for the agent project |
| OpenRouter | One API key → many models; swap models with an env var |
You are not installing “random tools.” You are making the rest of the course repeatable.
Concept check
Q1. Why pin tools with mise instead of “install whatever Node is on the laptop”?
Q2. What problem does OpenRouter solve compared to separate keys for every model vendor?
Concept answer key — attempt first
Answer key (concept)
Q1
Model answer: Reproducible versions across machines/sessions; the project declares what it needs.
Pass criteria: reproducibility / version pin
Q2
Model answer: One gateway/key; easy model swaps without re-plumbing auth.
Pass criteria: single key / multi-model routing
Gate: Install mise
curl https://mise.run | sh
Restart the terminal if needed. Verify:
mise --version
Stop if this fails.
Gate: Install bun via mise
mise use bun
bun --version
Pass: version string prints.
Gate: OpenRouter key + project dir
- Create a key at openrouter.ai/settings/keys
- Create the project:
mkdir weekend-coding-agent
cd weekend-coding-agent
- Env + gitignore:
echo 'OPENROUTER_API_KEY=sk-or-v1-your-key-here' > .env
echo 'AGENT_MODEL=google/gemini-3-pro-preview' >> .env
echo '.env' >> .gitignore
Never commit .env.
Optional model: anthropic/claude-opus-4.5.
- Lock tools:
# mise.toml
[tools]
bun = "latest"
Pass: ls shows .env, .gitignore, mise.toml; tutor confirms you did not paste the real key into chat.
What We Have Now
weekend-coding-agent/
├── .env # OPENROUTER_API_KEY and AGENT_MODEL
├── .gitignore # includes .env
└── mise.toml # bun version locked
Later chapters build src/ step by step. Do not jump ahead until this gate is green.
Check your understanding
Q3. What is the smoke test for “bun is ready” in this lesson?
Q4. Why does the lesson put secrets in .env and force .gitignore before any agent code?
Answer key — attempt every question first
Answer key
Q3
Model answer: bun --version (after mise use) succeeds.
Pass criteria: version command
Q4
Model answer: Avoid committing API keys; separate config from code from the start.
Pass criteria: secrets hygiene