Prerequisites
Before you dive in, make sure you have the following:- A Clouddley account
- Scaleway account with billing enabled
- A GitHub or Bitbucket account.
- Node.js (version 16 or higher) installed locally
- An API key on Scaleway to manage your instances.
- Git installed locally
- Basic familiarity with command line interface
Set up a New NestJS App
If you donât already have a NestJS app ready, letâs quickly spin one up.Install NestJS CLI
Open your terminal and run:This command will scaffold a new NestJS project in a folder called
my-app. Youâll be asked to choose a package manager, go with whatever youâre comfortable with (npm or yarn works just fine).Run the App
You can now run your NestJS app locally to make sure everything is set up correctly:Open your browser and go to http://localhost:3001. You should see âHello World!â, youâre good to go.
Push Your Code to GitHub
First, you need to push your NestJS app code to a Git repository.Create a New Repository on GitHub
Go to GitHub and create a new repository. Give it a name and leave the rest of the settings as default (no README, no .gitignore, you already have those locally).
Create branch and add Remote Repository
Create a branch and link your local repository to the GitHub repository you created:
Create a Scaleway instance using Scaleway CLI
- First, install the Scaleway CLI if you havenât already done so. It helps you manage Scaleway resources right from your terminal.
- Once itâs installed, authenticate by running the command:
API Keys.
- To make sure everythingâs working run:
- Configuring security groups is essential for controlling access to your instance. Create a security group that allows HTTP and HTTPS traffic:
Allow port access.
See the output below:

- Next, add rules to allow inbound traffic on port
3001and22. Run the following commands:
Replace
<your-sg-id> with the ID of the security group you just created. You can find your security group ID by running the command $ scw instance security-group list and this will list all security groups.
- Now, create a new instance:
Replace
<your-sg-id> with the ID of the security group you created earlier.app-server with the DEV1-S type, using the Ubuntu Focal image in the fr-par-1 zone. It also assigns a new public IP and applies the security group you created earlier.
You should see output similar to this:

Deploy
Once your NestJS app and your Scaleway instance are ready, itâs time to deploy using Clouddley.- Open your browser, log in to your Clouddley account
- Click on the Apps in the left sidebar.
- Click on Deploy App to begin.

Step 1: Configure your service
- Choose your Git provider: either GitHub or Bitbucket and authorize Clouddley to access your repository. For this tutorial, weâll use GitHub.
- Click on Continue with GitHub

Step 2: Configure Git
- To connect your GitHub user or organization account, click the Select username/organization dropdown and Add GitHub account.
- Once connected, choose the repository and branch that contains your NestJS app.
- Click on Next to proceed.

Step 3: Connect Your Scaleway Instance
- From the Choose or add server dropdown, select your VM if it appears in the list. If not, click + Add Virtual Machine.
- To add your VM, enter your Scaleway Instanceâs IP address as VM host, VM user, and the VM port for SSH access.
- Once youâve entered the details, verify the connection using the Clouddley CLI(recommended) or SSH.
How to Install Clouddley CLI to Verify your Scaleway Instance
How to Install Clouddley CLI to Verify your Scaleway Instance
- Open your local machineâs command line, then connect to the remote VM you want to configure with Clouddley. Use this command to SSH into your Scaleway instance:
- Install Clouddley CLI by running the command:
- To add the SSH public key, run the command:
- Click Verify to confirm the connection, then click Next.

Step 4: Configure app settings
- Now, insert the name of your application and specify the port it runs on.
- Click on Next

- Click on Add Variable
- Choose an ENV mode: either a single variable or import variables. Learn more here.
- Single Variable
- Import Variables

- Add the key-value pairs and click on Save
- Click on Next

Step 6: Setup Notifications (optional)
- To configure the notifications settings of the application, click on Add Alert
- Select the Alert type. For this tutorial, we will set up Email notifications.
- Toggle on the buttons for the deployment events (failed, timed out, or success) you want to get notified of.
- Enter your email address (or multiple, if needed).
- Click on Save
- Click on Deploy

