Adapters
Node HTTP
@stone-js/node-http-adapter serves your domain over HTTP on a Node process. It is the adapter most projects start with, and the one behind stone dev for backend apps.
#Install
npm i @stone-js/node-http-adapter#Enable it
Add the decorator (or the blueprint) to the manifest. default: true marks it as the adapter to run when several are stacked and none is selected another way.
import { StoneApp } from '@stone-js/core'
import { Routing } from '@stone-js/router'
import { NodeHttp } from '@stone-js/node-http-adapter'
@NodeHttp({ default: true }) // serve HTTP on Node
@Routing()
@StoneApp({ name: 'tasks' })
export class Application {}import { defineStoneApp } from '@stone-js/core'
import { routerBlueprint } from '@stone-js/router'
import { nodeHttpAdapterBlueprint } from '@stone-js/node-http-adapter'
export const App = defineStoneApp(
{ name: 'tasks' },
[routerBlueprint, nodeHttpAdapterBlueprint]
)npm run dev # local server, hot reload
curl localhost:8080/tasks # your routes, served#Configuration
| Option | Type | Default | Description |
|---|---|---|---|
| default | boolean | false | Run this adapter by default when several are stacked. |
| url / host / port | string / number | · | Where the server listens (also settable via the environment). |
| server | object | · | Underlying server options (timeouts, body limits). |
It builds on @stone-js/http-core, so the request and response model, cookies, headers and file uploads are the runtime-agnostic ones documented in Essentials.
#Deploy
Build and run the Node output behind your process manager or container. Because the domain is untouched by this adapter, the same code can later move to the edge or a Lambda by swapping the adapter, not the app.
npm run build # produces the Node server
node dist/server.mjsA minimal production container: multi-stage so only the runtime and pruned dependencies ship.
# --- build stage ---
FROM node:20-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build # -> dist/server.mjs
# --- runtime stage ---
FROM node:20-slim
WORKDIR /app
ENV NODE_ENV=production
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=build /app/dist ./dist
EXPOSE 8080
CMD ["node", "dist/server.mjs"]