Node.js hosting
Deploy a Node.js or Express app in a few minutes
To deploy a Node.js or Express app on Makofy, make sure package.json has a start script and the server listens on process.env.PORT, then connect the GitHub repo or run makofy deploy in the project folder. Makofy detects Node.js, installs with your lockfile’s package manager and runs npm start (or yarn, pnpm, bun). An always-on 512 MB app costs $3.50 a month; an API that can sleep between requests costs $1.50 on Nap.
Last updated · By the Makofy team (Muncar Ventures LLC)
What Makofy does with a Node.js repo
When there is no Dockerfile, Makofy looks for package.json and builds a Node.js 20 image for you. The lockfile decides the package manager, the start script decides how the app runs, and the app is given a PORT environment variable (8080 unless you choose another port).
| Your repo has | Makofy runs |
|---|---|
package-lock.json | npm ci, then npm start |
| No lockfile | npm install, then npm start |
yarn.lock | yarn install, then yarn start |
pnpm-lock.yaml | pnpm (through corepack), then pnpm start |
bun.lockb | bun on an oven/bun image, then bun start |
A Dockerfile | Your Dockerfile, exactly as written (detection is skipped) |
A minimal Express server that works on Makofy
The one thing every Node.js app needs is to listen on the port Makofy gives it. Read process.env.PORT, fall back to 8080 for local runs, and bind to all interfaces rather than localhost.
// server.js
const express = require('express');
const app = express();
const port = process.env.PORT || 8080;
app.get('/healthz', (req, res) => res.send('ok'));
app.get('/', (req, res) => res.json({ hello: 'world' }));
app.listen(port, '0.0.0.0', () => {
console.log('listening on ' + port);
});{
"name": "my-api",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.21.0"
}
}Deploy it, step by step
- Start the 7-day free trial at makofy.com. A card is required, and nothing is charged until the trial ends.
- From GitHub: create an app, pick the repository and the branch (default
main). The first deploy starts right away, and every later push to that branch deploys again. - From the CLI: install it with
curl -fsSL https://makofy.com/install.sh | sh, runmakofy login, thenmakofy deployin the project folder. It uploads the folder (respecting.gitignore), creates an app named after the folder and links it in.makofy.json. - Add your environment variables (database URLs, API keys) in the dashboard. Changes apply on the next deploy.
- Open the URL:
https://<app>--<workspace>.makofy.sh, served over HTTPS.makofy openopens it for you andmakofy statusshows whether the app is running. - Check output with
makofy logs, which prints the build log and the latest lines from the running app.
curl -fsSL https://makofy.com/install.sh | sh
makofy login
cd my-api
makofy deploy # web service on $PORT (8080)
makofy deploy --port 3000 # if your app insists on another portTypeScript and other build steps
Because the detected build does not run npm run build, a TypeScript server needs a Dockerfile that compiles it. A two-stage build keeps the final image small: dependencies and the compiler stay in the first stage, and only the compiled output and production dependencies ship.
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=build /app/dist ./dist
CMD ["node", "dist/index.js"]With a Dockerfile in the repo, Makofy uses it as written, so this is also how you pin a Node.js version other than 20. More on that in Deploy a Docker container.
Which instance type for a Node.js app
| Instance type | Price per month | Use it for |
|---|---|---|
| Nap | $1.50 | APIs, webhooks and demos with quiet periods. Sleeps after 15 idle minutes, wakes in about 2 to 6 seconds. |
| Starter | $3.50 | An always-on Express API or small site (512 MB / 0.5 vCPU). |
| Basic | $6 | Busier apps, server-side rendering, bigger dependency trees (1 GB / 1 vCPU). |
| Pro | $12 | Production apps that should be protected first when the node is busy (2 GB / 2 vCPU). |
Open WebSocket or server-sent-event connections count as activity, so a Nap app with a connected client stays awake. Queue consumers and anything else without incoming HTTP traffic must run as a background worker on Starter or larger.
Health checks and rollbacks
By default Makofy checks that your app accepts TCP connections on its port. You can set an HTTP health-check path such as /healthz instead. A new version has about two minutes to become healthy; if it doesn’t, the deploy is marked unhealthy and the previous healthy version is redeployed, so a bad push doesn’t take your API down. You can also roll back to any earlier deploy in one click from the dashboard.
Adding a database
Add managed Postgres ($3/month) from the dashboard, copy its connection URL into a DATABASE_URL environment variable, and connect with pg, Prisma, Drizzle or Knex as usual. The database is reachable only from apps in your workspace. See Postgres and Redis for details.
FAQ
Frequently asked questions
How much does it cost to host an Express app on Makofy?
An always-on Express app costs $3.50/month on Starter (512 MB, 0.5 vCPU). An API that can sleep after 15 idle minutes costs $1.50/month on Nap.
Which port should my Node.js app listen on?
Listen on process.env.PORT. Makofy sets it to 8080 by default, or to the port you pass with makofy deploy --port.
Which Node.js version does Makofy use?
Detected builds use Node.js 20. For another version, add a Dockerfile with the node image you want and Makofy builds it as written.
Does Makofy run my build script?
The detected build runs start, not build. Compile TypeScript or bundled code in a Dockerfile, or make your start script run the build first.
Can I use pnpm, yarn or bun?
Yes. Makofy picks the package manager from your lockfile: yarn.lock, pnpm-lock.yaml or bun.lockb, and npm otherwise.
Related
Deploy your app in a few minutes.
Connect a GitHub repo or run makofy deploy. Flat price per app, 7-day free trial, card required.