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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,8 @@ request path down is worse than none.

See [examples](./examples) for complete working setups — e.g. [express-basic](./examples/express-basic).

The [Astro SSR and Fastify playground](./playgrounds/astro-fastify) shows which requests reach the Node origin and how to verify monitor-mode decisions locally.

## FAQ

**Will this slow down my app?** Local rules (tripwires, in-memory rate limiting) run in-process and make no network calls. With an API key, a request goes to WebDecoy only when local analysis flags it for verification; that call is awaited, bounded by `timeout` (default 5000 ms), and fails open. Requests local analysis does not flag make no call.
Expand Down
1 change: 1 addition & 0 deletions playgrounds/astro-fastify/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.astro/
24 changes: 24 additions & 0 deletions playgrounds/astro-fastify/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# What reaches your Astro SSR origin?

This local playground uses Astro's Node adapter in middleware mode, Fastify and the WebDecoy Node SDK. It shows what server-side request monitoring can observe. It runs on loopback with synthetic requests and requires no account or API key.

## Run it

Use Node 22.23.4 or later.

```sh
cd playgrounds/astro-fastify
npm ci
npm test
npm start
```

Visit <http://127.0.0.1:4321/>. The built Astro app renders an HTML page on demand and Fastify records an `ALLOW` decision in the terminal. Then visit <http://127.0.0.1:4321/lab/check/>. The synthetic tripwire records `DENY` while the route still serves its ordinary HTTP 404. The verdict and HTTP response answer different questions. Monitor mode keeps the application's response.

## Verify the coverage boundary

The test suite also puts a small HTTP server in front of the SSR origin. It reads the prerendered snapshot from Astro's build output and serves it without contacting Fastify. That request creates no origin decision. A request forwarded to the SSR route creates one. This models an upstream cache hit without using a CDN or sending real traffic.

The example intentionally serves only the two origin routes. A production app needs its own static file handling and safe proxy configuration. The output is limited to the HTTP method, registered route, rule conclusion and tripwire result. The sample has no cloud integration. In a connected installation, reporting requires an authorized server-side site key and a verified receipt in the associated tenant.

[Back to the WebDecoy Node SDK](../../README.md)
9 changes: 9 additions & 0 deletions playgrounds/astro-fastify/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import node from '@astrojs/node';
import { defineConfig } from 'astro/config';

export default defineConfig({
output: 'server',
adapter: node({ mode: 'middleware' }),
trailingSlash: 'always',
build: { format: 'directory' },
});
Loading
Loading