Skip to main content

Introduction

This guide covers deploying Astro applications on Shard Cloud. Astro is a modern static site generator with optional server-side rendering.

Creating Your Project

Ensure you have Node.js (16+) and npm installed.

Creating a New Astro Project

npm create astro@latest
cd my-astro-site
npm install

Building Your Project

Build the production output:
npm run build
This creates a dist/ folder with static files.

Serving Your Astro Site

Static Sites (Default)

For static Astro sites, use serve:
.shardcloud
DISPLAY_NAME=Astro Site
DESCRIPTION=Astro Static Site
LANGUAGE=node
MEMORY=512
VERSION=recommended
SUBDOMAIN=my-astro-site
CUSTOM_COMMAND=npm run build && npx serve -s dist -l 80

SSR Mode

For server-side rendering with Node.js adapter:
  1. Install the Node adapter:
npx astro add node
  1. Configure astro.config.mjs:
astro.config.mjs
import { defineConfig } from 'astro/config';
import node from '@astrojs/node';

export default defineConfig({
  output: 'server',
  adapter: node({
    mode: 'standalone'
  }),
  server: {
    port: 80,
    host: true
  }
});
  1. Shard Cloud config:
.shardcloud
DISPLAY_NAME=Astro SSR Site
DESCRIPTION=Astro Server-Rendered Site
LANGUAGE=node
MEMORY=512
VERSION=recommended
SUBDOMAIN=my-astro-ssr
CUSTOM_COMMAND=npm run build && node dist/server/entry.mjs

Deploying

1

Build Your Application

Run npm run build.
2

Prepare Your Files

Ensure you have:
  • src/ folder
  • package.json
  • .shardcloud
  • astro.config.mjs
3

Exclude Unnecessary Files

Remove: node_modules/, dist/, package-lock.json
4

Create ZIP Archive

Compress your project folder.
5

Upload to Shard Cloud

Go to Shard Cloud Dashboard and upload.

Additional Resources

Visit the official Astro documentation for more information.

Troubleshooting

Check for component syntax errors and ensure all dependencies are installed.
Verify the Node adapter is properly configured and the output mode is set to ‘server’.