Deploying a NestJS app for Free on Cyclic
Introduction
In this article, we’re going to deploy a Nestjs app for free on Cyclic
Cyclic is a cloud platform that provides an easy way to deploy and manage your applications. Their free tier comes packed with some great features.
First off, unlike other services, your apps will never sleep due to inactivity timeouts or delays. This means your app will be up and running all the time.
Secondly, there are no hourly limits and until you reach 100,000 API requests per month, you can use the free tier.
As of now, Cyclic supports two programming languages: JavaScript and TypeScript, and Python beta is behind the waitlist.
Let’s get started with our deployment
Step 1: Registration and Setup
First, we need to create a new account on Cyclic. Visit their website and sign up using your GitHub account credentials
If you haven’t already, push your application code to a GitHub repository so that Cyclic can use that repository to deploy your app
One important thing here — by default, the
start
command in your package.json file will benest start
, make sure to update it tonode dist/main
, so that it serves the compiledmain.js
file from thedist
folder. Thisdist
folder will be created automatically after Cyclic starts to build your app with thenest build
command
Step 2: Deployment
Now we can go to the cyclic dashboard and click on the “Deploy Now” button to start deploying our Nestjs application
From here, go to “Link Your Own” tab, and select the GitHub repository which you want to deploy
Click “Connect Cyclic” to allow it to connect
After that it will start to build the app, installs the dependencies and deploys our app
Now, if you have environmental variables, you’ll get a warning like this. To configure your secrets, go to the projects dashboard
Under the “Variables” tab you will find the variables which you need to add, Cyclic automatically detects all your env variables and add’s their keys here, or you can add them as a file, so if you have a .env
file, you can just copy and paste the content here, that will also work.
After you have added the env variables, you need to go to the deployments tab and re-deploy your app, so that it picks up the variables.
Step 3: Verifying
Now your app should be up and running, go to the “Overview” tab and open up the URL of your Nestjs API
Some of the useful tabs in this dashboard are
The “Deployments” tab is where you can check your latest deployments or initialize a new one
The “Logs” tab is where you can monitor the app logs
And in the “Environments” tab where you can apply a custom subdomain to your app