Docs/Understanding Codespaces

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 ComputerCodespace
Physical hardware on your deskVirtual computer in the cloud
You install and configure toolsPre-configured for your project
Limited to your deviceAccess from any browser
Your specs determine powerConsistent, 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:

StateDescriptionWhat Happens
RunningActive and workingYou can edit code, preview, deploy
StoppedPaused (like sleep mode)Files saved, restarts in 30-60 seconds
DeletedPermanently removedAll 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:

TimelineWhat Happens
Day 0Last activity in Codespace
Day 25GitHub sends warning email
Day 30Codespace 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.

CodespaceGitHub Repository
Temporary workspacePermanent storage
Can be stopped/deletedAlways available
Local changes at riskPushed code is safe

What Happens If Your Codespace is Deleted?

  1. PhantomWP creates a new Codespace automatically when you open your project
  2. Your code is pulled from GitHub into the new Codespace
  3. Dependencies are installed automatically
  4. 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:

  1. Commit frequently - Use the Git panel to save your work to GitHub
  2. Push before closing - Make sure changes are uploaded
  3. Use meaningful commit messages - Makes it easy to track changes
  4. 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

TermMeaning
CodespaceA virtual development computer in the cloud
RunningActive and working (like computer turned on)
StoppedPaused, all files saved (like sleep mode)
DeletedCompletely removed (like factory reset)
RepositoryPermanent code storage in GitHub

Next Steps