How to host a SolidJS application
How to Host SolidJS Applications on Square Cloud
Hosting SolidJS on Square Cloud is simple and extremely efficient. Depending on your project's architecture, you will either follow the path of a static deployment (Solid + Vite) or run a SolidStart server.
1. Solid + Vite (Static)
With Solid + Vite, the build generates static files in dist/. In your local terminal, run:
npm run buildPublish the contents of dist/ on the static runtime (MAIN=index.html, or vite.html for SPA routes, with SUBDOMAIN and MEMORY=512). No Node.js process is needed. See Deploying a static site (HTML, React, Vite).
2. SolidStart (SSR)
SolidStart runs a real server that enables server-side rendering (SSR). Run npm run build: it generates .output/server/index.mjs, which reads the PORT and HOST that Square Cloud sets (80 and 0.0.0.0). Create a squarecloud.app file:
MAIN=.output/server/index.mjs
MEMORY=1024
VERSION=recommended
DISPLAY_NAME=My SolidStart App
SUBDOMAIN=my-solidstart-app
3. Preparing the Deployment (.zip)
To ensure that the deployment is fast and error-free, your .zip file should contain only the essentials:
- For Vite: the contents of
dist/(see here). - For SolidStart: the
.output/folder,package.json, andsquarecloud.app.
Tip: Never upload the
node_modulesfolder. Square Cloud will perform a clean installation of dependencies on the server.
4. Environment Variables (ENV)
VITE_variables are read at build time and are visible to any visitor: set them in.envbefore runningnpm run build, and never put secrets in them.- Dashboard variables (your application's Environment Variables tab) only reach server code (SolidStart) and are read when the application starts. Configure keys like
API_URLorDB_AUTHthere.
5. Performance Tips
- Hydration: If you are using SSR with SolidStart, monitor memory usage. SolidJS is highly efficient, but the server hydration process consumes resources during traffic spikes.
- Cache: Use Square Cloud's caching for static assets (images, CSS) to decrease the initial loading time (LCP).
Updated on: 10/04/2026
Thank you!
