{"id":14978590,"url":"https://github.com/nestjs/serve-static","last_synced_at":"2025-05-14T03:11:17.733Z","repository":{"id":37664652,"uuid":"197449280","full_name":"nestjs/serve-static","owner":"nestjs","description":"Serve static websites (SPA's) using Nest framework (node.js) 🥦","archived":false,"fork":false,"pushed_at":"2025-05-09T16:02:17.000Z","size":4761,"stargazers_count":488,"open_issues_count":5,"forks_count":63,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-10T01:35:40.487Z","etag":null,"topics":["javascript","nestjs","node","node-framework","nodejs","serve-static","typescript"],"latest_commit_sha":null,"homepage":"https://nestjs.com/","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/nestjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2019-07-17T19:22:27.000Z","updated_at":"2025-05-09T16:02:20.000Z","dependencies_parsed_at":"2024-01-13T05:12:08.523Z","dependency_job_id":"d5c5a73e-2f3f-484d-a50a-32db19c4bf62","html_url":"https://github.com/nestjs/serve-static","commit_stats":{"total_commits":1469,"total_committers":16,"mean_commits":91.8125,"dds":"0.43907420013614706","last_synced_commit":"2234c47baaa90242a47f3204e4b35833fd9d9c63"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nestjs%2Fserve-static","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nestjs%2Fserve-static/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nestjs%2Fserve-static/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nestjs%2Fserve-static/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nestjs","download_url":"https://codeload.github.com/nestjs/serve-static/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253509781,"owners_count":21919589,"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":["javascript","nestjs","node","node-framework","nodejs","serve-static","typescript"],"created_at":"2024-09-24T13:57:58.632Z","updated_at":"2025-05-14T03:11:12.711Z","avatar_url":"https://github.com/nestjs.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://nestjs.com/\" target=\"blank\"\u003e\u003cimg src=\"https://nestjs.com/img/logo-small.svg\" width=\"120\" alt=\"Nest Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master\n[travis-url]: https://travis-ci.org/nestjs/nest\n[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux\n[linux-url]: https://travis-ci.org/nestjs/nest\n\n  \u003cp align=\"center\"\u003eA progressive \u003ca href=\"http://nodejs.org\" target=\"blank\"\u003eNode.js\u003c/a\u003e framework for building efficient and scalable server-side applications.\u003c/p\u003e\n    \u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.npmjs.com/~nestjscore\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@nestjs/core.svg\" alt=\"NPM Version\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/~nestjscore\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/@nestjs/core.svg\" alt=\"Package License\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/~nestjscore\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/@nestjs/core.svg\" alt=\"NPM Downloads\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://discord.gg/G7Qnnhy\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/discord-online-brightgreen.svg\" alt=\"Discord\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/nest#backer\"\u003e\u003cimg src=\"https://opencollective.com/nest/backers/badge.svg\" alt=\"Backers on Open Collective\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/nest#sponsor\"\u003e\u003cimg src=\"https://opencollective.com/nest/sponsors/badge.svg\" alt=\"Sponsors on Open Collective\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://paypal.me/kamilmysliwiec\"\u003e\u003cimg src=\"https://img.shields.io/badge/Donate-PayPal-dc3d53.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://twitter.com/nestframework\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/nestframework.svg?style=social\u0026label=Follow\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n  \u003c!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)\n  [![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)--\u003e\n\n## Description\n\n`@nestjs/serve-static` package for [Nest](https://github.com/nestjs/nest), useful to serve static content like Single Page Applications (SPA). However, if you are building MVC application or want to serve assets files (images, docs), use the `useStaticAssets()` method (read more [here](https://docs.nestjs.com/techniques/mvc)) instead.\n\n## Installation\n\n```bash\n$ npm i --save @nestjs/serve-static\n```\n\n## Example\n\nSee full example [here](https://github.com/nestjs/nest/tree/master/sample/24-serve-static).\n\n## Usage\n\nSimply import `ServeStaticModule` in your Nest application.\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { join } from 'path';\nimport { ServeStaticModule } from '@nestjs/serve-static';\n\n@Module({\n  imports: [\n    ServeStaticModule.forRoot({\n      rootPath: join(__dirname, '..', 'client')\n    })\n  ]\n})\nexport class ApplicationModule {}\n```\n\n## API Spec\n\nThe `forRoot()` method takes an options object with a few useful properties.\n\n| Property             | Type            | Description                                                                                                                                                                                          |\n| -------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `rootPath`           | string          | Static files root directory. Default: `\"client\"`                                                                                                                                                     |\n| `serveRoot`          | string          | Root path under which static app will be served. Default: `\"\"`                                                                                                                                       |\n| `renderPath`         | string / RegExp | Path to render static app (concatenated with the `serveRoot` value). Default: \\* (wildcard - all paths). Note: `RegExp` is not supported by the `@nestjs/platform-fastify`.                          |\n| `exclude`            | string[]        | Paths to exclude when serving the static app. WARNING! Not supported by `fastify`. If you use `fastify`, you can exclude routes using regexp (set the `renderPath` to a regular expression) instead. |\n| `serveStaticOptions` | Object          | Serve static options (static files)                                                                                                                                                                  |\n| `useGlobalPrefix`    | boolean         | If `true`, static app will be prefixed by the global prefix set through `setGlobalPrefix()`. Default: `false` https://docs.nestjs.com/faq/global-prefix                                              |\n\n## Support\n\nNest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).\n\n## Stay in touch\n\n- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)\n- Website - [https://nestjs.com](https://nestjs.com/)\n- Twitter - [@nestframework](https://twitter.com/nestframework)\n\n## License\n\nNest is [MIT licensed](LICENSE).\n","funding_links":["https://opencollective.com/nest","https://paypal.me/kamilmysliwiec"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnestjs%2Fserve-static","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnestjs%2Fserve-static","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnestjs%2Fserve-static/lists"}