An evergreen template for running Node.js in a Hugging Face Space (blog.tomayac.com)

🤖 AI Summary
A developer has published an "evergreen" template for running Node.js apps inside a Hugging Face Space using the Docker SDK, offering a simple Glitch-like replacement for hosting server-based Node apps. The template is designed to remain version-agnostic (using node:lts-alpine and express: "latest") so you can duplicate the Space to lock in concrete Node/Express versions for production. Because Spaces support Docker and run in a main browser context rather than an iframe, you can set security headers (COOP/COEP/CORP) to enable advanced browser features like SharedArrayBuffer and other cross-origin capabilities. Key technical details: start from a Blank Docker Space, include a package.json (express: "latest"), a Dockerfile based on node:lts-alpine that switches to the node user, copies files into /home/node/app, runs npm install, exposes port 7860 and entrypoints to index.js. The example index.js uses Express on port 7860 and dynamically reads Express and Node versions via import('express/package.json') and process.version so you can later hardwire versions after duplication (e.g., change node:lts-alpine → node:24-alpine and "express":"latest" → "express":"^5.1.0"). Add README.md with YAML front matter to configure metadata and custom_headers. You can edit in the web UI or git clone the Space for local development.
Loading comments...
loading comments...