Understanding Codespaces
Learn what GitHub Codespaces are, how they work, and what happens when they stop or get deleted.
Understanding GitHub Codespaces
PhantomWP uses GitHub Codespaces to provide you with a powerful development environment right in your browser. This guide explains what Codespaces are and how they behave.
What is a GitHub Codespace?
Think of a GitHub Codespace as a remote computer in the cloud that's specifically set up for your project. Just like your laptop has an operating system, storage, RAM, and CPU - a Codespace has all of these too, except it runs on GitHub's servers instead of your desk.
| Your Computer | Codespace |
|---|---|
| Physical hardware on your desk | Virtual computer in the cloud |
| You install and configure tools | Pre-configured for your project |
| Limited to your device | Access from any browser |
| Your specs determine power | Consistent, powerful resources |
Why Use a Codespace?
- No Setup - All tools pre-installed and configured
- Access Anywhere - Use from any browser, any device
- Consistent - Same environment for everyone
- Powerful - More resources than many laptops
Codespace Lifecycle
A Codespace can be in three main states:
| State | Description | What Happens |
|---|---|---|
| Running | Active and working | You can edit code, preview, deploy |
| Stopped | Paused (like sleep mode) | Files saved, restarts in 30-60 seconds |
| Deleted | Permanently removed | All local data gone, must recreate |
State Transitions
Running → (30 min inactivity) → Stopped → (30 days inactive) → Deleted
When a Codespace Stops
A Codespace stops automatically after about 30 minutes of inactivity. This is like putting your computer to sleep mode.
What's Preserved When Stopped
- All your files and code changes
- Installed packages and dependencies
- Your project configuration
- Git history and uncommitted changes
What's Lost When Stopped
- Running processes (dev server stops)
- Terminal session state
- Temporary files in /tmp
When you come back, PhantomWP restarts your Codespace automatically. It takes about 30-60 seconds, then you're right back where you left off. Your code is safe!
Why Does It Stop?
GitHub stops inactive Codespaces to:
- Save resources - no point running a computer nobody's using
- Reduce costs - GitHub provides free hours each month
- Be eco-friendly - less energy consumption
When a Codespace is Deleted
This is more serious. When a Codespace is deleted, it's gone forever - like formatting your computer's hard drive.
What Happens on Deletion
- All local files are permanently gone
- Any changes you didn't push to GitHub are lost
- Installed packages must be reinstalled
- Custom configurations are reset
When Does Deletion Happen?
Codespaces are automatically deleted after 30 days of inactivity:
| Timeline | What Happens |
|---|---|
| Day 0 | Last activity in Codespace |
| Day 25 | GitHub sends warning email |
| Day 30 | Codespace auto-deleted |
Your Safety Net: GitHub Repository
Here's the good news: your code is safe in GitHub!
When you push your changes (commit) to GitHub, your code is stored permanently in your repository - separate from the Codespace.
| Codespace | GitHub Repository |
|---|---|
| Temporary workspace | Permanent storage |
| Can be stopped/deleted | Always available |
| Local changes at risk | Pushed code is safe |
What Happens If Your Codespace is Deleted?
- PhantomWP creates a new Codespace automatically when you open your project
- Your code is pulled from GitHub into the new Codespace
- Dependencies are installed automatically
- You continue working as if nothing happened
The only thing you might lose is uncommitted changes - so commit often!
Best Practices
To never lose work:
- Commit frequently - Use the Git panel to save your work to GitHub
- Push before closing - Make sure changes are uploaded
- Use meaningful commit messages - Makes it easy to track changes
- Don't worry about stopping - It's automatic and safe
PhantomWP shows your Git status in the header. If you see uncommitted changes, make sure to commit before stepping away for extended periods. Your work will be safe in GitHub forever!
Summary
| Term | Meaning |
|---|---|
| Codespace | A virtual development computer in the cloud |
| Running | Active and working (like computer turned on) |
| Stopped | Paused, all files saved (like sleep mode) |
| Deleted | Completely removed (like factory reset) |
| Repository | Permanent code storage in GitHub |
Next Steps
- IDE Overview - Learn how to use the PhantomWP editor
- Working with Files - Create pages and components