Let me paint a very real scenario.
Your laptop crashes.
Your SSD dies.
Or worse you get a new machine and realize nothing is set up.
No PHP. No Node. No Composer. No global tools. No database. No SSH keys.
Just you… and a blank system.
I’ve been in that situation before and that’s when I realized something important:
Your real productivity isn’t your machine but it’s your setup automation.
So if I lost everything today, the first thing I’d rewrite isn’t code for a product it’s a setup script.
A script that gets me from zero → fully productive in minutes.
In this post, I’ll walk you through:
- The mindset behind it
- What my setup script includes
- A practical Bash script that works on Linux (and adaptable for Windows via WSL/Git Bash)
- How to make your development environment reproducible
Why This Script Matters More Than You Think
As a backend developer working with Laravel and Node.js, your environment is your foundation.
Without it:
- You can’t run projects
- You can’t debug issues
- You can’t even start working
And manually setting things up every time?
It’s slow. It’s inconsistent. It’s frustrating.
A setup script gives you:
- Speed
- Consistency
- Confidence
It turns a 2–4 hour setup into a 5–10 minute process.
The Philosophy: Automate the Boring, Repeatable Stuff
My rule is simple:
If I’ve done it twice, I should script it.
Your setup script should handle:
- Installing dependencies
- Configuring your environment
- Setting up dev tools
- Preparing your system for Laravel and Node.js work
Think of it as your personal DevOps layer.
What My “First Script” Always Includes
Here’s what I prioritize:
1. System Updates & Essentials
2. PHP & Laravel Stack
- PHP
- Composer
- Laravel Installer
3. Node.js Ecosystem
- Node.js (via NVM)
- npm / yarn / pnpm
- MySQL or PostgreSQL
- CLI tools
- VS Code (optional)
- CLI helpers
- Aliases
6. SSH Setup (Critical for Git)
My Go To Setup Script (Linux / WSL Compatible)
Here’s a practical version of the script I’d rewrite immediately:
#!/bin/bash
echo " Starting Development Environment Setup..."
# Update system
echo " Updating system..."
sudo apt update && sudo apt upgrade -y
# Install essentials
echo " Installing essential tools..."
sudo apt install -y curl git unzip software-properties-common
# Install PHP & extensions
echo " Installing PHP..."
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install -y php8.2 php8.2-cli php8.2-mbstring php8.2-xml php8.2-bcmath php8.2-curl php8.2-mysql
# Install Composer
echo " Installing Composer..."
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Install Laravel Installer
echo "⚡ Installing Laravel..."
composer global require laravel/installer
# Add Composer global bin to PATH
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# Install NVM (Node Version Manager)
echo " Installing NVM..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
source ~/.bashrc
# Install Node.js (LTS)
echo " Installing Node.js..."
nvm install --lts
# Install global Node tools
echo " Installing global npm tools..."
npm install -g yarn pnpm
# Install MySQL
echo " Installing MySQL..."
sudo apt install -y mysql-server
# Enable MySQL
sudo systemctl start mysql
sudo systemctl enable mysql
# Generate SSH key
echo " Generating SSH key..."
ssh-keygen -t ed25519 -C "*Emails are not allowed*"
echo "✅ Setup complete!"
echo "✅ Restart your terminal or run: source ~/.bashrc"
Making It Work on Windows (The Right Way)
If you're on Windows, don’t fight the system.
Use:
- WSL (Windows Subsystem for Linux) → Best option
- Or Git Bash
Run the same script inside WSL it behaves like a real Linux environment.
This gives you:
- Consistent tooling
- Better compatibility with Laravel & Node
- Fewer environment issues
The Real Upgrade: Version Control Your Setup
Here’s where most developers stop but this is where pros go further.
Put your script in Git:
setup-dev.sh
Now you can:
- Reuse it anytime
- Improve it over time
- Share it across machines
Your setup becomes portable infrastructure
Lessons I Learned the Hard Way
From real experience:
1. You Will Lose Your Setup Someday
Hardware fails. Systems break. Be ready.
2. Memory Is Not Reliable
You think you remember steps until you don’t.
3. Consistency Beats Speed
A script ensures every setup is identical.
4. Small Automation = Big ROI
This one script can save you hours every month.
Optional Upgrades (Level Up Your Script)
Once your base script is solid, you can extend it:
- Install Docker
- Configure Laravel Sail
- Setup Redis
- Add aliases:
alias art="php artisan"
alias serve="php artisan serve"
- Auto clone your repos
- Install VS Code extensions
Your script evolves with your workflow.
Final Thoughts: This Script Is Your Safety Net
Losing your setup feels like losing momentum.
But when you have a script like this?
You’re back up in minutes calm, in control, and productive.
This isn’t just about convenience it’s about developer resilience.
Call to Action
If this resonated with you:
- Create your own setup script today
- Customize it for your Laravel/Node workflow
- Store it in Git (don’t skip this)
And tell me:
If you lost your setup right now… how long would it take you to recover?
If the answer is more than 30 minutes you know what to do.