{"id":22231051,"url":"https://github.com/alexnguyennz/astro-aws-amplify","last_synced_at":"2025-10-29T00:31:29.071Z","repository":{"id":211682226,"uuid":"729730154","full_name":"alexnguyennz/astro-aws-amplify","owner":"alexnguyennz","description":"Astro adapter for Astro SSR deployments on AWS Amplify","archived":false,"fork":false,"pushed_at":"2024-08-11T19:49:51.000Z","size":409,"stargazers_count":37,"open_issues_count":3,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-06T12:08:57.761Z","etag":null,"topics":["amplify","astro","aws","aws-amplify","ssr"],"latest_commit_sha":null,"homepage":"https://www.astroawsamplify.com","language":"MDX","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/alexnguyennz.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-12-10T06:52:26.000Z","updated_at":"2025-01-12T21:34:13.000Z","dependencies_parsed_at":"2024-12-25T01:11:29.799Z","dependency_job_id":"a0a7d706-ecbc-42c8-b1bf-a42218a02e81","html_url":"https://github.com/alexnguyennz/astro-aws-amplify","commit_stats":null,"previous_names":["alexnguyennz/astro-aws-amplify"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexnguyennz%2Fastro-aws-amplify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexnguyennz%2Fastro-aws-amplify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexnguyennz%2Fastro-aws-amplify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexnguyennz%2Fastro-aws-amplify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexnguyennz","download_url":"https://codeload.github.com/alexnguyennz/astro-aws-amplify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238317010,"owners_count":19451907,"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":["amplify","astro","aws","aws-amplify","ssr"],"created_at":"2024-12-03T01:17:20.695Z","updated_at":"2025-10-29T00:31:28.611Z","avatar_url":"https://github.com/alexnguyennz.png","language":"MDX","funding_links":[],"categories":[],"sub_categories":[],"readme":"# astro-aws-amplify\n\nAstro AWS Amplify is an Astro adapter for deploying server-side Astro sites on AWS Amplify Hosting.\n\n[View Demo](https://main.dy0rr16jdndpq.amplifyapp.com/)\n\n## Prerequisites\n\n- an Astro site - `v4.x` or higher (may also work on `v3.x` sites)\n\n## Installation\n\n```sh\n# Using NPM\nnpm install astro-aws-amplify\n# Using Yarn\nyarn add astro-aws-amplify\n# Using PNPM\npnpm add astro-aws-amplify\n```\n\nIn your Astro config, add the adapter:\n\n```diff\n// astro.config.mjs\nimport { defineConfig } from 'astro/config';\n+ import awsAmplify from 'astro-aws-amplify';\n\nexport default defineConfig({\n+ output: 'server', // output: 'hybrid'\n+ adapter: awsAmplify()\n})\n```\n\n## Configuration\n\n### Astro\n\n[Server and hybrid modes](https://docs.astro.build/en/guides/server-side-rendering/#enable-on-demand-server-rendering) are supported. For static sites, remove the adapter and [follow these instructions](https://docs.astro.build/en/guides/deploy/aws/#aws-amplify).\n\n### AWS Amplify\n\nAWS Amplify Hosting uses Node.js v16 by default which isn't supported.\n\nYou can use the newer `Amazon Linux:2023` by adding an environment variable of:\n\n```markdown\n_CUSTOM_IMAGE=amplify:al2023\n```\n\n#### Build specifications\n\nYou can use the following build specifications as-is or customize it to your liking. Moving the `node_modules` folder is required for `npm` and `Yarn` deployments.\n\n##### npm\n```yaml\nversion: 1\nfrontend:\n  phases:\n    preBuild:\n      commands:\n        - npm ci\n    build:\n      commands:\n        - env \u003e\u003e .env\n        - npm run build\n        - mv node_modules ./.amplify-hosting/compute/default\n        - mv .env ./.amplify-hosting/compute/default/.env\n  artifacts:\n    baseDirectory: .amplify-hosting\n    files:\n      - '**/*'\n  cache:\n    paths:\n      - node_modules/**/*\n```\n\n##### pnpm\n```yaml\nversion: 1\nfrontend:\n  phases:\n    preBuild:\n      commands:\n        - npm i -g pnpm\n        - pnpm config set store-dir .pnpm-store\n        - pnpm i\n    build:\n      commands:\n        - env \u003e\u003e .env\n        - pnpm run build\n        - mv .env ./.amplify-hosting/compute/default/.env\n\n  artifacts:\n    baseDirectory: .amplify-hosting\n    files:\n      - '**/*'\n  cache:\n    paths:\n      - .pnpm-store/**/*\n```\n\n##### Yarn\n```yaml\nversion: 1\nfrontend:\n  phases:\n    preBuild:\n      commands:\n        - yarn install\n    build:\n      commands:\n        - env \u003e\u003e .env\n        - yarn run build\n        - mv node_modules ./.amplify-hosting/compute/default\n        - mv .env ./.amplify-hosting/compute/default/.env\n  artifacts:\n    baseDirectory: .amplify-hosting\n    files:\n      - '**/*'\n  cache:\n    paths:\n      - node_modules/**/*\n```\n\n## Features\n\n### Supported\n- [server and hybrid](https://docs.astro.build/en/guides/server-side-rendering/#enable-on-demand-server-rendering) mode\n- image optimization with [`\u003cImage\u003e`](https://docs.astro.build/en/guides/images/#image--astroassets) and [`\u003cPicture /\u003e`](https://docs.astro.build/en/guides/images/#picture-)\n- [base paths](https://docs.astro.build/en/reference/configuration-reference/#base)\n- [middleware](https://docs.astro.build/en/guides/middleware/)\n\n### Unsupported or untested\n- [Amplify Image](https://docs.aws.amazon.com/amplify/latest/userguide/image-optimization.html) optimization\n- [build previews](https://docs.astro.build/en/reference/cli-reference/#astro-preview) (`npm run preview`)\n- ???\n\n## Limitations\n\n### Static or prerendered pages\n\nStatic or prerendered pages (that are defined with `export const prerender = true` or default for hybrid) will need a rewrite rule.\n\nFor example, if you have a static `/about` page, create a rewrite of:\n\n```\n/about/ /about/index.html 200 (Rewrite)\n```\n\nIf you don't use [trailing slashes](https://docs.astro.build/en/reference/configuration-reference/#trailingslash), you will need to also add:\n\n```\n/about /about/index.html 200 (Rewrite)\n```\n\nFor static dynamic routes, like a route of `/blog/[slug].astro`, create a rewrite of:\n\n```\n/blog/\u003cslug\u003e/ /blog/\u003cslug\u003e/index.html 200 (Rewrite)\n```\n\n\n#### Base path rewrites\n\n```\n/base/about/ /base/about/index.html 200 (Rewrite)\n```\n\n### 404 Pages\nCustom 404 pages (like `404.astro`) need to be server-side rendered (not prerendered) to work. This is a [limitation with Amplify](https://docs.aws.amazon.com/amplify/latest/userguide/ssr-deployment-specification.html#catchall-fallback-routing).\n\n### Static files without extensions\nDue to [limitations with Amplify routing](https://docs.aws.amazon.com/amplify/latest/userguide/ssr-deployment-specification.html#catchall-fallback-routing), to serve `public` files without extensions, place them in a folder called `assets` (`/public/assets/`) and reference them with `/assets/filename`:\n\n```sh title=\"/public/assets/\"\nsomefile\n```\n\nAny other static files with extensions will work as usual.\n\n## License\n\nMIT\n\n## Acknowledgements\n\nUses code from the [@astrojs/node](https://github.com/withastro/astro/tree/main/packages/integrations/node) adapter to establish a Node.js server required for AWS Amplify SSR environments.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexnguyennz%2Fastro-aws-amplify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexnguyennz%2Fastro-aws-amplify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexnguyennz%2Fastro-aws-amplify/lists"}