logoComputeSphere
Deployment

How to Deploy a Node.js App on ComputeSphere

P
By Peter Ekhator
•3 min read•

One command, csph deploy, takes a Node.js app from your machine to a live HTTPS URL on ComputeSphere. This guide does that with a standard Express app, then adds environment variables, a custom domain and autoscaling. The only code change most Node.js apps need is reading the port from PORT.

Prefer to start from a working app? Clone the ComputeSphere Node.js example and follow along.

Before you start

  • A Node.js app that listens on a port — Express, Fastify, NestJS, or plain http
  • Docker installed locally (ComputeSphere runs your app as a container image)
  • A ComputeSphere account — a 14-day trial; a card is required to start, and you're charged from day 15 unless you cancel

Install the csph CLI

Pick one:

brew install computesphere/cli/csph
# or
curl -fsSL https://install.computesphere.com | sh
# or
npm install -g @computesphere/csph

Then sign in. The CLI prints a code and a URL — confirm it in your browser:

csph auth login

Make your app read the port

ComputeSphere assigns a port and routes public traffic to it. Read it from the environment instead of hardcoding one:

const port = process.env.PORT || 3000;
app.listen(port, () => console.log(`listening on ${port}`));

That is the only code change most Node apps need.

Containerize your app

A small production Dockerfile is enough:

FROM node:22-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
ENV NODE_ENV=production
EXPOSE 3000
CMD ["node", "server.js"]

Deploy

From your project directory:

csph deploy

ComputeSphere builds the image, runs it on a spherelet, terminates TLS, and routes a public URL:

https://amber-finch.computesphere.app

Already publish your own image? Skip the build and deploy it directly:

csph deploy --image registry.example.com/my-api:1.0.0

Connect your GitHub repo once and every push redeploys — build, deploy, and a zero-downtime cutover.

Set environment variables

Keep config and secrets out of your image. Set them per environment:

csph services variables set NODE_ENV=production --service <service-id> --environment <environment-id>
csph services secrets set DATABASE_URL="$DATABASE_URL" --service <service-id> --environment <environment-id>

csph services list shows the service id and csph environments list the environment id.

Set DATABASE_URL in your shell first, for example from a file or your password manager, so the secret itself never appears in the command or your shell history.

General variables and secrets are injected at runtime. Point DATABASE_URL at whatever database you already run.

Add a custom domain

Open Console → Domains, add your hostname, then create the DNS record it shows. For a subdomain that is a single CNAME to your service URL:

Type    Name    Value
CNAME   app     amber-finch.computesphere.app

ComputeSphere issues and renews the SSL certificate automatically — no certificate file to upload, no renewal to track.

Scale with spherelets

A spherelet is your unit of compute, and you pay a fixed price per spherelet. There are no per-seat fees, and every plan includes data out each month (10 GB to 1,000 GB, by plan). Pick a size (Flex, Standard, or Plus), run as many spherelets as you need, and turn on autoscaling: set a minimum and maximum spherelet count and a target CPU, and ComputeSphere scales between them. Because each spherelet has a known price, you know what compute costs as you scale. Autoscaling is a Team plan feature; on Hobby and Pro you set the spherelet count yourself.

Your app is in production

Your Node.js app now runs on ComputeSphere with HTTPS, its config in variables and secrets, and your own domain. Once your repo is connected, every push redeploys it with a zero-downtime cutover.

Next step: get started and run csph deploy from your project, or book a 15-minute demo.

Predictable cloud, from your first push.

Fixed price per spherelet, flat plan per team — ship without DevOps or surprise bills.

Start free trial

14-day free trial

Share this article

Ship your next service on ComputeSphere

Predictable per-spherelet pricing, a flat plan per team, and managed primitives built in — no DevOps, no surprise bills.

Deploy your first app in minutes.

Connect a repo or start from a template — live URL, SSL, and zero DevOps, on predictable monthly pricing. 14-day free trial.