DEV Community

Puneet Gopinath
Puneet Gopinath

Posted on • Updated on

Deploy NodeJS app on Qovery

Before you begin, this page assumes the following:

  • You have installed nodejs on your system

Make your NodeJS app

Make your nodejs app first, if you already have, try test them locally once.

Here's a simply website coded with express for example:

const express = require("express");
const app = express();
app.get("/", (req, res) => {
    res.send("Hello");
});
const port = 8080;
app.listen(port, () => {
    console.log(`Site running on port ${port}`);
});
Enter fullscreen mode Exit fullscreen mode

Make a package.json

Easily make a package.json by using the npm --init or yarn init terminal command

After that's done, you need to add all packages which you use in the package.json by using the npm install --save <package name> or yarn add <package name> command

Add a Dockerfile

You need a valid Dockerfile to run your nodejs app in qovery. If you are not familiar with Docker, you can take a look to this article. Here is the content of our Dockerfile.

FROM node:16
RUN mkdir -p /src/user/app
WORKDIR /src/user/app
COPY . .
RUN npm install --production
EXPOSE 8080
CMD ["npm", "start"]
Enter fullscreen mode Exit fullscreen mode

A small note: this Dockerfile installs node v16, change FROM node:16 to FROM node:<version> where <version> is the major version of node you want to install

Sign up into Qovery

Now, you need to sign up or sign in on Qovery.

Sign in to the Qovery web interface.

Deploy our NodeJS app

Creating a project myapp.
image
Creating an environment main.
image
Creating an app by selecting your nodejs app repository, build mode > Dockerfile, and the port 8080 (not required if you are not hosting a website, for the current example it is required).
image
And deploy! That's it 🔥... nothing more. Our NodeJS app is ready.

Top comments (0)