{"id":22485522,"url":"https://github.com/Gomah/fastify-nuxtjs","last_synced_at":"2025-08-02T18:32:46.850Z","repository":{"id":37625277,"uuid":"333601734","full_name":"Gomah/fastify-nuxtjs","owner":"Gomah","description":"Vue server side rendering support for Fastify with Nuxt","archived":false,"fork":false,"pushed_at":"2022-04-05T04:58:13.000Z","size":1906,"stargazers_count":40,"open_issues_count":4,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-26T07:04:45.528Z","etag":null,"topics":["fastify","nuxt","nuxtjs","ssr","vue"],"latest_commit_sha":null,"homepage":"https://fastify-nuxt.vercel.app","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/Gomah.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-28T00:45:06.000Z","updated_at":"2024-10-21T19:48:17.000Z","dependencies_parsed_at":"2022-09-06T08:10:40.168Z","dependency_job_id":null,"html_url":"https://github.com/Gomah/fastify-nuxtjs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gomah%2Ffastify-nuxtjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gomah%2Ffastify-nuxtjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gomah%2Ffastify-nuxtjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gomah%2Ffastify-nuxtjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gomah","download_url":"https://codeload.github.com/Gomah/fastify-nuxtjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228499979,"owners_count":17929990,"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":["fastify","nuxt","nuxtjs","ssr","vue"],"created_at":"2024-12-06T17:12:47.927Z","updated_at":"2024-12-06T17:14:37.250Z","avatar_url":"https://github.com/Gomah.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![fastify-nuxtjs](https://fastify-nuxt.vercel.app/preview.png)](https://fastify-nuxt.vercel.app)\n\n# fastify-nuxtjs\n\n[![npm version][npm-version-src]][npm-version-href]\n[![Dependencies][david-dm-src]][david-dm-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-0A0A0A.svg?style=flat-square)](https://prettier.io/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-black.svg?style=flat-square)](https://opensource.org/licenses/MIT)\n![CI workflow](https://github.com/gomah/fastify-nuxtjs/workflows/CI%20workflow/badge.svg)\n\nVue server side rendering support for Fastify with [Nuxt.js](https://nuxtjs.org/docs/2.x/internals-glossary/nuxt) Framework.\n\n## Install\n\nInstall with yarn:\n\n```bash\nyarn add fastify-nuxtjs nuxt\n```\n\nInstall with npm:\n\n```bash\nnpm install fastify-nuxtjs nuxt\n```\n\n## Usage\n\nSince Nuxt needs some time to be ready on the first launch, you must declare your routes inside the `after` callback, after you registered the plugin.\nThe plugin will expose the api `nuxt` in Fastify that will handle the rendering for you.\n\n```js\nconst fastify = require('fastify')();\n\nfastify.register(require('fastify-nuxtjs')).after(() =\u003e {\n  fastify.nuxt('/hello');\n});\n\nfastify.listen(3000, (err) =\u003e {\n  if (err) throw err;\n  console.log('Server listening on http://localhost:3000');\n});\n```\n\nAll you server rendered pages must be saved in the folder `pages`, as you can see in the [nuxt documentation](https://nuxtjs.org/docs/2.x/internals-glossary/nuxt).\n\n```vue\n\u003ctemplate\u003e\n  \u003cHelloWorld /\u003e\n\u003c/template\u003e\n```\n\nIf you need to handle the render part yourself, just pass a callback to `nuxt`:\n\n```js\nfastify.nuxt('/hello', (app, req, reply) =\u003e {\n  // your code\n  // `app` is the Nuxt instance\n  app.render(req.raw, reply.raw, '/hello', req.query, {});\n});\n```\n\n### Serve all routes from your `pages/` folder\n\nUsing `*`:\n\n```ts\nconst fastify = require('fastify')();\n\nfastify.register(require('fastify-nuxtjs')).after(() =\u003e {\n  fastify.nuxt('*');\n});\n```\n\nOr import your generated `routes.json` from your `.nuxt` folder:\n\n```ts\nconst nuxtRoutes = require('./.nuxt/routes.json');\nconst fastify = require('fastify')();\n\nfastify.register(require('fastify-nuxtjs')).after(() =\u003e {\n  nuxtRoutes.forEach((nuxtRoute) =\u003e {\n    fastify.nuxt(nuxtRoute.path);\n  });\n});\n```\n\n## Acknowledgements\n\nHeavily inspired by [fastify-nextjs](https://github.com/fastify/fastify-nextjs)\n\n## License\n\nLicensed under [MIT](./LICENSE).\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/dt/fastify-nuxtjs.svg?style=flat-square\n[npm-version-href]: https://npmjs.com/package/fastify-nuxtjs\n[npm-downloads-src]: https://img.shields.io/npm/v/fastify-nuxtjs/latest.svg?style=flat-square\n[npm-downloads-href]: https://npmjs.com/package/fastify-nuxtjs\n[david-dm-src]: https://david-dm.org/gomah/fastify-nuxtjs/status.svg?style=flat-square\n[david-dm-href]: https://david-dm.org/gomah/fastify-nuxtjs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGomah%2Ffastify-nuxtjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGomah%2Ffastify-nuxtjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGomah%2Ffastify-nuxtjs/lists"}