This is an example of how to set up an Astro site with server-side rendering (SSR) on Kinsta’s Application Hosting services from a GitHub repository.

By default, Astro is a static site builder focusing on content-rich websites to deliver faster load times with less JavaScript. Enabling SSR in Astro makes it possible to add dynamic features like sessions for login, connecting with a database, and more to your site. More information is available on the Astro website.

During the deployment process, Kinsta automatically installs dependencies defined in your package.json file.

  1. Log in to GitHub and create a new repository from this template (Use this template > Create a new repository): Kinsta – Hello World – SSR Site With Astro.
  2. In MyKinsta, add an application with the Hello World Astro SSR repository. The Start command can be left blank for the web process as Kinsta automatically detects the required command during the first deployment.

The site is available as soon as the build finishes and the Kinsta Welcome page loads at your site’s URL.

Kinsta Welcome page after successful installation of Astro.
Kinsta Welcome page after successful installation of Astro.

Prefer to watch the video version?

Web Server Setup

Port

Kinsta automatically sets the PORT environment variable. You should not define it yourself or hard-code it into the application.

Start Command

When you deploy the application, Kinsta automatically creates a web process with npm start as the Start command. Make sure to use this command to run your server.

Deployment Lifecycle

Whenever a deployment is initiated (through creating an application or re-deploying due to an incoming commit), the npm build command is run, followed by the npm start command.