Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,23 @@ Examples are grouped by runtime. “Skip” directories hold work-in-progress te

- [`js-angular-staticsite`](js-angular-staticsite/README.md) – Angular-style static build.
- [`js-assemble-staticsite`](js-assemble-staticsite/README.md) – Assemble-generated static site.
- [`js-astro-ssr`](js-astro-ssr/README.md) – Astro server output using the Node adapter.
- [`js-astro-ssr`](js-astro-ssr/README.md) – Astro SSR (Node standalone adapter) on EdgeJS, with `wasmer.toml`/`app.yaml`.
- [`js-astro-staticsite`](js-astro-staticsite/README.md) – Astro static export.
- [`js-brunch-staticsite`](js-brunch-staticsite/README.md) – Brunch-style static build.
- [`js-create-react-app-staticsite`](js-create-react-app-staticsite/README.md) – Create React App-style static build.
- [`js-dashy`](js-dashy/README.md) – Dashy dashboard on EdgeJS (no database).
- [`js-docusaurus-staticsite`](js-docusaurus-staticsite/README.md) – Docusaurus docs site.
- [`js-eleventy-staticsite`](js-eleventy-staticsite/README.md) – Eleventy-generated static site.
- [`js-elysia`](js-elysia/README.md) – Elysia HTTP server.
- [`js-ember-staticsite`](js-ember-staticsite/README.md) – Ember-style static build.
- [`js-etherpad`](js-etherpad/README.md) – Etherpad 3.3 collaborative editor on EdgeJS.
- [`js-express`](js-express/README.md) – Express HTTP server.
- [`js-fastify`](js-fastify/README.md) – Fastify HTTP server.
- [`js-gatsby-staticsite`](js-gatsby-staticsite/README.md) – Gatsby static site.
- [`js-gatsby-staticsite2`](js-gatsby-staticsite2/README.md) – Gatsby default starter static site.
- [`js-h3`](js-h3/README.md) – H3 HTTP server.
- [`js-harp-staticsite`](js-harp-staticsite/README.md) – Harp-generated static site.
- [`js-hedgedoc`](js-hedgedoc/README.md) – HedgeDoc 1.11 markdown editor on EdgeJS (PostgreSQL required).
- [`js-hexo-staticsite`](js-hexo-staticsite/README.md) – Hexo-generated static site.
- [`js-hono`](js-hono/README.md) – Hono app served by the Node.js adapter.
- [`js-htmlwithjs-staticsite`](js-htmlwithjs-staticsite/README.md) – Plain static HTML/CSS/JavaScript site.
Expand All @@ -63,7 +66,7 @@ Examples are grouped by runtime. “Skip” directories hold work-in-progress te
- [`js-mcp`](js-mcp/README.md) – HTTP Model Context Protocol server.
- [`js-metalsmith-staticsite`](js-metalsmith-staticsite/README.md) – Metalsmith-generated static site.
- [`js-nestjs`](js-nestjs/README.md) – NestJS-oriented Node.js runtime example.
- [`js-next-ssr`](js-next-ssr/README.md) – Next.js server-rendered app.
- [`js-next-ssr`](js-next-ssr/README.md) – Next.js SSR (standalone output) on EdgeJS, with `wasmer.toml`/`app.yaml`.
- [`js-next-staticsite`](js-next-staticsite/README.md) – Next.js `output: "export"` sample.
- [`js-nitro`](js-nitro/README.md) – Nitro-oriented Node.js runtime example.
- [`js-node`](js-node/README.md) – Minimal Node.js HTTP server.
Expand All @@ -76,16 +79,20 @@ Examples are grouped by runtime. “Skip” directories hold work-in-progress te
- [`js-react-router`](js-react-router/README.md) – React Router-oriented Node.js runtime example.
- [`js-remix-ssr`](js-remix-ssr/README.md) – Remix-oriented server runtime example.
- [`js-remix-staticsite`](js-remix-staticsite/README.md) – Remix static export.
- [`js-rssmonster`](js-rssmonster/README.md) – RSSMonster RSS aggregator on EdgeJS (MySQL required).
- [`js-sanity-staticsite`](js-sanity-staticsite/README.md) – Sanity-style static build.
- [`js-solidstart`](js-solidstart/README.md) – SolidStart-oriented Node.js runtime example.
- [`js-stencil-staticsite`](js-stencil-staticsite/README.md) – Stencil-style static build.
- [`js-storybook-staticsite`](js-storybook-staticsite/README.md) – Storybook static build.
- [`js-svelte`](js-svelte/README.md) – Vite-powered Svelte app.
- [`js-sveltekit-staticsite`](js-sveltekit-staticsite/README.md) – Compact SvelteKit-style static build.
- [`js-tanstack-start`](js-tanstack-start/README.md) – TanStack Start-oriented Node.js runtime example.
- [`js-totaljs-cms`](js-totaljs-cms/README.md) – Total.js CMS on EdgeJS (filesystem database).
- [`js-umami`](js-umami/README.md) – Umami web analytics on EdgeJS (PostgreSQL required).
- [`js-umijs-staticsite`](js-umijs-staticsite/README.md) – UmiJS-style static build.
- [`js-vite-react-staticsite`](js-vite-react-staticsite/README.md) – Vite React static build.
- [`js-vite-staticsite`](js-vite-staticsite/README.md) – Vite-powered static site.
- [`js-vite-standalone`](js-vite-standalone/README.md) – Vite site served by a small Node.js server on EdgeJS.
- [`js-vitepress-staticsite`](js-vitepress-staticsite/README.md) – VitePress documentation site.
- [`js-vue-staticsite`](js-vue-staticsite/README.md) – Vue static build.
- [`js-vuepress-staticsite`](js-vuepress-staticsite/README.md) – VuePress documentation site.
Expand Down
3 changes: 3 additions & 0 deletions js-astro-ssr/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
.astro/
50 changes: 33 additions & 17 deletions js-astro-ssr/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
# Astro SSR + Wasmer
# Astro SSR on Wasmer Edge

