Articles on: Websites & APIs

How to host Remix applications

How to Host Remix Applications on Square Cloud


Remix was designed to load pages instantly through parallel data fetching. To run your application on Square Cloud, the standard workflow involves compiling the project for production and using the native remix-serve tool to handle requests on the correct port.



1. The Build Process


Before deploying your application to the production environment, you need to compile the source code. This process optimizes your routes, React components, and compiles the server files.


In your local project's terminal, run:

npm run build


By default (especially in modern versions based on Vite), Remix will generate the build/ folder containing the compiled server and client assets.



2. Configuring the Start Command (remix-serve)


Unlike custom Node servers, Remix provides a ready-made package called remix-serve to run the application built inside the build folder.


Your initialization command (defined in the Dashboard or in your squarecloud.app configuration file) must invoke this utility:


npx remix-serve ./build/server/index.js

(Note: Make sure to validate the exact path of the generated index.js file inside your build folder, as it may vary slightly depending on your Remix version or Vite configuration file).



3. What to Include in the Deployment Package (.zip)?


To ensure a fast, clean deployment without storage issues, create a .zip file containing only the production artifacts:


  • The build/ folder (Generated by the build command).
  • The public/ folder (Contains your static assets, such as images and the favicon).
  • The package.json file.
  • The package-lock.json or yarn.lock file.


Attention: Never include the node_modules folder in your compressed file. Square Cloud will perform an isolated and clean installation of the dependencies directly on the server after the upload.



4. Production Tips


  • Vite Version: If you recently migrated your Remix project to the Vite compiler, make sure your vite.config.ts file is properly configured for production.
  • Server-Side Variables: Remember that secret API keys and database connection strings should never be exposed in your code. Add all of them in the Environment Variables tab within the Square Cloud panel. Remix will access them natively via process.env.

Updated on: 05/25/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!