Ep.03: Tools & Setup for building and testing a Node Web App
Teolin Codreanu
Software Developer | Microservices / APIs in Node.js, JavaScript, TypeScript, Nest.js / Koa / Express etc
This article is part of an in-depth comparison series of the top Node frameworks. We'll cover all the important aspects: market share, learning curve, ecosystem, security and more. To compare them properly, we will build the exact same app in all these frameworks (plus Vanilla Node), observe all the steps along the way and then benchmark them as we progressively add more functionalities.
Table of contents
Sleeves up and let's start building! Oh, wait, am I being one of those jerks that just assume you have the exact same environment as me and ...?
Yeah, let's roll back a little, and make sure we're on the same page. Or, at least, on the same setup, right?
If you're a seasoned developer, just use your preferred package manager for your OS, a source manager, a database manager, an IDE, an API development and testing tool, some containerization platform and, obviously, Node.js - complete with TypeScript and some basics like ESLint, Prettier, ts-node, etc.
If you're new-ish to development, let's look at these in more detail and take our pick.
There's an entire grocery list of tools you'll need if you want to hop along and try building an app with any Node.js framework. Well, you technically don't need them... You could, for example, skip the database manager and use the terminal to scour through your databases. If you choose to do so, let me know, I have a good friend who's a shrink specialized in the Angry Developer Syndrome, and he'll give you a discount. Anywho, let's open a terminal and let's get...:
# on Windows
winget install -e --id Git.Git
# on a Mac
brew install git
# on Linux
sudo apt-get install -y git
# on Windows
winget install -e --id OpenJS.NodeJS
# on a Mac
brew install node
# on Linux
sudo apt-get install -y node
See the pattern? Simple, right?
# on Windows
winget install -e --id VSCodium.VSCodium
codium --install-extension dbaeumer.vscode-eslint
codium --install-extension ms-azuretools.vscode-docker
codium --install-extension esbenp.prettier-vscode
$VSCodiumPath = "C:\Program Files\VSCodium\bin"
$env:Path += ";$VSCodiumPath"
[Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::User)
# on a Mac
brew install --cask vscodium
extensions=(
dbaeumer.vscode-eslint
esbenp.prettier-vscode
ms-azuretools.vscode-docker
)
for extension in "${extensions[@]}"; do
codium --install-extension "$extension"
done
echo 'export PATH="/Applications/VSCodium.app/Contents/Resources/app/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# on Linux
sudo apt-get install -y codium
extensions=(
dbaeumer.vscode-eslint
esbenp.prettier-vscode
ms-azuretools.vscode-docker
)
for extension in "${extensions[@]}"; do
codium --install-extension "$extension"
done
echo 'export PATH="$PATH:/usr/share/codium/bin"' >> ~/.bashrc
source ~/.bashrc
# on Windows - you need to enable WSL2
winget install -e --id Docker.DockerDesktop
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
# on a Mac
brew install docker
# on Linux - you need to install Docker Compose separately
sudo apt-get install -y docker.io
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $(whoami)
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# on Windows
winget install -e --id DBeaver.DBeaver
# on a Mac
brew install --cask dbeaver-community
# on Linux
wget -O - https://dbeaver.io/debs/dbeaver.gpg.key | sudo apt-key add -
echo "deb https://dbeaver.io/debs/dbeaver-ce /" | sudo tee /etc/apt/sources.list.d/dbeaver.list
sudo apt-get update
sudo apt-get install -y dbeaver-ce
# on Windows
winget install -e --id Postman.Postman
npm install --global newman
# on a Mac
brew install --cask postman
npm install --global newman
# on Linux
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
sudo ln -s /opt/Postman/Postman /usr/local/bin/postman
npm install --global newman
npm install --global npx eslint prettier typescript ts-node
If you want a script that installs everything in one go, check this small repo, it has a PowerShell and a BatchScript version that does all the heavy lifting for you if you're on windows: microservice-quickstart
Check if everything is installed correctly with this small script if you're on Mac/Linux:
#!/bin/bash
check_version() {
if ! command -v $1 &> /dev/null
then
echo "$1 not installed"
else
echo "$1 version: $($1 --version)"
fi
}
check_version git
check_version node
check_version codium
check_version docker
check_version dbeaver
check_version postman
check_version npm
check_version tsc
Caveat, I don't own a Linux machine, also installation may vary by distribution, so you need to navigate that on your own.
If you're on Windows, this equivalent PowerShell script should confirm that everything is correctly installed:
function Check-Version {
param (
[string]$command
)
$path = Get-Command $command -ErrorAction SilentlyContinue
if ($path) {
try {
& $command --version
} catch {
Write-Host "$command version information not available"
}
} else {
Write-Host "$command not installed"
}
}
Check-Version "git"
Check-Version "node"
Check-Version "codium"
Check-Version "docker"
Check-Version "dbeaver"
Check-Version "postman"
Check-Version "npm"
Check-Version "tsc"
If something yells at you through the screen, let me know in the comments and we can yell right back and bring them in line, no worries. Otherwise, we're good to go.