Moving a Project Between Drives or Machines

Moving a Project Between Drives or Machines

How to correctly move a full-stack project (frontend + backend + AI service) to a different drive, SSD, or computer.


The Rule

Code travels. Dependencies get rebuilt.

Your source code is portable. Your installed packages (node_modules, venv, __pycache__) are not — they contain paths, symlinks, and compiled binaries tied to where they were installed.


What Transfers and What Breaks

Part Portable? Why
Source code Yes Just text files
package.json, requirements.txt Yes Config files, no paths
.env files Yes Plain text
.git/ folder Yes Stores remote URL, history, branches — location-independent
node_modules/ Partially Works on same OS/machine, breaks across architectures or if native bindings exist
Python venv/ No Contains absolute paths and symlinks to the system Python — breaks on any move
__pycache__/ No Compiled bytecode tied to specific Python version and paths
Global installs (Node, Python, CLI tools) No Live outside your project folder — not copied at all

Scenario A: Same Computer, Different Drive

Moving from C:\project to E:\project (plugging in an SSD):

Part Status Action
Source code Works Nothing to do
node_modules/ Likely works If issues, delete and npm install
Python venv/ Broken Delete and recreate
Global node/python Not copied Still installed on C: — works if on same machine
Git Works Remote URL and credentials are unaffected

Scenario B: Different Computer

Nearly everything needs reinstalling:

Part Status Action
Source code Works Copy it over
node_modules/ Broken Delete and npm install
Python venv/ Broken Delete, create new venv, pip install
Node.js / Python Not present Install fresh
Git credentials Not present Re-authenticate with GitHub

How to Move a Project

Step 1: Clean Out Dependencies

Before copying, delete the folders that need to be rebuilt. This also makes the copy much faster (node_modules alone can be 500MB-2GB+).

# From the project root
rm -rf node_modules/
rm -rf venv/
rm -rf __pycache__/

Or on Windows:

Remove-Item -Recurse -Force node_modules, venv, __pycache__

Step 2: Copy the Project

Copy the project folder to the new location (external SSD, new machine, etc.). Without node_modules and venv, this should be fast.

Step 3: Reinstall Dependencies

From the new location:

# Frontend
npm install

# Backend (Python)
python -m venv venv
source venv/bin/activate        # macOS/Linux
# venv\Scripts\activate         # Windows
pip install -r requirements.txt

# AI service (if separate)
cd ai-service
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Step 4: Verify Git Still Works

Git does not care where on your filesystem the project lives. The .git/ folder stores the remote URL, commit history, and branch info internally.

git remote -v    # Should still show your GitHub repo
git status       # Should work normally
git push         # Works — no reconfiguration needed

The only case where you need to re-authenticate is if you moved to a different computer — your GitHub credentials are stored at the system level, not in the project.


Quick Reference Checklist

1. Delete node_modules/, venv/, __pycache__/
2. Copy project to new location
3. Run npm install (frontend)
4. Create venv + pip install -r requirements.txt (backend / AI service)
5. Verify git remote -v shows the correct repo
6. Run the app to confirm everything works

Why This Works

A well-structured project should always be rebuildable from:

  • Source code (your .ts, .tsx, .py, .json files)
  • Dependency manifests (package.json, requirements.txt, pyproject.toml)
  • Environment config (.env files — which you keep locally, not in git)

This is why .gitignore excludes node_modules/ and venv/ — they are always rebuilt, never transferred or committed.

If your project can't be rebuilt from a fresh clone + install, that's a sign something is missing from your dependency manifests.


Automating Setup

Add a setup script to your project root so spinning it up anywhere is one command:

setup.sh (macOS/Linux):

#!/bin/bash
npm install
cd ai-service
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cd ..
echo "Ready. Run 'npm run dev' to start."

setup.ps1 (Windows):

npm install
Set-Location ai-service
python -m venv venv
.\venv\Scripts\Activate.ps1
pip install -r requirements.txt
Set-Location ..
Write-Host "Ready. Run 'npm run dev' to start."

This is the professional standard — anyone cloning your repo can get it running without guessing which commands to run.