TypeScript SDK - Node.js
You can generate a new starter project using the following commands:
npx create-smelter-app
pnpx create-smelter-app
yarn create smelter-app
bunx create-smelter-app
By default, newly created project will download Smelter binaries and run them on local system. Make sure to check runtime dependencies required for those binaries.
Alternatively, you can point SDK to server you started yourself. See ExistingInstanceManager
to configure it. For instructions how to start the server itself check out documentation for docker deployment
or running binaries directly.
Docker
You can package your Node.js application and smelter server using below Dockerfile.
FROM ghcr.io/software-mansion/smelter:v0.4.0
ENV NODE_VERSION 20.18.0
RUN sudo apt-get update -y -qq && \ sudo apt-get install -y curl xz-utils && \ sudo rm -rf /var/lib/apt/lists/*
RUN curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" && \ sudo tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 --no-same-owner && \ rm "node-v$NODE_VERSION-linux-x64.tar.xz"
ENV SMELTER_PATH=/home/smelter/smelter/main_process
ADD --chown=smelter . /home/smelter/projectWORKDIR /home/smelter/project
RUN npm install && npm run build
ENTRYPOINT ["node", "/home/smelter/project/dist/index.js"]
Build it with:
docker build -t smelter-app .
And run
docker run -it smelter-app