{"id":19924481,"url":"https://github.com/giacomorebonato/fastify-vite-plugin","last_synced_at":"2026-04-14T06:32:36.877Z","repository":{"id":177862158,"uuid":"661024724","full_name":"giacomorebonato/fastify-vite-plugin","owner":"giacomorebonato","description":"Integrates a Vite SPA into a Fastify application","archived":false,"fork":false,"pushed_at":"2023-08-08T11:41:42.000Z","size":170,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-26T03:57:50.102Z","etag":null,"topics":["fastify","fastify-plugin","spa","vite"],"latest_commit_sha":null,"homepage":"","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/giacomorebonato.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-07-01T14:52:02.000Z","updated_at":"2023-07-02T14:06:56.000Z","dependencies_parsed_at":"2025-01-12T00:24:06.491Z","dependency_job_id":"406110f0-1b91-4d85-be21-9819e77f1738","html_url":"https://github.com/giacomorebonato/fastify-vite-plugin","commit_stats":null,"previous_names":["giacomorebonato/fastify-vite-plugin"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/giacomorebonato/fastify-vite-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giacomorebonato%2Ffastify-vite-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giacomorebonato%2Ffastify-vite-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giacomorebonato%2Ffastify-vite-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giacomorebonato%2Ffastify-vite-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giacomorebonato","download_url":"https://codeload.github.com/giacomorebonato/fastify-vite-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giacomorebonato%2Ffastify-vite-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31785527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","fastify-plugin","spa","vite"],"created_at":"2024-11-12T22:17:42.214Z","updated_at":"2026-04-14T06:32:36.861Z","avatar_url":"https://github.com/giacomorebonato.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![release workflow](https://github.com/giacomorebonato/fastify-vite-plugin/actions/workflows/release.yml/badge.svg) ![playwright workflow](https://github.com/giacomorebonato/fastify-vite-plugin/actions/workflows/playwright.yml/badge.svg)\n\n# vite-plugin-ts\n\nA Fastify plugin to integrate a Vite **SPA** into the current project and serving both frontend and backend from the same host.  \nIt doesn't aim to deal with server side rendering, but you can still do that from your Fastify application.  \nIt could be an interesting use case to render HTML only if the request is made by a bot. A bot can be detected using [isbot package](https://www.npmjs.com/package/isbot).\nIt's configured to not ship Vite in production and to only serve its produced assets.\n\n## Usage\n\n\n```typescript\nimport { fastifyVitePlugin } from 'fastify-vite-plugin'\nimport Fastify from 'fastify'\n\nconst app = Fastify()\n\n// place your routes before the plugin registration\n// otherwise the \"catch all\" route that renders index.html\n// for the SPA will take precedence\n\nawait app.register(fastifyVitePlugin)\n\nawait app.listen({\n  port: process.env.PORT,\n  host: process.env.NODE_ENV === 'development' ? '0.0.0.0' : undefined,\n})\n```\n\nExample `vite.config.ts`\n\n```typescript\nimport react from '@vitejs/plugin-react-swc'\nimport { VitePWA } from 'vite-plugin-pwa'\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n  plugins: [\n    react(),\n    VitePWA({\n      workbox: {\n        globPatterns: ['**/*.{js,css}'],\n        navigateFallback: null,\n      },\n      includeAssets: ['**/*'],\n    }),\n  ],\n})\n\n```\n\nThe above configuration will just work in dev mode.  \nWhen you do `npx vite build` for `NODE_ENV=production` make sure that the output is located into `/dist/assets`.\n\n## Options\n\nThe following options need to be specified if they are changed in `vite.config.ts.`\n\n* `viteOutDir` defaults to `dist`\n* `viteAssetsDir` defaults to `/assets/` relative path for where Vite stores its production assets\n\n\n## Requirements\n\n* it assumes index.html is placed in the root of the project\n* its assumes `npx vite build` is executed before starting the application with `NODE_ENV=production`\n  * if you are using TypeScript, it should be in the same step where you compile your code to JavaScript\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiacomorebonato%2Ffastify-vite-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiacomorebonato%2Ffastify-vite-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiacomorebonato%2Ffastify-vite-plugin/lists"}