This example shows how to run a server-rendered **Astro** app on **Wasmer Edge**.
A minimal [Astro](https://astro.build/) app with server-side rendering
(`output: "server"` with the [`@astrojs/node`](https://docs.astro.build/en/guides/integrations-guide/node/)
adapter in `standalone` mode), deployed to
[Wasmer Edge](https://wasmer.io/products/edge) using
[EdgeJS](https://github.com/wasmerio/edgejs) (the `wasmer/edgejs-quickjs`
package) as the JavaScript runtime.

## Demo
The app is **built with Node.js** (`astro build`), and only the resulting
build artifact (`dist/`, containing the standalone server and the client
assets) runs on EdgeJS.

`https://<your-subdomain>.wasmer.app/` (deploy to get a live URL)
## Develop

## How it Works
```bash
pnpm install
pnpm dev
```

## Build

* `astro.config.mjs` enables Astro server output with the Node adapter.
* `npm run build` writes the standalone server bundle into `dist/`.
* Wasmer Edge runs the Node.js process and forwards HTTP traffic to the configured port.
```bash
pnpm build
```

## Running Locally
This produces the standalone server in `dist/server/entry.mjs` and the static
client assets in `dist/client/`.

## Run locally with Wasmer

```bash
npm install
npm run build
npm start
wasmer run . --net --env PORT=4321
```

Open `http://127.0.0.1:4321/` (or the port printed by the framework) to view the running server.
Then open [http://localhost:4321](http://localhost:4321).

## Deploy to Wasmer Edge

## Deploying to Wasmer (Overview)
Update the `name` fields in `wasmer.toml` and `app.yaml` to use your own
namespace, then:

1. Install dependencies and confirm the app starts locally.
2. Deploy from this example directory with `wasmer deploy`.
3. Visit `https://<your-subdomain>.wasmer.app/` once the deployment is live.
```bash
wasmer deploy
```
4 changes: 4 additions & 0 deletions js-astro-ssr/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
kind: wasmer.io/App.v0
name: wasmer-edge-astro-ssr-sample
package: wasmer-tests/wasmer-edge-astro-ssr-sample
8 changes: 4 additions & 4 deletions js-astro-ssr/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import node from "@astrojs/node";
import { defineConfig } from "astro/config";
import node from '@astrojs/node';
import { defineConfig } from 'astro/config';

export default defineConfig({
output: 'server',
adapter: node({
mode: "standalone",
mode: 'standalone',
}),
output: "server",
});
Loading