Week 13 - Systems

App Development lifecycle

Continuous integration (CI)

Continuous Delivery (CD)

Packaging and Docker

Docker setup

Building an API server

Deployments

Intro to Cloud

Using local LLMs

Appendix 1 yaml syntax

Appendix 2 Docker commands

Practice

Assignment

Core program

Where does your service run when you switch off your computer?

In the previous section, we built our own API server that runs locally and returns HTTP responses to clients. But what happens when you close your laptop? The server stops, and no one can reach it anymore.

For your application to be available to users at any time, it needs to run on a computer that is always on — somewhere in the cloud.

Platform as a Service (PaaS)

A PaaS (Platform as a Service) is a hosting platform where you can deploy your applications without worrying about the infrastructure behind it. Networking, disk space, uptime, security patches — that is all someone else's problem. You just push your code, and the platform takes care of running it.

There are many PaaS providers for deploying web applications, the most well-known being Netlify, Render, and Vercel. For this section, we will use Render to deploy your Express application and make it available to anyone on the internet — for free.

Before we begin

We need to create a simple server using Express to practice deployments.

<aside> ⌨️

Hands on:

  1. Create a new public GitHub repository called compliments-api
  2. Solve Exercise 3 - Build a compliments API. Alternatively, you can also use the solution from our GitHub.
  3. Push a working version of your server to the GitHub repo from step 1. Do not forget to include the package.json and all other files.
  4. Use a port number form the env variable (see explanation below) </aside>

Port number as an env variable

Many PaaS services may run your application on a different port. To support this, read the port number from an environment variable, like this:

const port = process.env.PORT || 3000;

app.listen(port, () => {
  console.log(`Compliments server running on <http://localhost>:${port}`);
});

The code above will try to get the port number from process.env.PORT. If it is undefined, it will use the default port 3000.

If you are curious, here is how to set your own port using environment variables:

export PORT=3333
node index.js      
# will use 3333 as a port. The env variable will reset after closing the terminal window

Getting started with Render

image.png

Render is a cloud PaaS that lets you deploy web apps directly from a GitHub repo. You connect your repo, Render detects the type of the application (Node.js in your case), builds it, and gives you a public URL. Let’s give it a try.

Step 1: Create a new account

Create a free account on render.com. Feel free to use any of the authentication options available. After registering, you will be redirected to the dashboard:

Render dashboard with no services running.

Render dashboard with no services running.

Step 2: Create a new Web Service

  1. Click "New""Web Service"
  2. Select "Public Git repository"
  3. Paste the url to your Git repository with the compliments api
  4. Click connect

Step 3: Configure the service

Render should detect Node.js automatically. Verify these settings:

Setting Value
Name Choose a name (this becomes part of your URL)
Language Node
Region Frankfurt (EU)
Branch main
Build Command npm install
Start Command npm start or node index.js
Instance Type Free

Step 4: Deploy the service

Click on “Deploy”. Render will now:

  1. Clone your repository
  2. Run npm install
  3. Run npm start
  4. Give you a public URL like https://your-app-name.onrender.com

Wait for the status to show "Live". This usually takes 1–2 minutes.

image.png

Once live, you will be able to see the public assigned URL to your service.

image.png

Step 5: Test your URL

Open your public URL on Render and confirm that the API works.

<aside> 🎉

Congratulations! You have deployed your first application to the internet.

</aside>

Continues deployments

What happens on every push?

From now on, every time you push to main, Render will automatically:

  1. Pull the latest code
  2. Run npm install
  3. Restart the server

This is Continuous Deployment — no manual steps between pushing code and going live.

<aside> ⌨️

Hands on: Make a small change to the compliments API, push it to GitHub, and confirm that Render shows the updated version.

</aside>

Things to know


The HackYourFuture curriculum is licensed under CC BY-NC-SA 4.0 *https://hackyourfuture.net/*

CC BY-NC-SA 4.0 Icons

Built with ❤️ by the HackYourFuture community · Thank you, contributors

Found a mistake or have a suggestion? Let us know in the feedback form.