NetrunHome

Front-end and static sites

How to deploy an Astro site and host it online

· 5 min read

In short

Astro builds your site into a set of ready-made pages by default, so deploying an Astro site is usually the easy case: plain static hosting. Upload the source code to Netrun, the platform runs the build and gives you a public HTTPS link. If the project uses server output (output: server in your config, or hybrid in some versions), you need the Node adapter in standalone mode, and the app should read the port and host from the PORT and HOST environment variables. You do not have to build locally or upload the dist folder: content collections and images are processed during the build, and the build runs on our side.

An Astro blog or landing page comes together in an evening. Deploying an Astro site is the part that drags: find hosting, install Node.js on it, run the build, put the generated files in the right place, configure a web server and get a certificate. If the site has a server part, there is one more job: keeping the process alive and bringing it back after a reboot. For a personal blog or a portfolio, that is a lot of manual work.

With Netrun you upload the source code, and we handle the build, the start, the restart after a crash and HTTPS. Below are both cases: a regular Astro site that turns into a set of ready-made pages, and server mode, where the site needs an actual running process.

  1. Work out whether your site is static or server-rendered#

    By default Astro builds your project into a set of ready-made pages — the simplest case, plain static output: nothing has to keep running, the platform just serves the built files. Server mode is opt-in: your astro.config file says output: server (some versions also had hybrid), and then part of the pages are rendered at request time. Open that file before you publish, because the next two steps depend on the answer.

  2. Upload the sources, not the built dist folder#

    We run the build on our side from your package.json, so there is no need to include dist or node_modules in the archive. They only make the upload heavier and go stale with the first edit. Content collections (blog posts in Markdown or MDX) and images are also processed during the build, so the source files are enough: the pages and the optimized images are produced on our side. Just check that the build script is in package.json — usually astro build.

  3. Add the Node adapter for server mode#

    If your site has a server part — form handling, your own endpoints, or pages rendered on the fly — Astro needs an adapter. Install the official Node.js adapter and set it to standalone mode: the build then produces a self-contained server you can simply start. The other mode, middleware, expects you to plug Astro into a server of your own, so it does not fit here — there would be nothing to launch.

  4. Read the port and host from environment variables#

    The platform sets the port to listen on through the PORT environment variable. A number hard-coded in your project is the number one reason a link does not open. The server produced by the Node adapter reads PORT and HOST on its own, so usually there is nothing to do: just make sure you do not override them in the config or the start command. Listen on 0.0.0.0 rather than localhost, because localhost is only visible inside the container. A static site skips this step entirely — there is no port at all.

  5. Move keys and tokens into secrets#

    If the site talks to a headless CMS, a form service or a paid API, the keys should not sit in the code or in the project folder. Netrun asks for them during setup and passes them in as encrypted environment variables, so they never end up in the archive or the repository. Keep the Astro rule in mind: only variables prefixed with PUBLIC_ reach the browser, so a secret key must not be named that way or it will show up in the page source. Also note that with a static build the values are baked in at build time: change a key and publish again.

  6. Upload the code and take the link#

    Bring the project in as a ZIP archive or import a GitHub repository, private ones included. No git and no terminal required. Netrun installs the dependencies, runs the build and gives you a public HTTPS address. Logs and publishing status are visible in your dashboard in real time, so a failed build shows up right away instead of as a blank page. Added a post or fixed some text? Upload a new version and the link stays the same.

That is it: your Astro site opens at an ordinary HTTPS link, with no server to rent and no web server to configure. The free plan gives you one project; the site sleeps while nobody uses it and wakes up on its own when someone opens the link, so only the first visit after a pause feels slower. If the blog has to answer without pauses and you want your own domain on it, the Pro plan is the right fit. Try Netrun.

Common questions

Do I need to build the site myself and upload the dist folder?

No, upload the source code. Netrun installs the dependencies, runs the build itself and serves the result at your link. A locally built dist folder only makes the archive heavier and goes stale as soon as you change the code.

How do I tell whether my Astro site is static or server-rendered?

Look at the astro.config file: if there is no output field, or it says static, the site is static, which is the default. A value of server (hybrid in some versions) means part of the pages are rendered at request time, and such a project needs the Node.js adapter. An indirect sign of server mode is having your own endpoints or handling forms inside the site.

Why did my server-mode Astro site build but the link does not open?

Usually the port: the app listens on its own port instead of the one given in the PORT environment variable, or it listens on localhost instead of 0.0.0.0. The second common cause is a build without the Node.js adapter, or the adapter set to middleware mode, which leaves nothing to start. The logs in your dashboard show which one it is.

Do content collections and image optimization work?

Yes. Blog posts from Markdown or MDX and image processing both happen during the build, and the build runs on our side, so there is nothing extra to enable. It is enough that the source files and images are in the project rather than pre-built.

Can I use React, Vue or Svelte islands?

Yes, for us that is just part of the project: the packages are listed in package.json and we install them during the build along with everything else. Islands need no special setup.

Will the site update itself after a commit on GitHub?

No, publishing is started from your dashboard. Upload a new version as an archive or press update from GitHub: the code is pulled from the repository, the site is rebuilt and stays at the same address. There is no automatic deploy on every commit.

What about React, Vue, Next.js, Nuxt, Svelte or Astro?

Yes, all of them work. Upload the source code with your package.json — you do not need to build the project yourself or include the built output, the build happens on our side. If your framework can produce both static pages and a server build, either works: in server mode the app should listen on the port from the environment variable. One important detail: values baked into the built front-end are visible to any visitor, so keep real keys on the server side.

Do I need my own server or VPS?

No. Netrun deploys your project on its own servers. There is no VPS to rent, no systemd or nginx to configure and no certificates to renew — all of that runs for you.

Why does my website sometimes sleep?

On the free plan, websites sleep after being idle and wake up in a couple of seconds on the first request. On the Pro plan your project runs without sleeping.

Can I connect my own domain?

Yes, on the Pro plan, and not just one: you can connect as many of your own domains to a website as you need. Open the “Domains” tab on the project page, enter the domain you bought from a registrar, and add the DNS record shown in the hint — every next domain is added the same way. Once the domains are ready, press “Check”: Netrun checks them all at once and issues a separate HTTPS certificate for each, so a hiccup with one domain does not hold up the others. The site opens at any of your addresses, and the Netrun link stays as a backup. If you connect a whole domain (for example myshop.com), you can add one more record so the site also opens with www. This is for websites — a bot or a background script does not need a domain.

Get your own project online

Upload your code, answer a couple of questions and get a working link. There is a free plan

Try Netrun
All blog articles