How to host Nuxt applications
How to Host Nuxt Applications on Square Cloud
Nuxt utilizes an integrated rendering engine called Nitro to compile and prepare the application for production. To host it on Square Cloud, you only need to generate the project build, point to the correct entry file, and configure the system's default port.
1. Running the Production Build
Before deploying your files to Square Cloud, the application must be compiled so that all Vue and TypeScript code is optimized.
Open the terminal at the root of your local project and run the command:
npm run buildThis command will trigger Nitro, creating a hidden folder named .output/ at the root of your project. It is precisely inside this folder that all your production server code resides.
2. Defining the Main File (Main)
Nuxt applications in production do not use a common file like index.js or server.js at the root. The entry point generated by the compiler is located within the output structure.
- File Path:
.output/server/index.mjs
In your squarecloud.app configuration file (or directly in the Square Cloud Dashboard form), you must define the field corresponding to the main file exactly like this:
MAIN=.output/server/index.mjs3. What to Include in the Upload File (.zip)?
To ensure a fast and clean deployment, create a .zip file containing only the artifacts generated for production execution.
- What to INCLUDE: The entire
.output/folder (make sure your zip tool does not ignore folders starting with a dot), thepackage.jsonfile, and your lockfile (package-lock.jsonoryarn.lock). - What to EXCLUDE: Never include the
node_modulesfolder or the.nuxt/folder (used only in development mode). Square Cloud will perform a clean and isolated installation of the required dependencies directly on the server.
4. Troubleshooting Common Issues
- "The site took too long to respond" Error: If you try to access your application's URL and encounter this timeout message, this is usually directly linked to the site using the wrong port. By default, Nuxt's Nitro engine attempts to open the server on port
3000. Since Square Cloud's infrastructure expects and routes external traffic exclusively through port80, the network cannot find your application, causing the browser to give up after waiting for a while. To fix this, review your code and ensure that thePORTvariable is set exactly to80.
```
Updated on: 05/25/2026
Thank you!