Step 7: Test and Verify the app
- Click on Go to Dashboard. Your app will be visible on the apps dashboard.
- Once deployment completes, its status will update from
DeployingtoOnline.

- To test it, click the đ Website button in the top right corner to open your live app in the browser. You should see your NestJS app running on your Scaleway instance.

After Deployment: Managing Your NestJS App
Once your NestJS app is live on your Scaleway instance, managing it through Clouddley is straightforward. The dashboard gives you all the control you need without having to SSH into your server.You can change your deployment settings, roll back to a previous version, scale up if traffic grows, and even pause or resume your app when needed. Everythingâs designed to be simple and quick. Need to update environment variables or check your logs? Thatâs all built in too. Youâll also be able to connect a custom domain and keep track of your deployment history, right from the same dashboard.
Best Practices When Working with NestJS
Best Practices When Working with NestJS
Building with NestJS is already a step in the right direction. It gives you structure, scalability, and a clean development experience. But to get the most out of it, here are a few best practices youâll want to keep in mind. Keep your folders organised
Stick to a modular folder structure. Group your features by domain (like users, auth, products) and keep related files together. This makes your codebase easier to navigate as it grows. Rely on dependency injection
NestJS is built around dependency injection, so use it. Avoid tightly coupling your services or hardcoding dependencies. Inject what you need through constructors and let Nest handle the rest. Use DTOs for data validation
Data Transfer Objects (DTOs) arenât just a nice-to-have. They help validate and shape incoming data, keeping your app secure and predictable. Use them with class-validator to enforce rules and avoid nasty surprises. Keep business logic in services
Your controllers should be lean. Move all the actual business logic into services so your code stays clean and reusable. Controllers should only handle requests and responses. Write unit and e2e tests
NestJS makes testing easy with built-in tools. Take advantage of it. Write unit tests for your services and end-to-end tests for your routes. It helps catch bugs early and gives you confidence when deploying. Use environment variables
Avoid hardcoding secrets, ports, or database configs. Use environment variables and load them properly with @nestjs/config. This keeps your app flexible and production-ready. Handle errors gracefully
Use filters and exception handling to return meaningful errors. Donât leave users (or your logs) guessing when something goes wrong.
Stick to a modular folder structure. Group your features by domain (like users, auth, products) and keep related files together. This makes your codebase easier to navigate as it grows. Rely on dependency injection
NestJS is built around dependency injection, so use it. Avoid tightly coupling your services or hardcoding dependencies. Inject what you need through constructors and let Nest handle the rest. Use DTOs for data validation
Data Transfer Objects (DTOs) arenât just a nice-to-have. They help validate and shape incoming data, keeping your app secure and predictable. Use them with class-validator to enforce rules and avoid nasty surprises. Keep business logic in services
Your controllers should be lean. Move all the actual business logic into services so your code stays clean and reusable. Controllers should only handle requests and responses. Write unit and e2e tests
NestJS makes testing easy with built-in tools. Take advantage of it. Write unit tests for your services and end-to-end tests for your routes. It helps catch bugs early and gives you confidence when deploying. Use environment variables
Avoid hardcoding secrets, ports, or database configs. Use environment variables and load them properly with @nestjs/config. This keeps your app flexible and production-ready. Handle errors gracefully
Use filters and exception handling to return meaningful errors. Donât leave users (or your logs) guessing when something goes wrong.
Conclusion
And thatâs it! Youâve deployed your NestJS app to a Scaleway instance using Clouddley. From setup to deployment, everything stays simple and efficient. This is just the beginning, Clouddley scales with your project and works for other apps too. Got feedback or ideas to improve the experience? Weâd love to hear from you. We canât wait to see what you deploy next!Getting started with Clouddley?
A backend infrastructure for your own compute. Run apps, databases, brokers, and AI workloads on your VMs, bare metal, or VPS.

