{"id":16255847,"url":"https://github.com/atinux/nuxt-server-assets","last_synced_at":"2025-06-29T13:03:16.583Z","repository":{"id":251738098,"uuid":"745867849","full_name":"atinux/nuxt-server-assets","owner":"atinux","description":"How to use Nuxt with server/assets/ to use static assets from server routes.","archived":false,"fork":false,"pushed_at":"2024-01-23T09:19:56.000Z","size":10579,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-22T00:16:28.718Z","etag":null,"topics":["nitro","nuxt","server"],"latest_commit_sha":null,"homepage":"https://nuxt-server-assets.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atinux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-01-20T11:45:35.000Z","updated_at":"2024-08-05T20:26:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"9bd85c75-e21a-4184-961b-cf7a719fffec","html_url":"https://github.com/atinux/nuxt-server-assets","commit_stats":null,"previous_names":["atinux/nuxt-server-assets"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/atinux/nuxt-server-assets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atinux%2Fnuxt-server-assets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atinux%2Fnuxt-server-assets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atinux%2Fnuxt-server-assets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atinux%2Fnuxt-server-assets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atinux","download_url":"https://codeload.github.com/atinux/nuxt-server-assets/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atinux%2Fnuxt-server-assets/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262598140,"owners_count":23334667,"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":["nitro","nuxt","server"],"created_at":"2024-10-10T15:43:56.324Z","updated_at":"2025-06-29T13:03:16.565Z","avatar_url":"https://github.com/atinux.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nuxt Server Assets\n\nThis is a demonstration of how to use Nuxt with `server/assets/` to use static assets from server routes.\n\n- [Nuxt Server Directory](https://nuxt.com/docs/guide/directory-structure/server)\n- [Nitro Server Assets](https://nitro.unjs.io/guide/assets#server-assets)\n- [Unstorage](https://unstorage.unjs.io/)\n\nCheckout these files to see how it works:\n- [`server/assets/`](./server/assets/): The server assets directory\n- [`server/routes/pdf.ts`](./server/routes/pdf.ts): The server route that generates the PDF by reading the font from `server/assets/fonts/`\n- [`server/routes/random.jpg.ts`](./server/routes/random.jpg.ts): The server route that return a random image from `server/assets/images/` (note, this is for example purpose and we don't recommend doing this as it increase the server bundle size)\n\nWhen building your application, the `server/assets/` files will be copied to the `.output/server/chunks/raw` directory to be read on any serverless platform.\n\n## Credits\n\nI created this demo after seeing [this tweet](https://twitter.com/Rich_Harris/status/1748450915407806509) by [Rich Harris](https://twitter.com/Rich_Harris).\n\n- [Rich-Harris/fowl-play](https://github.com/Rich-Harris/fowl-play/tree/main)\n- [Rich-Harris/sveltekit-pdf-demo](https://github.com/Rich-Harris/sveltekit-pdf-demo)\n\n## Setup\n\nMake sure to install the dependencies:\n\n```bash\n# npm\nnpm install\n\n# pnpm\npnpm install\n\n# yarn\nyarn install\n\n# bun\nbun install\n```\n\n## Development Server\n\nStart the development server on `http://localhost:3000`:\n\n```bash\n# npm\nnpm run dev\n\n# pnpm\npnpm run dev\n\n# yarn\nyarn dev\n\n# bun\nbun run dev\n```\n\n## Production\n\nBuild the application for production:\n\n```bash\n# npm\nnpm run build\n\n# pnpm\npnpm run build\n\n# yarn\nyarn build\n\n# bun\nbun run build\n```\n\nLocally preview production build:\n\n```bash\n# npm\nnpm run preview\n\n# pnpm\npnpm run preview\n\n# yarn\nyarn preview\n\n# bun\nbun run preview\n```\n\nCheck out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatinux%2Fnuxt-server-assets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatinux%2Fnuxt-server-assets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatinux%2Fnuxt-server-assets/lists"}