Articles on: Websites & APIs

How to host Astro applications

How to Host Astro Applications on Square Cloud


Astro is known for its "islands" architecture and for generating extremely fast websites. On Square Cloud, you can host static websites or Astro applications with SSR (Server-Side Rendering). For the default static site model, we will use the serve library to handle requests on port 80.



1. The Build Process


Before deploying your files to Square Cloud, you need to generate the production version of your website. Astro compiles your components and content into optimized HTML, CSS, and JS files.


In your local terminal, run:

npm run build

This command will create a folder named dist/ at the root of your project. This folder contains everything your end user will see.



2. Preparing the File Server


Since Astro (in static mode) only generates files, we need a small server to "serve" these files via HTTP. The serve library is the recommended choice due to its simplicity.


In your package.json file, add the dependency:

"dependencies": {
"serve": "^14.0.0"
}



3. Configuring the Port and Start


Square Cloud makes port 80 available for your application to use and receive requests. The initialization command must be configured to point the server to the build folder and set the correct port.


Start Command:

npx serve dist -p 80


  • dist: Indicates the folder where the compiled files are located.
  • -p 80: Sets the mandatory port for traffic on Square Cloud.



4. Deployment File Structure (.zip)


To upload, create a compressed file containing only the essentials for execution:


  • The dist/ folder (Generated by the build).
  • The package.json file.


Tip: Do not include the node_modules or src folder. Square Cloud will automatically install the necessary dependencies.



5. Astro with SSR (Optional)


If you are using Astro with an adapter (such as Node.js) for server-side rendering (SSR), the process changes slightly:

  1. The build command is still required.
  2. The start command will usually be node ./dist/server/entry.mjs (or similar, depending on your adapter).

Updated on: 05/26/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!