A powerful CLI tool to download source code from Vercel deployments. Supports fetching the latest deployment or a specific deployment by ID, with automatic file tree traversal and verification.
npx vercel-deploy-source-downloader <your-vercel-token>That's it! No installation needed. The tool will download the source code from your latest Vercel deployment.
# Download from a specific deployment
npx vercel-deploy-source-downloader <token> --deployment dpl_ABC123
# Download from a specific project
npx vercel-deploy-source-downloader <token> --project my-project
# Enable verbose logging
npx vercel-deploy-source-downloader <token> --verbose
# Combine options
npx vercel-deploy-source-downloader <token> --project my-app --team team_xyz --verboseGet your Vercel token: https://vercel.com/account/tokens
- ✅ Dynamic Deployment Selection - Download from latest or specific deployment
- ✅ Smart Caching - Skip already downloaded files for faster re-runs
- ✅ Tree View - Beautiful tree structure of downloaded files
- ✅ Flexible Configuration - CLI args, environment variables, or .env file
- ✅ Progress Tracking - Verbose mode for detailed progress
- ✅ Auto-detection - Automatically detects project and team
- ✅ Verification - Built-in file verification and statistics
npm install -g vercel-deploy-source-downloaderThen use it directly:
vercel-deploy-source-downloader <your-vercel-token># Clone this repository
git clone https://github.com/numanaral/vercel-deploy-source-downloader.git
cd vercel-deploy-source-downloader
# Install dependencies
npm install- Copy the example environment file:
cp .env.example .env- Edit
.envand add your Vercel token:
VERCEL_TOKEN=your_token_here
VERCEL_PROJECT=your-project-name # optional- Run the script:
npx tsx src/vercel-deploy-source-downloader.tsnpx tsx src/vercel-deploy-source-downloader.ts <your-vercel-token>VERCEL_TOKEN=<token> npx tsx src/vercel-deploy-source-downloader.tsnpx tsx src/vercel-deploy-source-downloader.ts [token] [options]Options:
--deployment <id|latest>- Deployment ID or "latest" (default: latest)--project <name>- Project name (default: auto-detect)--team <id>- Team ID (default: auto-detect)--verbose- Show detailed progress for each file
Create a .env file or set these in your environment:
VERCEL_TOKEN- Your Vercel API token (required)VERCEL_DEPLOYMENT- Deployment ID or "latest" (default: latest)VERCEL_PROJECT- Project name (optional)VERCEL_TEAM- Team ID (optional)
Configuration Priority:
- CLI arguments (highest)
- Environment variables
- .env file
- Defaults (lowest)
# Auto-detect everything
npx tsx src/vercel-deploy-source-downloader.ts <token>
# Or with .env file
npx tsx src/vercel-deploy-source-downloader.tsnpx tsx src/vercel-deploy-source-downloader.ts <token> --deployment dpl_ABC123xyznpx tsx src/vercel-deploy-source-downloader.ts <token> --project my-project
# With verbose output
npx tsx src/vercel-deploy-source-downloader.ts <token> --project my-project --verbosenpx tsx src/vercel-deploy-source-downloader.ts <token> \
--project my-project \
--team team_ABC123The script will:
- Create an
out/directory with all downloaded source files - Generate a
download-log.txtwith full operation log - Display summary with:
- File count (downloaded vs skipped)
- Total size
- File type breakdown
- Verification of important files
- Tree structure view
📦 Using Deployment ID: dpl_ABC123xyz
🌐 Deployment URL: my-app-xyz.vercel.app
📁 Project: my-project
👥 Team: my-team
✅ Got file tree
⬇️ Downloading files...
(Use --verbose to see detailed progress)
📁 Output directory: /path/to/out
🎉 All files processed successfully!
📊 Running comparison...
📁 Total files: 318
✅ Downloaded: 42
⏭️ Skipped: 276
💾 Total size: 5.79 MB
📈 File types breakdown:
ts 122 files
tsx 106 files
md 38 files
...
🔍 Verifying important files:
✅ package.json 4.6 KB
✅ next.config.ts 0.3 KB
...
🌳 File structure tree:
[Tree view of all files]
✨ Download and verification complete!
📄 Full log saved to: download-log.txt
- Go to Vercel Account Tokens
- Click "Create Token"
- Give it a name and appropriate scope
- Copy the token and use it in your configuration
Security Note: Never commit your .env file or share your token publicly.
The script downloads the source code from your Vercel deployment, including:
- All source files (.ts, .tsx, .js, .jsx, etc.)
- Configuration files (package.json, tsconfig.json, etc.)
- Static assets
- Database schemas
- Scripts and utilities
Note: It does NOT download build outputs or lambda functions (these are skipped automatically).
- Make sure your token has access to the project
- Verify the project name is correct
- Check if there are any READY deployments
- Verify the deployment ID is correct
- Make sure you have access to that deployment
- Check if the deployment belongs to a team (use
--teamflag)
- The API endpoint changed - this script uses the correct v7 endpoints
- Your token might not have sufficient permissions
If you hit rate limits, the script will fail. Wait a few minutes before retrying.
The script automatically skips files that already exist with content. This makes re-runs very fast:
# First run - downloads everything
npx tsx src/vercel-deploy-source-downloader.ts
# Second run - only downloads new/changed files
npx tsx src/vercel-deploy-source-downloader.tsnpx tsx src/vercel-deploy-source-downloader.ts --verboseThis shows every file being processed in real-time.
# Token from .env, deployment from CLI
npx tsx src/vercel-deploy-source-downloader.ts --deployment dpl_ABC123
# Token from CLI, project from env
VERCEL_PROJECT=my-project npx tsx src/vercel-deploy-source-downloader.ts <token>- Node.js >= 18.0.0
- tsx (installed as dev dependency)
MIT
Feel free to submit issues and pull requests!
Numan ahmetnuman95@hotmail.com