{"id":15045922,"url":"https://github.com/denoland/deno-astro-adapter","last_synced_at":"2025-04-12T18:44:43.745Z","repository":{"id":194780526,"uuid":"691569405","full_name":"denoland/deno-astro-adapter","owner":"denoland","description":"A Deno adapter for running Astro applications on the Deno runtime.","archived":false,"fork":false,"pushed_at":"2025-03-12T02:04:16.000Z","size":348,"stargazers_count":100,"open_issues_count":10,"forks_count":19,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-03T23:08:51.940Z","etag":null,"topics":["astro","deno"],"latest_commit_sha":null,"homepage":"https://npm.im/@deno/astro-adapter","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denoland.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-14T12:53:32.000Z","updated_at":"2025-04-03T22:02:50.000Z","dependencies_parsed_at":"2024-03-21T02:42:49.957Z","dependency_job_id":"e6102283-a218-4f45-910a-f9ee1a465cdd","html_url":"https://github.com/denoland/deno-astro-adapter","commit_stats":{"total_commits":17,"total_committers":8,"mean_commits":2.125,"dds":0.5882352941176471,"last_synced_commit":"cbfe33f796bc41b3a7a8dbc23e4cae56706aae42"},"previous_names":["denoland/deno-astro-adapter"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denoland%2Fdeno-astro-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denoland%2Fdeno-astro-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denoland%2Fdeno-astro-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denoland%2Fdeno-astro-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denoland","download_url":"https://codeload.github.com/denoland/deno-astro-adapter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248617200,"owners_count":21134190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astro","deno"],"created_at":"2024-09-24T20:52:28.099Z","updated_at":"2025-04-12T18:44:43.712Z","avatar_url":"https://github.com/denoland.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @deno/astro-adapter\n\nThis adapter allows Astro to deploy your SSR site to Deno targets.\n\nLearn how to deploy your Astro site in our\n[Deno Deploy deployment guide](https://docs.astro.build/en/guides/deploy/deno/).\n\n- \u003cstrong\u003e [Why Astro Deno](#why-astro-deno)\u003c/strong\u003e\n- \u003cstrong\u003e [Installation](#installation)\u003c/strong\u003e\n- \u003cstrong\u003e [Usage](#usage)\u003c/strong\u003e\n- \u003cstrong\u003e [Configuration](#configuration)\u003c/strong\u003e\n- \u003cstrong\u003e [Examples](#examples)\u003c/strong\u003e\n- \u003cstrong\u003e [Contributing](#contributing)\u003c/strong\u003e\n\n## Why Astro Deno\n\nIf you're using Astro as a static site builder—its behavior out of the box—you\ndon't need an adapter.\n\nIf you wish to\n[use server-side rendering (SSR)](https://docs.astro.build/en/guides/server-side-rendering/),\nAstro requires an adapter that matches your deployment runtime.\n\nYou also need an adapter or server if you wish to deploy your site to\n[Deno Deploy](https://deno.com/deploy).\n\n[Deno](https://deno.com/) is a runtime similar to Node, but with an API that's\nmore similar to the browser's API. This adapter provides access to Deno's API\nand creates a script to run your project on a Deno server.\n\n## Installation\n\nAdd the Deno adapter to enable SSR in your Astro project with the following\nsteps:\n\n1. Install the Deno adapter to your project’s dependencies using your preferred\n   package manager. If you’re using npm or aren’t sure, run this in the\n   terminal:\n\n   ```bash\n   npm install @deno/astro-adapter\n   ```\n\n1. Update your `astro.config.mjs` project configuration file with the changes\n   below.\n\n   ```js ins={3,6-7}\n   // astro.config.mjs\n   import { defineConfig } from \"astro/config\";\n   import deno from \"@deno/astro-adapter\";\n\n   export default defineConfig({\n     output: \"server\",\n     adapter: deno(),\n   });\n   ```\n\nNext, update your `preview` script in `package.json` to run `deno`:\n\n```json ins={8}\n// package.json\n{\n  // ...\n  \"scripts\": {\n    \"dev\": \"astro dev\",\n    \"start\": \"astro dev\",\n    \"build\": \"astro build\",\n    \"preview\": \"deno run --allow-net --allow-read --allow-env ./dist/server/entry.mjs\"\n  }\n}\n```\n\nYou can now use this command to preview your production Astro site locally with\nDeno.\n\n```bash\nnpm run preview\n```\n\n## Usage\n\nAfter\n[performing a build](https://docs.astro.build/en/guides/deploy/#building-your-site-locally)\nthere will be a `dist/server/entry.mjs` module. You can start a server by\nimporting this module in your Deno app:\n\n```js\nimport \"./dist/server/entry.mjs\";\n```\n\nSee the `start` option below for how you can have more control over starting the\nAstro server.\n\nYou can also run the script directly using deno:\n\n```sh\ndeno run --allow-net --allow-read --allow-env ./dist/server/entry.mjs\n```\n\n## Configuration\n\nTo configure this adapter, pass an object to the `deno()` function call in\n`astro.config.mjs`.\n\n```js\n// astro.config.mjs\nimport { defineConfig } from \"astro/config\";\nimport deno from \"@deno/astro-adapter\";\n\nexport default defineConfig({\n  output: \"server\",\n  adapter: deno({\n    //options go here\n  }),\n});\n```\n\n### start\n\nThis adapter automatically starts a server when it is imported. You can turn\nthis off with the `start` option:\n\n```js\nimport { defineConfig } from \"astro/config\";\nimport deno from \"@deno/astro-adapter\";\n\nexport default defineConfig({\n  output: \"server\",\n  adapter: deno({\n    start: false,\n  }),\n});\n```\n\nIf you disable this, you need to write your own Deno web server. Import and call\n`handle` from the generated entry script to render requests:\n\n```ts\nimport { handle } from \"./dist/server/entry.mjs\";\n\nDeno.serve((req: Request) =\u003e {\n  // Check the request, maybe do static file handling here.\n\n  return handle(req);\n});\n```\n\n### port and hostname\n\nYou can set the port (default: `8085`) and hostname (default: `0.0.0.0`) for the\ndeno server to use. If `start` is false, this has no effect; your own server\nmust configure the port and hostname.\n\n```js\nimport { defineConfig } from \"astro/config\";\nimport deno from \"@deno/astro-adapter\";\n\nexport default defineConfig({\n  output: \"server\",\n  adapter: deno({\n    port: 8081,\n    hostname: \"myhost\",\n  }),\n});\n```\n\n## Examples\n\nThe [Astro Deno](https://github.com/withastro/astro/tree/main/examples/deno)\nexample includes a `preview` command that runs the entry script directly. Run\n`npm run build` then `npm run preview` to run the production deno server.\n\n## Contributing\n\nTo configure your development environment, clone the repository and install\n[`pnpm`](https://pnpm.io/). `pnpm` is a package manager that emphasizes disk\nspace efficiency and is used for managing the dependencies of this project. Once\ninstalled, run `pnpm i` to install the dependencies.\n\n```sh\ngit clone\ncd astro-adapter\npnpm i\n```\n\nThe Deno Astro Adapter is currently built and tested with Deno 2.x. To test your\nchanges make sure you have Deno 2.x installed\n\n```sh\npnpm run test\n```\n\nFinally, you can check your code formatting with: `pnpm run fmt`.\n\nThis package is maintained by Deno's Core team. You're welcome to submit an\nissue or PR!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenoland%2Fdeno-astro-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenoland%2Fdeno-astro-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenoland%2Fdeno-astro-adapter/lists"}