# @luckydye/astro-payload

> This integration creates a SSR route for the payload cms with the node adapter even in dev mode.

Latest version **0.0.19** (published 2023-04-16) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @luckydye/astro-payload
pnpm add @luckydye/astro-payload
yarn add @luckydye/astro-payload
bun add @luckydye/astro-payload
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.19 |
| Published | 2023-04-16 |
| First published | 2023-04-09 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 (+17 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | luckydye |
| Keywords | astro-integration |

## Links

- npm: https://www.npmjs.com/package/@luckydye/astro-payload
- Repository: https://github.com/luckydye/astro-payload
- Homepage: https://github.com/luckydye/astro-payload#readme
- Issues: https://github.com/luckydye/astro-payload/issues
- npm.io page: https://npm.io/package/@luckydye/astro-payload

## Dependencies (1)

- [astro](https://npm.io/package/astro.md) ^2.2.0

## Recent versions

- 0.0.19 (latest) — 2023-04-16
- 0.0.16 (dev) — 2023-04-16
- 0.0.18 — 2023-04-16
- 0.0.17 — 2023-04-16
- 0.0.15 — 2023-04-14
- 0.0.14 — 2023-04-13
- 0.0.13 — 2023-04-12
- 0.0.12 — 2023-04-12
- 0.0.11 — 2023-04-09
- 0.0.10 — 2023-04-09
- 0.0.9 — 2023-04-09
- 0.0.8 — 2023-04-09
- 0.0.7 — 2023-04-09
- 0.0.6 — 2023-04-09
- 0.0.5 — 2023-04-09
- … 4 more at https://npm.io/package/@luckydye/astro-payload/versions

## README

# Astro integration for Payload CMS

This integration creates a SSR route for the payload cms with the node adapter even in dev mode.

Example project: https://github.com/luckydye/astro-payload/tree/main/apps/web

## Options
```typescript
interface Options {
	// entry file path for the payload route
	payloadRoute: string;
}
```

### Example Astro config:

```typescript
// /astro.config.ts
import { defineConfig } from "astro/config";
import payload from "@luckydye/astro-payload";
import node from "@astrojs/node";

// https://astro.build/config
export default defineConfig({
	srcDir: "src",
	output: "server",
	adapter: node({
		mode: "standalone",
	}),
	integrations: [
		payload({
			payloadRoute: "./payload.ts",
		}),
	],
});
```

```typescript
// ./payload.ts
import payload from "payload";
import payloadConfig from "./payload.config";
import express from "express";
import type { APIRoute } from "astro";

async function startPayload() {
	const app = express();
	await payload.init({
		secret: process.env.PAYLOAD_SECRET || "",
		mongoURL: process.env.DB_URI || "",
		mongoOptions: {
			user: process.env.DB_ROOT_USER,
			pass: process.env.DB_ROOT_PASS,
			dbName: process.env.DB_NAME,
		},
		express: app,
		config: payloadConfig,
	});
	// starting payload on a different port
	app.listen(process.env.PAYLOAD_PORT);
}

const payloadServer = startPayload();

export const all: APIRoute = async () => {
	await payloadServer;

	return new Response(null, {
		status: 404,
	});
};
```

---
_Source: https://npm.io/package/@luckydye/astro-payload · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
