The Laboratory: Environment Setup
Set up your AI self-growth system development environment from scratch
The Laboratory: Environment Setup
Before you build any system, you need a "laboratory". This chapter walks you through setting up the development environment step by step.
What you will get in this chapter
- A repeatable environment setup workflow
- A minimum viable laboratory (MVS) and acceptance criteria
- Fast troubleshooting for common issues
One-sentence definition
Laboratory = a repeatable dev environment that lets the system run at any time.
Minimum viable laboratory (MVS)
| Area | You need | Acceptance result |
|---|---|---|
| Runtime | Node.js + pnpm | Scripts can run |
| Editor | Cursor / VS Code | Can call AI |
| Deployment | Vercel | Can deploy |
| Database | Supabase | Project created |
| API | OpenAI / DeepSeek | API call succeeds |
Qualified signal: the Hello World script runs and prints output.
Core metrics (must track)
Definition (default):
- Time window: unless stated otherwise, use the last 7 days rolling.
- Data source: use one trusted source (GA4/GSC/platform console/logs) and keep it consistent.
- Scope: only the current product/channel, exclude self-tests and bots.
| Metric | Meaning | Pass line |
|---|---|---|
| Environment Ready | Environment setup completion | 100% |
| First Run | Hello World runs successfully | Must pass |
| First Deploy | Time to first deploy | <= 30 minutes |
Why this chapter?
Many people read the theory, feel excited, then open their laptop and realize they do not know what to open.
This chapter solves that. We will set up everything so you can:
- Use AI to help write code (Cursor)
- Deploy a site in one click (Vercel)
- Store data (Supabase)
- Call AI APIs (OpenAI / DeepSeek)
Estimated time: 1-2 hours
Prerequisites
Before you start, make sure you have:
Step 1: Install Node.js
Node.js is the runtime for JavaScript/TypeScript. Most of our code needs it.
Download and install
- Visit nodejs.org
- Download the LTS version (more stable)
- Install it
Verify installation
Open a terminal (Windows: PowerShell, Mac: Terminal), run:
node --versionIf you see something like v20.10.0, it worked.
Install pnpm (recommended)
pnpm is a faster package manager than npm. Install it:
npm install -g pnpmVerify:
pnpm --versionStep 2: Install Cursor (AI code editor)
Cursor is an editor with built-in AI. It can write, explain, and fix code for you.
Download and install
- Visit cursor.com
- Download the right version for your OS
- Install and open it
First-time setup
- Log in (GitHub login works)
- Choose your keymap (if you used VS Code, choose VS Code)
- Cursor free plan includes monthly AI calls, enough for learning
Your first AI chat
In Cursor, press Cmd + L (Mac) or Ctrl + L (Windows) to open the AI chat.
Try:
Write a Hello World program in Node.jsAI will generate code. Click "Apply" to insert it into the editor.
Step 3: Set up Vercel (deployment)
Vercel lets you deploy websites in one click, free for small projects.
Register
- Visit vercel.com
- Click "Sign Up"
- Choose "Continue with GitHub"
- Authorize Vercel to access your GitHub
Verify
You should see the Vercel dashboard. No further setup needed now.
Step 4: Set up Supabase (database)
Supabase is an open-source Firebase alternative providing Postgres, auth, storage, and more.
Register
- Visit supabase.com
- Click "Start your project"
- Sign in with GitHub
Create your first project
- Click "New Project"
- Choose an organization (or create one)
- Fill in:
- Name:
my-first-asgs(or any name) - Database Password: set a strong password (save it)
- Region: choose the closest region
- Name:
- Click "Create new project"
After creation, open the project settings and find API:
- Save
Project URL - Save the
anon publickey
You will use these later.
Step 5: Get an AI API key
OpenAI API
- Visit platform.openai.com
- Sign in or register
- Open the "API Keys" page
- Click "Create new secret key"
- Copy and save it (shown only once)
Note: OpenAI is paid, but new users often get free credits.
DeepSeek API (cheaper alternative)
If you want to save money, DeepSeek is a good alternative:
- Visit platform.deepseek.com
- Register
- Get an API key
DeepSeek is about 1/10 the price of OpenAI, with solid quality.
Step 6: Create your first project
Now connect everything and create a real project.
Create a project folder
Open a terminal and run:
mkdir my-first-asgs
cd my-first-asgs
pnpm initCreate a config file
Create .env at the project root:
# .env - store your API keys
# Do not commit this file to Git!
OPENAI_API_KEY=sk-your-openai-key-here
DEEPSEEK_API_KEY=sk-your-deepseek-key-here
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-anon-key-hereCreate .gitignore
# .gitignore - tell Git to ignore these
.env
node_modules/
.DS_StoreHello World script
Create hello.js:
// hello.js - your first ASGS script
const fs = require('fs');
// Current time
const now = new Date().toISOString();
// Content to write
const content = `
# My first ASGS log
Generated at: ${now}
This file is auto-generated.
If you can read this line, your environment setup worked!
## Next steps
1. Read Ch01: What is an AI self-growth system
2. Modify this script to do more
3. Start building your own self-growth system
`;
// Write file
fs.writeFileSync('output.md', content);
console.log('OK: file generated: output.md');
console.log('Done! Your environment setup is complete.');Run it:
node hello.jsIf you see the success message and output.md exists, you are ready.
Common commands cheat sheet
| Command | What it does |
|---|---|
| node --version | Check Node.js version |
| pnpm init | Initialize a new project |
| pnpm install | Install dependencies |
| pnpm add <package> | Add a dependency |
| node script.js | Run a JavaScript file |
| git init | Initialize a Git repo |
| git push | Push code to a remote repo |
Common errors
Error 1: node command not found
Cause: Node.js is not in PATH.
Fix: Restart the terminal, or reinstall Node.js and check "Add to PATH".
Error 2: pnpm install fails
Fix: Use npm instead:
npm installError 3: API key invalid
Check:
- No extra spaces in the key
- Account has balance
- Key is not expired
Acceptance checklist
Summary
Congrats! Your laboratory is ready. Now read Ch01 to understand what an AI self-growth system is, then start building your first system.
AI Practice Knowledge Base