{"id":19982363,"url":"https://github.com/netlify/angular-runtime","last_synced_at":"2025-04-06T08:11:39.215Z","repository":{"id":37023066,"uuid":"383523367","full_name":"netlify/angular-runtime","owner":"netlify","description":"The Angular Runtime allows Angular to run on Netlify with zero configuration","archived":false,"fork":false,"pushed_at":"2025-04-02T20:41:28.000Z","size":11358,"stargazers_count":26,"open_issues_count":18,"forks_count":12,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-02T23:06:56.761Z","etag":null,"topics":["angular","netlify","netlify-plugin","production"],"latest_commit_sha":null,"homepage":"https://docs.netlify.com/integrations/frameworks/angular/","language":"JavaScript","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/netlify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-06T15:53:27.000Z","updated_at":"2025-03-24T01:07:13.000Z","dependencies_parsed_at":"2024-02-26T18:31:15.107Z","dependency_job_id":"95608ba5-6a71-4571-b344-fa891ebe96ce","html_url":"https://github.com/netlify/angular-runtime","commit_stats":{"total_commits":57,"total_committers":9,"mean_commits":6.333333333333333,"dds":0.6491228070175439,"last_synced_commit":"1ed2161ec5b02376e8a502734f1c73dbb7f49cb1"},"previous_names":["netlify/netlify-plugin-angular-universal"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netlify%2Fangular-runtime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netlify%2Fangular-runtime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netlify%2Fangular-runtime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netlify%2Fangular-runtime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netlify","download_url":"https://codeload.github.com/netlify/angular-runtime/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247451653,"owners_count":20940939,"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":["angular","netlify","netlify-plugin","production"],"created_at":"2024-11-13T04:10:57.954Z","updated_at":"2025-04-06T08:11:39.193Z","avatar_url":"https://github.com/netlify.png","language":"JavaScript","readme":"![Netlify Angular Runtime – Run Angular seamlessly on Netlify](netlify-plugin-angular.png)\n\n# Angular Runtime\n\n\u003cp align=\"center\"\u003e\n  \u003ca aria-label=\"npm version\" href=\"https://www.npmjs.com/package/@netlify/angular-runtime\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/npm/v/@netlify/angular-runtime\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"MIT License\" href=\"https://img.shields.io/npm/l/@netlify/angular-runtime\"\u003e\n    \u003cimg alt=\"\" src=\"https://img.shields.io/badge/License-MIT-yellow.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nThis build plugin implements Angular Support on Netlify.\n\n## Table of Contents\n\n- [Installation and Configuration](#installation-and-configuration)\n- [Accessing `Request` and `Context` during Server-Side Rendering](#accessing-request-and-context-during-server-side-rendering)\n- [Request handling](#request-handling)\n  - [Customizing request handling](#customizing-request-handling)\n  - [Limitations](#limitations)\n- [CLI Usage](#cli-usage)\n- [Getting Help](#getting-help)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Installation and Configuration\n\nNetlify automatically detects Angular projects and sets up the latest version of this plugin.\n\n### For Angular 17 and Angular 18\n\nThere's no further configuration needed from Netlify users.\n\n### For Angular 19\n\nIf you are using Server-Side Rendering you will need to install Angular Runtime in your Angular project to be able to import required utilities to successfully deploy request handler to Netlify. See [Manual Installation](#manual-installation) for installations details. See [Request handling](#request-handling) for more information about request handler.\n\n### Manual Installation\n\nIf you need to pin this plugin to a specific version or if you are using Server-Side Rendering with Angular 19, you will need to install the plugin manually.\n\nInstall it via your package manager:\n\n```bash\nnpm install -D @netlify/angular-runtime\n# or\nyarn add -D @netlify/angular-runtime\n```\n\n## Accessing `Request` and `Context` during Server-Side Rendering\n\nDuring server-side rendering (SSR), you can access the incoming `Request` object and the Netlify-specific `Context` object via providers:\n\n```ts\nimport type { Context } from \"@netlify/edge-functions\"\n\nexport class FooComponent {\n\n  constructor(\n    // ...\n    @Inject('netlify.request') @Optional() request?: Request,\n    @Inject('netlify.context') @Optional() context?: Context,\n  ) {\n    console.log(`Rendering Foo for path ${request?.url} from location ${context?.geo?.city}`)\n    // ...\n  }\n  \n}\n```\n\nKeep in mind that these will not be available on the client-side or during [prerendering](https://angular.dev/guide/prerendering#prerendering-parameterized-routes).\n\nTo test this in local development, run your Angular project using `netlify serve`:\n\n```sh\nnetlify serve\n```\n### App Engine Developer Preview usage with Angular@19\n\nIf you opt into the App Engine Developer Preview accessing `Request` and `Context` objects is streamlined. Instead of custom Netlify prefixed providers, you should use the standardized injection tokens for those provided by `@angular/core` instead:\n\n```diff\n+import { REQUEST, REQUEST_CONTEXT } from '@angular/core'\nimport type { Context } from \"@netlify/edge-functions\"\n\nexport class FooComponent {\n\n  constructor(\n    // ...\n-    @Inject('netlify.request') @Optional() request?: Request,\n-    @Inject('netlify.context') @Optional() context?: Context,\n+    @Inject(REQUEST) @Optional() request?: Request,\n+    @Inject(REQUEST_CONTEXT) @Optional() context?: Context,\n  ) {\n    console.log(`Rendering Foo for path ${request?.url} from location ${context?.geo?.city}`)\n    // ...\n  }\n  \n}\n```\n\n## Request handling\n\nStarting with Angular@19. The build plugin makes use of the `server.ts` file to handle requests. The default Angular scaffolding generates incompatible code for Netlify so the build plugin will swap it for compatible `server.ts` file automatically if it detects default version being used. \n\nMake sure you have `@netlify/angular-runtime` version 2.2.0 or later installed in your project. Netlify compatible `server.ts` file imports utilities from this package and Angular Compiler need to be able to resolve it and it can only do that if it's installed in your project and not when it's auto-installed by Netlify.\n\n### Customizing request handling\n\nIf you need to customize the request handling, you can do so by copying one of code snippets below to your `server.ts` file.\n\nIf you did not opt into the App Engine Developer Preview:\n\n```ts\nimport { CommonEngine } from '@angular/ssr/node'\nimport { render } from '@netlify/angular-runtime/common-engine.mjs'\n\nconst commonEngine = new CommonEngine()\n\nexport async function netlifyCommonEngineHandler(request: Request, context: any): Promise\u003cResponse\u003e {\n  // Example API endpoints can be defined here.\n  // Uncomment and define endpoints as necessary.\n  // const pathname = new URL(request.url).pathname;\n  // if (pathname === '/api/hello') {\n  //   return Response.json({ message: 'Hello from the API' });\n  // }\n\n  return await render(commonEngine)\n}\n```\n\nIf you opted into the App Engine Developer Preview:\n\n```ts\nimport { AngularAppEngine, createRequestHandler } from '@angular/ssr'\nimport { getContext } from '@netlify/angular-runtime/context.mjs'\n\nconst angularAppEngine = new AngularAppEngine()\n\nexport async function netlifyAppEngineHandler(request: Request): Promise\u003cResponse\u003e {\n  const context = getContext()\n\n  // Example API endpoints can be defined here.\n  // Uncomment and define endpoints as necessary.\n  // const pathname = new URL(request.url).pathname;\n  // if (pathname === '/api/hello') {\n  //   return Response.json({ message: 'Hello from the API' });\n  // }\n\n  const result = await angularAppEngine.handle(request, context)\n  return result || new Response('Not found', { status: 404 })\n}\n\n/**\n * The request handler used by the Angular CLI (dev-server and during build).\n */\nexport const reqHandler = createRequestHandler(netlifyAppEngineHandler)\n```\n\n### Limitations\n\nThe [`server.ts` file](https://angular.dev/guide/ssr#configure-server-side-rendering) that's part of the Angular scaffolding is meant for deploying to a VM, and is not compatible with this Netlify build plugin for Angular@17 and Angular@18. If you applied changes to that file, you'll need to replicate them in an Edge Function. See (#135)[https://github.com/netlify/angular-runtime/issues/135] for an example.\n\n## CLI Usage\n\n### Requirements\n\nTo use the Angular Runtime while building and deploying with the CLI, you need to have `netlify-cli v17.0.0` installed (or a later version).\n\nPlease also make sure to use `ntl deploy --build` (rather than `ntl build \u0026\u0026 ntl deploy`).\n\n## Getting Help\n\nWe love to hear from you so if you have questions, comments or find a bug in the\nproject, let us know! You can either:\n\n- Open an issue on this repository\n- Tweet at us! We're [@Netlify on Twitter](https://twitter.com/Netlify)\n- Or, [join the community forums](https://answers.netlify.com)\n\n## Contributing\n\nWe welcome contributions ❤️ - see the [CONTRIBUTING.md](CONTRIBUTING.md) file\nfor details.\n\n## License\n\nThis project is licensed under the MIT License - see the\n[LICENSE.md](LICENSE.md) file for details\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetlify%2Fangular-runtime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetlify%2Fangular-runtime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetlify%2Fangular-runtime/lists"}